robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
0bb2f5cc08
master
1" Vim filetype plugin file 2" Language: systemd.unit(5) 3" Keyword Lookup Support: Enno Nagel <enno.nagel+vim@gmail.com> 4" Latest Revision: 2024-10-02 (small fixes to &keywordprg) 5 6if exists ( "b:did_ftplugin" ) 7finish 8endif 9" Looks a lot like dosini files. 10runtime ! ftplugin/dosini[.]{vim,lua} 11 12if has ( 'unix' ) && executable ( 'less' ) && exists ( ':terminal' ) == 2 13command ! -buffer -nargs = 1 SystemdKeywordPrg silent exe 'term ++close ' KeywordLookup_systemd(<q-args>) 14silent ! function KeywordLookup_systemd ( keyword ) abort 15let matches = matchlist ( getline ( search ( '\v^\s*\[\s*.+\s*\]\s*$' , 'nbWz' )), '\v^\s*\[\s*(\k+).*\]\s*$' ) 16if len ( matches ) > 1 17let section = matches [ 1 ] 18return 'env LESS= MANPAGER="less --pattern=''(^|,)\\s+' . a: keyword . '=$'' --hilite-search" man ' . 'systemd.' . section 19else 20return 'env LESS= MANPAGER="less --pattern=''(^|,)\\s+' . a: keyword . '=$'' --hilite-search" man ' . 'systemd' 21endif 22endfunction 23setlocal iskeyword += - 24setlocal keywordprg = :SystemdKeywordPrg 25if ! exists ( 'b:undo_ftplugin' ) || empty ( b: undo_ftplugin ) 26let b: undo_ftplugin = 'setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg' 27else 28let b: undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg' 29endif 30endif