From 0ba388847417b8aed469976acf94f9633cb03f15 Mon Sep 17 00:00:00 2001 From: Enno Date: Wed, 18 Sep 2024 13:20:14 +0200 Subject: vim-patch:5036e69: runtime(systemd): allow for overriding systemd ftplugin settings (vim/vim#13373) (#30414) closes: vim/vim#13357 https://github.com/vim/vim/commit/5036e698520b2c39e4df5738f026a68ba2e76fef --- runtime/ftplugin/systemd.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'runtime/ftplugin/systemd.vim') diff --git a/runtime/ftplugin/systemd.vim b/runtime/ftplugin/systemd.vim index 8bcacdd381..d268bfee7a 100644 --- a/runtime/ftplugin/systemd.vim +++ b/runtime/ftplugin/systemd.vim @@ -3,10 +3,11 @@ " Keyword Lookup Support: Enno Nagel " Latest Revision: 2023-10-07 -if !exists('b:did_ftplugin') - " Looks a lot like dosini files. - runtime! ftplugin/dosini.vim +if exists("b:did_ftplugin") + finish endif +" Looks a lot like dosini files. +runtime! ftplugin/dosini.vim if has('unix') && executable('less') if !has('gui_running') -- cgit From b40b22f426899d58c32bd7cb788464dc535b1eb9 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 19 Sep 2024 19:46:50 +0200 Subject: vim-patch:f86568f: runtime(misc): simplify keywordprg in various ftplugins closes: vim/vim#15696 https://github.com/vim/vim/commit/f86568f91848ece0c5da2178881b3ed858dae799 Co-authored-by: Konfekt --- runtime/ftplugin/systemd.vim | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) (limited to 'runtime/ftplugin/systemd.vim') diff --git a/runtime/ftplugin/systemd.vim b/runtime/ftplugin/systemd.vim index d268bfee7a..44e70bc224 100644 --- a/runtime/ftplugin/systemd.vim +++ b/runtime/ftplugin/systemd.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: systemd.unit(5) " Keyword Lookup Support: Enno Nagel -" Latest Revision: 2023-10-07 +" Latest Revision: 2024-09-19 (simplify keywordprg #15696) if exists("b:did_ftplugin") finish @@ -9,30 +9,22 @@ endif " Looks a lot like dosini files. runtime! ftplugin/dosini.vim -if has('unix') && executable('less') - if !has('gui_running') - command -buffer -nargs=1 SystemdKeywordPrg silent exe '!' . KeywordLookup_systemd() | redraw! - elseif has('terminal') - command -buffer -nargs=1 SystemdKeywordPrg silent exe 'term ' . KeywordLookup_systemd() - 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<' +if has('unix') && executable('less') && exists(':terminal') == 2 + command -buffer -nargs=1 SystemdKeywordPrg silent exe 'term ' . KeywordLookup_systemd() + silent! 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 - let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg' + return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd' endif + endfunction + setlocal iskeyword+=- + setlocal keywordprg=:SystemdKeywordPrg + if !exists('b:undo_ftplugin') || empty(b:undo_ftplugin) + let b:undo_ftplugin = 'setlocal keywordprg< iskeyword<' + else + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg' endif endif -- cgit From b9737891154750e16429e67c92f392d8f29bd820 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 3 Oct 2024 09:46:16 +0200 Subject: vim-patch:f416a22: runtime(systemd): small fixes to &keywordprg in ftplugin closes: vim/vim#15784 https://github.com/vim/vim/commit/f416a2220fbd457c3d3389fb0be59bee534a7491 Co-authored-by: Konfekt --- runtime/ftplugin/systemd.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'runtime/ftplugin/systemd.vim') diff --git a/runtime/ftplugin/systemd.vim b/runtime/ftplugin/systemd.vim index 44e70bc224..1b1d242029 100644 --- a/runtime/ftplugin/systemd.vim +++ b/runtime/ftplugin/systemd.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: systemd.unit(5) " Keyword Lookup Support: Enno Nagel -" Latest Revision: 2024-09-19 (simplify keywordprg #15696) +" Latest Revision: 2024-10-02 (small fixes to &keywordprg) if exists("b:did_ftplugin") finish @@ -10,20 +10,20 @@ endif runtime! ftplugin/dosini.vim if has('unix') && executable('less') && exists(':terminal') == 2 - command -buffer -nargs=1 SystemdKeywordPrg silent exe 'term ' . KeywordLookup_systemd() + command! -buffer -nargs=1 SystemdKeywordPrg silent exe 'term ++close ' KeywordLookup_systemd() silent! 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 + return 'env 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' + return 'env LESS= MANPAGER="less --pattern=''(^|,)\\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd' endif endfunction setlocal iskeyword+=- setlocal keywordprg=:SystemdKeywordPrg if !exists('b:undo_ftplugin') || empty(b:undo_ftplugin) - let b:undo_ftplugin = 'setlocal keywordprg< iskeyword<' + let b:undo_ftplugin = 'setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg' else let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg' endif -- cgit