move function to autoload

This commit is contained in:
2022-11-01 22:44:06 -04:00
parent 714801b466
commit 28a044cad4
2 changed files with 24 additions and 20 deletions

19
autoload/logrotate.vim Normal file
View File

@ -0,0 +1,19 @@
vim9script
export def LogrotateHelp(awkcmd: string, word: string)
const searchcmd =<< trim eval END
echo "<=== man logrotate ===>"
COLUMNS=80 man logrotate 2>/dev/null |
{awkcmd} '/^CONFIGURATION FILE DIRECTIVES/,/^SCRIPTS/' | {awkcmd} '
/^ {{7}}{word}/,false {{
if(firstLineDone && /^ {{0,7}}[^ ]/ && !/endscript/) exit
firstLineDone = 1
print(substr($0, 8))
}}'
END
searchcmd
->join("\n")
->systemlist()
->popup_atcursor({ "padding": [0, 1, 1, 1] })
enddef