mirror of
				https://github.com/vim/vim.git
				synced 2025-10-30 09:47:20 -04:00 
			
		
		
		
	runtime(misc): simplify keywordprg in various ftplugins
closes: #15696 Signed-off-by: Konfekt <Konfekt@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
		
				
					committed by
					
						 Christian Brabandt
						Christian Brabandt
					
				
			
			
				
	
			
			
			
						parent
						
							23079450a8
						
					
				
				
					commit
					f86568f918
				
			| @@ -1,7 +1,7 @@ | |||||||
| " Vim filetype plugin file | " Vim filetype plugin file | ||||||
| " Language:             gpg(1) configuration file | " Language:             gpg(1) configuration file | ||||||
| " Previous Maintainer:  Nikolai Weibull <now@bitwi.se> | " Previous Maintainer:  Nikolai Weibull <now@bitwi.se> | ||||||
| " Latest Revision:      2023-10-07 | " Latest Revision:      2024-09-19 (simplify keywordprg #15696) | ||||||
|  |  | ||||||
| if exists("b:did_ftplugin") | if exists("b:did_ftplugin") | ||||||
|   finish |   finish | ||||||
| @@ -15,21 +15,13 @@ let b:undo_ftplugin = "setl com< cms< fo<" | |||||||
|  |  | ||||||
| setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql | setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql | ||||||
|  |  | ||||||
| if has('unix') && executable('less') | if has('unix') && executable('less') && exists(':terminal') == 2 | ||||||
|   if !has('gui_running') |  | ||||||
|     command -buffer -nargs=1 GpgKeywordPrg |  | ||||||
|           \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+--' . <q-args> . '\b'' --hilite-search" man ' . 'gpg' | |  | ||||||
|           \ redraw! |  | ||||||
|   elseif has('terminal') |  | ||||||
|   command -buffer -nargs=1 GpgKeywordPrg |   command -buffer -nargs=1 GpgKeywordPrg | ||||||
|         \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+--' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'gpg' |         \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+--' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'gpg' | ||||||
|   endif |  | ||||||
|   if exists(':GpgKeywordPrg') == 2 |  | ||||||
|   setlocal iskeyword+=- |   setlocal iskeyword+=- | ||||||
|   setlocal keywordprg=:GpgKeywordPrg |   setlocal keywordprg=:GpgKeywordPrg | ||||||
|   let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer GpgKeywordPrg' |   let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer GpgKeywordPrg' | ||||||
| endif | endif | ||||||
| endif |  | ||||||
|  |  | ||||||
| let &cpo = s:cpo_save | let &cpo = s:cpo_save | ||||||
| unlet s:cpo_save | unlet s:cpo_save | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| " Vim filetype plugin file | " Vim filetype plugin file | ||||||
| " Language:             modules.conf(5) configuration file | " Language:             modules.conf(5) configuration file | ||||||
| " Previous Maintainer:  Nikolai Weibull <now@bitwi.se> | " Previous Maintainer:  Nikolai Weibull <now@bitwi.se> | ||||||
| " Latest Revision:      2023-10-07 | " Latest Revision:      2024-09-19 (simplify keywordprg #15696) | ||||||
|  |  | ||||||
| if exists("b:did_ftplugin") | if exists("b:did_ftplugin") | ||||||
|   finish |   finish | ||||||
| @@ -16,16 +16,9 @@ let b:undo_ftplugin = "setl com< cms< inc< fo<" | |||||||
| setlocal comments=:# commentstring=#\ %s include=^\\s*include | setlocal comments=:# commentstring=#\ %s include=^\\s*include | ||||||
| setlocal formatoptions-=t formatoptions+=croql | setlocal formatoptions-=t formatoptions+=croql | ||||||
|  |  | ||||||
| if has('unix') && executable('less') | if has('unix') && executable('less') && exists(':terminal') == 2 | ||||||
|   if !has('gui_running') |  | ||||||
|     command -buffer -nargs=1 ModconfKeywordPrg |  | ||||||
|           \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s{,8}' . <q-args> . '\b'' --hilite-search" man ' . 'modprobe.d' | |  | ||||||
|           \ redraw! |  | ||||||
|   elseif has('terminal') |  | ||||||
|   command -buffer -nargs=1 ModconfKeywordPrg |   command -buffer -nargs=1 ModconfKeywordPrg | ||||||
|         \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'modprobe.d' |         \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'modprobe.d' | ||||||
|   endif |  | ||||||
|   if exists(':ModconfKeywordPrg') == 2 |  | ||||||
|   setlocal iskeyword+=- |   setlocal iskeyword+=- | ||||||
|   setlocal keywordprg=:ModconfKeywordPrg |   setlocal keywordprg=:ModconfKeywordPrg | ||||||
|   let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer ModconfKeywordPrg' |   let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer ModconfKeywordPrg' | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| " Vim filetype plugin file | " Vim filetype plugin file | ||||||
| " Language:             mutt RC File | " Language:             mutt RC File | ||||||
| " Previous Maintainer:  Nikolai Weibull <now@bitwi.se> | " Previous Maintainer:  Nikolai Weibull <now@bitwi.se> | ||||||
| " Latest Revision:      2023-10-07 | " Latest Revision:      2024-09-19 (simplify keywordprg #15696) | ||||||
|  |  | ||||||
| if exists("b:did_ftplugin") | if exists("b:did_ftplugin") | ||||||
|   finish |   finish | ||||||
| @@ -18,21 +18,13 @@ setlocal formatoptions-=t formatoptions+=croql | |||||||
|  |  | ||||||
| let &l:include = '^\s*source\>' | let &l:include = '^\s*source\>' | ||||||
|  |  | ||||||
| if has('unix') && executable('less') | if has('unix') && executable('less') && exists(':terminal') == 2 | ||||||
|   if !has('gui_running') |  | ||||||
|     command -buffer -nargs=1 MuttrcKeywordPrg |  | ||||||
|           \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+' . <q-args> . '\b'' --hilite-search" man ' . 'muttrc' | |  | ||||||
|           \ redraw! |  | ||||||
|   elseif has('terminal') |  | ||||||
|   command -buffer -nargs=1 MuttrcKeywordPrg |   command -buffer -nargs=1 MuttrcKeywordPrg | ||||||
|         \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'muttrc' |         \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'muttrc' | ||||||
|   endif |  | ||||||
|   if exists(':MuttrcKeywordPrg') == 2 |  | ||||||
|   setlocal iskeyword+=- |   setlocal iskeyword+=- | ||||||
|   setlocal keywordprg=:MuttrcKeywordPrg |   setlocal keywordprg=:MuttrcKeywordPrg | ||||||
|   let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer MuttrcKeywordPrg' |   let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer MuttrcKeywordPrg' | ||||||
| endif | endif | ||||||
| endif |  | ||||||
|  |  | ||||||
| let &cpo = s:cpo_save | let &cpo = s:cpo_save | ||||||
| unlet s:cpo_save | unlet s:cpo_save | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ | |||||||
| " Last Change: 2021 Apr 02 | " Last Change: 2021 Apr 02 | ||||||
| "              2024 Jan 14 by Vim Project (browsefilter) | "              2024 Jan 14 by Vim Project (browsefilter) | ||||||
| "              2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring') | "              2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring') | ||||||
|  | "              2024 Sep 19 by Konfekt (simplify keywordprg #15696) | ||||||
|  |  | ||||||
| " Only do this when not done yet for this buffer | " Only do this when not done yet for this buffer | ||||||
| if exists("b:did_ftplugin") | finish | endif | if exists("b:did_ftplugin") | finish | endif | ||||||
| @@ -35,6 +36,10 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") | |||||||
| 	endif | 	endif | ||||||
| endif | endif | ||||||
|  |  | ||||||
|  | " Undo the stuff we changed | ||||||
|  | let b:undo_ftplugin = "setlocal tw< cms< fo< iskeyword<" . | ||||||
|  | 			\ " | unlet! b:browsefilter" | ||||||
|  |  | ||||||
| " Look up keywords by Get-Help: | " Look up keywords by Get-Help: | ||||||
| " check for PowerShell Core in Windows, Linux or MacOS | " check for PowerShell Core in Windows, Linux or MacOS | ||||||
| if executable('pwsh') | let s:pwsh_cmd = 'pwsh' | if executable('pwsh') | let s:pwsh_cmd = 'pwsh' | ||||||
| @@ -45,21 +50,14 @@ elseif executable('powershell.exe') | let s:pwsh_cmd = 'powershell.exe' | |||||||
| endif | endif | ||||||
|  |  | ||||||
| if exists('s:pwsh_cmd') | if exists('s:pwsh_cmd') | ||||||
|   if !has('gui_running') && executable('less') && |   if exists(':terminal') == 2 | ||||||
|         \ !(exists('$ConEmuBuild') && &term =~? '^xterm') |  | ||||||
|     " For exclusion of ConEmu, see https://github.com/Maximus5/ConEmu/issues/2048 |  | ||||||
|     command! -buffer -nargs=1 GetHelp silent exe '!' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>" | ' . (has('unix') ? 'LESS= less' : 'less') | redraw! |  | ||||||
|   elseif has('terminal') |  | ||||||
|     command! -buffer -nargs=1 GetHelp silent exe 'term ' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>"' . (executable('less') ? ' | less' : '') |     command! -buffer -nargs=1 GetHelp silent exe 'term ' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>"' . (executable('less') ? ' | less' : '') | ||||||
|   else |   else | ||||||
|     command! -buffer -nargs=1 GetHelp echo system(s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full <args>') |     command! -buffer -nargs=1 GetHelp echo system(s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full <args>') | ||||||
|   endif |   endif | ||||||
| endif |  | ||||||
|   setlocal keywordprg=:GetHelp |   setlocal keywordprg=:GetHelp | ||||||
|  |   let b:undo_ftplugin ..= " | setl kp< | sil! delc -buffer GetHelp" | ||||||
| " Undo the stuff we changed | endif | ||||||
| let b:undo_ftplugin = "setlocal tw< cms< fo< iskeyword< keywordprg<" . |  | ||||||
| 			\ " | unlet! b:browsefilter" |  | ||||||
|  |  | ||||||
| let &cpo = s:cpo_save | let &cpo = s:cpo_save | ||||||
| unlet s:cpo_save | unlet s:cpo_save | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
| " Language:		readline(3) configuration file | " Language:		readline(3) configuration file | ||||||
| " Maintainer:		Doug Kearns <dougkearns@gmail.com> | " Maintainer:		Doug Kearns <dougkearns@gmail.com> | ||||||
| " Previous Maintainer:	Nikolai Weibull <now@bitwi.se> | " Previous Maintainer:	Nikolai Weibull <now@bitwi.se> | ||||||
| " Last Change:		2023 Aug 22 | " Last Change:		2024 Sep 19 (simplify keywordprg #15696) | ||||||
|  |  | ||||||
| if exists("b:did_ftplugin") | if exists("b:did_ftplugin") | ||||||
|   finish |   finish | ||||||
| @@ -34,21 +34,13 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") | |||||||
|   let b:undo_ftplugin ..= " | unlet! b:browsefilter" |   let b:undo_ftplugin ..= " | unlet! b:browsefilter" | ||||||
| endif | endif | ||||||
|  |  | ||||||
| if has('unix') && executable('less') | if has('unix') && executable('less') && exists(':terminal') == 2 | ||||||
|   if !has('gui_running') |  | ||||||
|     command -buffer -nargs=1 ReadlineKeywordPrg |  | ||||||
|           \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+' . <q-args> . '\b'' --hilite-search" man ' . '3 readline' | |  | ||||||
|           \ redraw! |  | ||||||
|   elseif has('terminal') |  | ||||||
|   command -buffer -nargs=1 ReadlineKeywordPrg |   command -buffer -nargs=1 ReadlineKeywordPrg | ||||||
|         \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . '3 readline' |         \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . '3 readline' | ||||||
|   endif |  | ||||||
|   if exists(':ReadlineKeywordPrg') == 2 |  | ||||||
|   setlocal iskeyword+=- |   setlocal iskeyword+=- | ||||||
|   setlocal keywordprg=:ReadlineKeywordPrg |   setlocal keywordprg=:ReadlineKeywordPrg | ||||||
|   let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer ReadlineKeywordPrg' |   let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer ReadlineKeywordPrg' | ||||||
| endif | endif | ||||||
| endif |  | ||||||
|  |  | ||||||
| let &cpo = s:cpo_save | let &cpo = s:cpo_save | ||||||
| unlet s:cpo_save | unlet s:cpo_save | ||||||
|   | |||||||
| @@ -45,9 +45,7 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") | |||||||
| endif | endif | ||||||
|  |  | ||||||
| if get(b:, "is_bash", 0) | if get(b:, "is_bash", 0) | ||||||
|   if !has("gui_running") && executable("less") |   if exists(':terminal') == 2 | ||||||
|     command! -buffer -nargs=1 ShKeywordPrg silent exe '!bash -c "{ help "<args>" 2>/dev/null || MANPAGER= man "<args>"; } | LESS= less"' | redraw! |  | ||||||
|   elseif has("terminal") |  | ||||||
|     command! -buffer -nargs=1 ShKeywordPrg silent exe ':term bash -c "help "<args>" 2>/dev/null || man "<args>""' |     command! -buffer -nargs=1 ShKeywordPrg silent exe ':term bash -c "help "<args>" 2>/dev/null || man "<args>""' | ||||||
|   else |   else | ||||||
|     command! -buffer -nargs=1 ShKeywordPrg echo system('bash -c "help <args>" 2>/dev/null || MANPAGER= man "<args>"') |     command! -buffer -nargs=1 ShKeywordPrg echo system('bash -c "help <args>" 2>/dev/null || MANPAGER= man "<args>"') | ||||||
|   | |||||||
| @@ -1,7 +1,8 @@ | |||||||
| " Vim filetype plugin file | " Vim filetype plugin file | ||||||
| " Language:	OpenSSH client configuration file | " Language:	OpenSSH client configuration file | ||||||
|  | " Maintainer:	This runtime file is looking for a new maintainer. | ||||||
| " Previous Maintainer:	Nikolai Weibull <now@bitwi.se> | " Previous Maintainer:	Nikolai Weibull <now@bitwi.se> | ||||||
| " Latest Revision:  2023-10-07 | " Latest Revision:	2024-09-19 (simplify keywordprg #15696) | ||||||
|  |  | ||||||
| if exists("b:did_ftplugin") | if exists("b:did_ftplugin") | ||||||
|   finish |   finish | ||||||
| @@ -14,21 +15,13 @@ set cpo&vim | |||||||
| setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql | setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql | ||||||
| let b:undo_ftplugin = 'setlocal com< cms< fo<' | let b:undo_ftplugin = 'setlocal com< cms< fo<' | ||||||
|  |  | ||||||
| if has('unix') && executable('less') | if has('unix') && executable('less') && exists(':terminal') == 2 | ||||||
|   if !has('gui_running') |  | ||||||
|     command -buffer -nargs=1 SshconfigKeywordPrg |  | ||||||
|           \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+' . <q-args> . '$'' --hilite-search" man ' . 'ssh_config' | |  | ||||||
|           \ redraw! |  | ||||||
|   elseif has('terminal') |  | ||||||
|   command -buffer -nargs=1 SshconfigKeywordPrg |   command -buffer -nargs=1 SshconfigKeywordPrg | ||||||
|         \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '$', '\') . ''' --hilite-search" man ' . 'ssh_config' |         \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '$', '\') . ''' --hilite-search" man ' . 'ssh_config' | ||||||
|   endif |  | ||||||
|   if exists(':SshconfigKeywordPrg') == 2 |  | ||||||
|   setlocal iskeyword+=- |   setlocal iskeyword+=- | ||||||
|   setlocal keywordprg=:SshconfigKeywordPrg |   setlocal keywordprg=:SshconfigKeywordPrg | ||||||
|   let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SshconfigKeywordPrg' |   let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SshconfigKeywordPrg' | ||||||
| endif | endif | ||||||
| endif |  | ||||||
|  |  | ||||||
| let &cpo = s:cpo_save | let &cpo = s:cpo_save | ||||||
| unlet s:cpo_save | unlet s:cpo_save | ||||||
|   | |||||||
| @@ -1,7 +1,8 @@ | |||||||
| " Vim filetype plugin file | " Vim filetype plugin file | ||||||
| " Language:	sudoers(5) configuration files | " Language:	sudoers(5) configuration files | ||||||
|  | " Maintainer:	This runtime file is looking for a new maintainer. | ||||||
| " Previous Maintainer:	Nikolai Weibull <now@bitwi.se> | " Previous Maintainer:	Nikolai Weibull <now@bitwi.se> | ||||||
| " Latest Revision:      2023-10-07 | " Latest Revision:	2024-09-19 (simplify keywordprg #15696) | ||||||
|  |  | ||||||
| if exists("b:did_ftplugin") | if exists("b:did_ftplugin") | ||||||
|   finish |   finish | ||||||
| @@ -15,21 +16,13 @@ let b:undo_ftplugin = "setl com< cms< fo<" | |||||||
|  |  | ||||||
| setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql | setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql | ||||||
|  |  | ||||||
| if has('unix') && executable('less') | if has('unix') && executable('less') && exists(':terminal') == 2 | ||||||
|   if !has('gui_running') |  | ||||||
|     command -buffer -nargs=1 SudoersKeywordPrg |  | ||||||
|           \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''\b' . <q-args> . '\b'' --hilite-search" man ' . 'sudoers' | |  | ||||||
|           \ redraw! |  | ||||||
|   elseif has('terminal') |  | ||||||
|   command -buffer -nargs=1 SudoersKeywordPrg |   command -buffer -nargs=1 SudoersKeywordPrg | ||||||
|         \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('\b' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'sudoers' |         \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('\b' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'sudoers' | ||||||
|   endif |  | ||||||
|   if exists(':SudoersKeywordPrg') == 2 |  | ||||||
|   setlocal iskeyword+=- |   setlocal iskeyword+=- | ||||||
|   setlocal keywordprg=:SudoersKeywordPrg |   setlocal keywordprg=:SudoersKeywordPrg | ||||||
|   let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SudoersKeywordPrg' |   let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SudoersKeywordPrg' | ||||||
| endif | endif | ||||||
| endif |  | ||||||
|  |  | ||||||
| let &cpo = s:cpo_save | let &cpo = s:cpo_save | ||||||
| unlet s:cpo_save | unlet s:cpo_save | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| " Vim filetype plugin file | " Vim filetype plugin file | ||||||
| " Language:			systemd.unit(5) | " Language:			systemd.unit(5) | ||||||
| " Keyword Lookup Support:	Enno Nagel <enno.nagel+vim@gmail.com> | " Keyword Lookup Support:	Enno Nagel <enno.nagel+vim@gmail.com> | ||||||
| " Latest Revision:      2023-10-07 | " Latest Revision:		2024-09-19 (simplify keywordprg #15696) | ||||||
|  |  | ||||||
| if exists("b:did_ftplugin") | if exists("b:did_ftplugin") | ||||||
|   finish |   finish | ||||||
| @@ -9,15 +9,9 @@ endif | |||||||
| " Looks a lot like dosini files. | " Looks a lot like dosini files. | ||||||
| runtime! ftplugin/dosini.vim | runtime! ftplugin/dosini.vim | ||||||
|  |  | ||||||
| if has('unix') && executable('less') | if has('unix') && executable('less') && exists(':terminal') == 2 | ||||||
|   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>) |   command -buffer -nargs=1 SystemdKeywordPrg silent exe 'term ' . KeywordLookup_systemd(<q-args>) | ||||||
|   endif |   silent! function KeywordLookup_systemd(keyword) abort | ||||||
|   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*$') |     let matches = matchlist(getline(search('\v^\s*\[\s*.+\s*\]\s*$', 'nbWz')), '\v^\s*\[\s*(\k+).*\]\s*$') | ||||||
|     if len(matches) > 1 |     if len(matches) > 1 | ||||||
|       let section = matches[1] |       let section = matches[1] | ||||||
| @@ -26,7 +20,6 @@ if has('unix') && executable('less') | |||||||
|       return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd' |       return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd' | ||||||
|     endif |     endif | ||||||
|   endfunction |   endfunction | ||||||
|     endif |  | ||||||
|   setlocal iskeyword+=- |   setlocal iskeyword+=- | ||||||
|   setlocal keywordprg=:SystemdKeywordPrg |   setlocal keywordprg=:SystemdKeywordPrg | ||||||
|   if !exists('b:undo_ftplugin') || empty(b:undo_ftplugin) |   if !exists('b:undo_ftplugin') || empty(b:undo_ftplugin) | ||||||
| @@ -35,4 +28,3 @@ if has('unix') && executable('less') | |||||||
|     let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg' |     let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg' | ||||||
|   endif |   endif | ||||||
| endif | endif | ||||||
| endif |  | ||||||
|   | |||||||
| @@ -1,7 +1,8 @@ | |||||||
| " Vim filetype plugin file | " Vim filetype plugin file | ||||||
| " Language:	udev(8) rules file | " Language:	udev(8) rules file | ||||||
|  | " Maintainer:	This runtime file is looking for a new maintainer. | ||||||
| " Previous Maintainer:	Nikolai Weibull <now@bitwi.se> | " Previous Maintainer:	Nikolai Weibull <now@bitwi.se> | ||||||
| " Latest Revision:      2023-10-07 | " Latest Revision:	2024-09-19 (simplify keywordprg #15696) | ||||||
|  |  | ||||||
| if exists("b:did_ftplugin") | if exists("b:did_ftplugin") | ||||||
|   finish |   finish | ||||||
| @@ -15,21 +16,13 @@ let b:undo_ftplugin = "setl com< cms< fo<" | |||||||
|  |  | ||||||
| setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql | setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql | ||||||
|  |  | ||||||
| if has('unix') && executable('less') | if has('unix') && executable('less') && exists(':terminal') == 2 | ||||||
|   if !has('gui_running') |  | ||||||
|     command -buffer -nargs=1 UdevrulesKeywordPrg |  | ||||||
|           \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s{,8}' . <q-args> . '\b'' --hilite-search" man ' . 'udev' | |  | ||||||
|           \ redraw! |  | ||||||
|   elseif has('terminal') |  | ||||||
|   command -buffer -nargs=1 UdevrulesKeywordPrg |   command -buffer -nargs=1 UdevrulesKeywordPrg | ||||||
|         \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'udev' |         \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'udev' | ||||||
|   endif |  | ||||||
|   if exists(':UdevrulesKeywordPrg') == 2 |  | ||||||
|   setlocal iskeyword+=- |   setlocal iskeyword+=- | ||||||
|   setlocal keywordprg=:UdevrulesKeywordPrg |   setlocal keywordprg=:UdevrulesKeywordPrg | ||||||
|   let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer UdevrulesKeywordPrg' |   let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer UdevrulesKeywordPrg' | ||||||
| endif | endif | ||||||
| endif |  | ||||||
|  |  | ||||||
| let &cpo = s:cpo_save | let &cpo = s:cpo_save | ||||||
| unlet s:cpo_save | unlet s:cpo_save | ||||||
|   | |||||||
| @@ -19,9 +19,7 @@ setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql | |||||||
| let b:undo_ftplugin = "setl com< cms< fo< " | let b:undo_ftplugin = "setl com< cms< fo< " | ||||||
|  |  | ||||||
| if executable('zsh') && &shell !~# '/\%(nologin\|false\)$' | if executable('zsh') && &shell !~# '/\%(nologin\|false\)$' | ||||||
|   if !has('gui_running') && executable('less') |   if exists(':terminal') == 2 | ||||||
|     command! -buffer -nargs=1 ZshKeywordPrg silent exe '!MANPAGER= zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null | LESS= less"' | redraw! |  | ||||||
|   elseif has('terminal') |  | ||||||
|     command! -buffer -nargs=1 ZshKeywordPrg silent exe ':term zsh -c "autoload -Uz run-help; run-help <args>"' |     command! -buffer -nargs=1 ZshKeywordPrg silent exe ':term zsh -c "autoload -Uz run-help; run-help <args>"' | ||||||
|   else |   else | ||||||
|     command! -buffer -nargs=1 ZshKeywordPrg echo system('MANPAGER= zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null"') |     command! -buffer -nargs=1 ZshKeywordPrg echo system('MANPAGER= zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null"') | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user