Add documentation
This commit is contained in:
parent
28a044cad4
commit
97993040d3
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
tags
|
15
README.md
15
README.md
@ -1,3 +1,14 @@
|
|||||||
# logrotate vim plugin
|
# vim-logrotate
|
||||||
|
|
||||||
Syntax and help for logrotate config files
|
Syntax and help for logrotate config files in /etc/logrotate.d/*
|
||||||
|
|
||||||
|
# Install
|
||||||
|
|
||||||
|
mkdir -p ~/.vim/pack/gitpacks/start/
|
||||||
|
git clone https://github.com/balki/vim-logrotate
|
||||||
|
vim +":helptags ALL" +"qa"
|
||||||
|
|
||||||
|
# Requirements
|
||||||
|
|
||||||
|
1. Vim installation that includes patch-8.2.4770. (Works in Ubuntu 22.10)
|
||||||
|
2. [gawk](https://www.gnu.org/software/gawk/manual/gawk.html) installed. See `g:logrotate_awk` config option to use a different awk
|
||||||
|
52
doc/vim-logrotate.txt
Normal file
52
doc/vim-logrotate.txt
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
*vim-logrotate.txt* Syntax and help plugin for logrotate files
|
||||||
|
*vim-logrotate*
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
CONTENTS *vim-logrotate-contents*
|
||||||
|
|
||||||
|
Features |vim-logrotate-features|
|
||||||
|
LogRotateHelp |:LogRotateHelp|
|
||||||
|
g:logrotate_awk |g:logrotate_awk|
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
Features *vim-logrotate-features*
|
||||||
|
|
||||||
|
1. Detect and enable syntax-highlighting for logrotate files
|
||||||
|
2. Sets 'omnifunc' to complete logrotate directives
|
||||||
|
3. Sets 'keywordprg' to show help for logrotate directives
|
||||||
|
|
||||||
|
|
||||||
|
:LogRotateHelp {directive} *:LogRotateHelp*
|
||||||
|
|
||||||
|
Shows the help for the directive in a popup window at cursor. Help text is
|
||||||
|
extracted from the logrotate manual page (man logrotate).
|
||||||
|
|
||||||
|
`:LogRotateHelp` is only enabled if
|
||||||
|
|
||||||
|
1. Vim installation includes patch-8.2.4770
|
||||||
|
2. An "awk" command is available that supports ranges in regular expression.
|
||||||
|
(like "\d{1,4}"). Set |g:logrotate_awk| to use a different awk command.
|
||||||
|
|
||||||
|
'keywordprg' is set so |K| works on directives. A different mapping can be set
|
||||||
|
as shown below >
|
||||||
|
nmap <silent><leader>k :exe ':LogRotateHelp ' .. expand("<cword>")<CR>
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
|
g:logrotate_awk *g:logrotate_awk*
|
||||||
|
Type: |String|
|
||||||
|
Default: "gawk"
|
||||||
|
|
||||||
|
Set a different awk command to parse man page.
|
||||||
|
E.g. "goawk" (https://github.com/benhoyt/goawk)
|
||||||
|
|
||||||
|
Set to "disable" to disable help feature
|
||||||
|
|
||||||
|
Example: >
|
||||||
|
let g:logrotate_awk = "goawk"
|
||||||
|
<
|
||||||
|
|
||||||
|
vim: ft=help tw=78 et ts=2 sw=2 sts=2 norl
|
@ -18,10 +18,10 @@ else
|
|||||||
awkcmd = "gawk"
|
awkcmd = "gawk"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if awkcmd != "disable" && executable(awkcmd)
|
if has("patch-8.2.4770") && awkcmd != "disable" && executable(awkcmd)
|
||||||
|
|
||||||
command -nargs=1 LogRotateHelpCmd :call g:logrotate#LogrotateHelp(awkcmd, <f-args>)
|
command -nargs=1 LogRotateHelp :call g:logrotate#LogrotateHelp(awkcmd, <f-args>)
|
||||||
setlocal keywordprg=:LogRotateHelpCmd
|
setlocal keywordprg=:LogRotateHelp
|
||||||
b:undo_ftplugin = b:undo_ftplugin .. " keywordprg<"
|
b:undo_ftplugin = b:undo_ftplugin .. " keywordprg<"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user