diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 22:39:54 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 22:39:54 +0000 |
commit | 21cb7d04c387e4198ca8098a884c78b56ffcf4c2 (patch) | |
tree | 84fe5690df1551f0bb2bdfe1a13aacd29ebc1de7 /runtime/ftplugin/systemd.vim | |
parent | d9c904f85a23a496df4eb6be42aa43f007b22d50 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-colorcolchar.tar.gz rneovim-colorcolchar.tar.bz2 rneovim-colorcolchar.zip |
Merge remote-tracking branch 'upstream/master' into colorcolcharcolorcolchar
Diffstat (limited to 'runtime/ftplugin/systemd.vim')
-rw-r--r-- | runtime/ftplugin/systemd.vim | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/runtime/ftplugin/systemd.vim b/runtime/ftplugin/systemd.vim index 4c5c9a1dc1..8bcacdd381 100644 --- a/runtime/ftplugin/systemd.vim +++ b/runtime/ftplugin/systemd.vim @@ -1,41 +1,37 @@ " Vim filetype plugin file " Language: systemd.unit(5) " Keyword Lookup Support: Enno Nagel <enno.nagel+vim@gmail.com> +" Latest Revision: 2023-10-07 if !exists('b:did_ftplugin') " Looks a lot like dosini files. runtime! ftplugin/dosini.vim endif -if !has('unix') - finish -endif - -if !has('gui_running') - command! -buffer -nargs=1 Sman silent exe '!' . KeywordLookup_systemd(<q-args>) | redraw! -elseif has('terminal') - command! -buffer -nargs=1 Sman silent exe 'term ' . KeywordLookup_systemd(<q-args>) -else - finish -endif - -if !exists('*KeywordLookup_systemd') - function KeywordLookup_systemd(keyword) abort - let matches = matchlist(getline(search('\v^\s*\[\s*.+\s*\]\s*$', 'nbWz')), '\v^\s*\[\s*(\k+).*\]\s*$') - if len(matches) > 1 - let section = matches[1] - return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd.' . section +if has('unix') && executable('less') + if !has('gui_running') + command -buffer -nargs=1 SystemdKeywordPrg silent exe '!' . KeywordLookup_systemd(<q-args>) | redraw! + elseif has('terminal') + command -buffer -nargs=1 SystemdKeywordPrg silent exe 'term ' . KeywordLookup_systemd(<q-args>) + endif + if exists(':SystemdKeywordPrg') == 2 + if !exists('*KeywordLookup_systemd') + function KeywordLookup_systemd(keyword) abort + let matches = matchlist(getline(search('\v^\s*\[\s*.+\s*\]\s*$', 'nbWz')), '\v^\s*\[\s*(\k+).*\]\s*$') + if len(matches) > 1 + let section = matches[1] + return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd.' . section + else + return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd' + endif + endfunction + endif + setlocal iskeyword+=- + setlocal keywordprg=:SystemdKeywordPrg + if !exists('b:undo_ftplugin') || empty(b:undo_ftplugin) + let b:undo_ftplugin = 'setlocal keywordprg< iskeyword<' else - return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd' + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg' endif - endfunction -endif - -setlocal iskeyword+=- -setlocal keywordprg=:Sman - -if !exists('b:undo_ftplugin') || empty(b:undo_ftplugin) - let b:undo_ftplugin = 'setlocal keywordprg< iskeyword<' -else - let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword<' + endif endif |