runtime: make command name for &iskeywordprg more unique (#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.

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Enno
2023-10-08 19:14:07 +02:00
committed by GitHub
parent b852305dbf
commit 1e33cd72b6
9 changed files with 53 additions and 52 deletions

View File

@ -1,6 +1,7 @@
" 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.
@ -9,11 +10,11 @@ endif
if has('unix') && executable('less')
if !has('gui_running')
command -buffer -nargs=1 Sman silent exe '!' . KeywordLookup_systemd(<q-args>) | redraw!
command -buffer -nargs=1 SystemdKeywordPrg silent exe '!' . KeywordLookup_systemd(<q-args>) | redraw!
elseif has('terminal')
command -buffer -nargs=1 Sman silent exe 'term ' . KeywordLookup_systemd(<q-args>)
command -buffer -nargs=1 SystemdKeywordPrg silent exe 'term ' . KeywordLookup_systemd(<q-args>)
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