From e2c10dea19a329f7913eb1d6110f10ec4bc525f9 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 24 Aug 2023 09:08:24 +0900 Subject: vim-patch:2f25e40b1f54 runtime: configure keywordpg for some file types (vim/vim#5566) https://github.com/vim/vim/commit/2f25e40b1f545f4aa38377f0c25effb112b5d1ef Co-authored-by: Enno --- runtime/ftplugin/systemd.vim | 53 ++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 29 deletions(-) (limited to 'runtime/ftplugin/systemd.vim') diff --git a/runtime/ftplugin/systemd.vim b/runtime/ftplugin/systemd.vim index 4c5c9a1dc1..c0bc6302f2 100644 --- a/runtime/ftplugin/systemd.vim +++ b/runtime/ftplugin/systemd.vim @@ -7,35 +7,30 @@ if !exists('b:did_ftplugin') runtime! ftplugin/dosini.vim endif -if !has('unix') - finish -endif - -if !has('gui_running') - command! -buffer -nargs=1 Sman silent exe '!' . KeywordLookup_systemd() | redraw! -elseif has('terminal') - command! -buffer -nargs=1 Sman silent exe 'term ' . KeywordLookup_systemd() -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 Sman silent exe '!' . KeywordLookup_systemd() | redraw! + elseif has('terminal') + command -buffer -nargs=1 Sman silent exe 'term ' . KeywordLookup_systemd() + endif + if exists(':Sman') == 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=:Sman + 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<' 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 -- cgit From b2c3e9c72ef12a5bc276dec78cdc8dfbd2f5a24b Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 30 Aug 2023 18:16:30 +0200 Subject: vim-patch:9d8ef7cc4340 runtime: cleanup :Sman command via the undo_ftplugin mechanism (vim/vim#12967) Regards to @dkearns as noticed in https://github.com/vim/vim/commit/2ac708b548660b232a32c52d89bde3d8596646c0 https://github.com/vim/vim/commit/9d8ef7cc434076dfda62ca3d3101eaae52e316cd Co-authored-by: Enno --- runtime/ftplugin/systemd.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/ftplugin/systemd.vim') diff --git a/runtime/ftplugin/systemd.vim b/runtime/ftplugin/systemd.vim index c0bc6302f2..e60a5e4960 100644 --- a/runtime/ftplugin/systemd.vim +++ b/runtime/ftplugin/systemd.vim @@ -30,7 +30,7 @@ if has('unix') && executable('less') if !exists('b:undo_ftplugin') || empty(b:undo_ftplugin) let b:undo_ftplugin = 'setlocal keywordprg< iskeyword<' else - let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword<' + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer Sman' endif endif endif -- cgit From e5855697e90e379128a018a8d88cf5ec008b0623 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 8 Oct 2023 19:17:19 +0200 Subject: vim-patch:1e33cd72b60a runtime: make command name for &iskeywordprg more unique (vim/vim#13297) See https://github.com/vim/vim/pull/13213/commits by @dkearns: Rename 'keywordprg' user command to ShKeywordPrg as this is just a leaking implementation detail. https://github.com/vim/vim/commit/1e33cd72b60a119a038952bb658862d038602f76 Co-authored-by: Enno --- runtime/ftplugin/systemd.vim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'runtime/ftplugin/systemd.vim') diff --git a/runtime/ftplugin/systemd.vim b/runtime/ftplugin/systemd.vim index e60a5e4960..8bcacdd381 100644 --- a/runtime/ftplugin/systemd.vim +++ b/runtime/ftplugin/systemd.vim @@ -1,6 +1,7 @@ " Vim filetype plugin file " Language: systemd.unit(5) " Keyword Lookup Support: Enno Nagel +" Latest Revision: 2023-10-07 if !exists('b:did_ftplugin') " Looks a lot like dosini files. @@ -9,11 +10,11 @@ endif if has('unix') && executable('less') if !has('gui_running') - command -buffer -nargs=1 Sman silent exe '!' . KeywordLookup_systemd() | redraw! + command -buffer -nargs=1 SystemdKeywordPrg silent exe '!' . KeywordLookup_systemd() | redraw! elseif has('terminal') - command -buffer -nargs=1 Sman silent exe 'term ' . KeywordLookup_systemd() + command -buffer -nargs=1 SystemdKeywordPrg silent exe 'term ' . KeywordLookup_systemd() endif - if exists(':Sman') == 2 + 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*$') @@ -26,11 +27,11 @@ if has('unix') && executable('less') endfunction endif setlocal iskeyword+=- - setlocal keywordprg=:Sman + 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 Sman' + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg' endif endif endif -- cgit