vim9script # Vim filetype plugin file # Language: logrotate # if exists("b:did_ftplugin") finish endif b:did_ftplugin = 1 def LogrotateHelp(word: string) const searchcmd =<< trim END COLUMNS=80 man logrotate 2>/dev/null | gawk '/^CONFIGURATION FILE DIRECTIVES/,/^SCRIPTS/' | gawk ' /^ {7}%s/,/^[a-z]/ { if(firstLineDone) { if(/^ {0,7}[^ ]/ && !/endscript/) exit } firstLineDone = 1 print(substr($0, 8)) }' END printf(join(searchcmd, "\n"), word) ->systemlist() ->popup_atcursor({ "padding": [0, 1, 1, 1] }) enddef command -nargs=1 LogRt :call LogrotateHelp() b:undo_ftplugin = "setlocal comments< commentstring< formatoptions< keywordprg<" setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql keywordprg=:LogRt