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
parent
23079450a8
commit
f86568f918
@ -4,6 +4,7 @@
|
||||
" Last Change: 2021 Apr 02
|
||||
" 2024 Jan 14 by Vim Project (browsefilter)
|
||||
" 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
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
@ -35,6 +36,10 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
|
||||
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:
|
||||
" check for PowerShell Core in Windows, Linux or MacOS
|
||||
if executable('pwsh') | let s:pwsh_cmd = 'pwsh'
|
||||
@ -45,21 +50,14 @@ elseif executable('powershell.exe') | let s:pwsh_cmd = 'powershell.exe'
|
||||
endif
|
||||
|
||||
if exists('s:pwsh_cmd')
|
||||
if !has('gui_running') && executable('less') &&
|
||||
\ !(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')
|
||||
if exists(':terminal') == 2
|
||||
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
|
||||
command! -buffer -nargs=1 GetHelp echo system(s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full <args>')
|
||||
endif
|
||||
setlocal keywordprg=:GetHelp
|
||||
let b:undo_ftplugin ..= " | setl kp< | sil! delc -buffer GetHelp"
|
||||
endif
|
||||
setlocal keywordprg=:GetHelp
|
||||
|
||||
" Undo the stuff we changed
|
||||
let b:undo_ftplugin = "setlocal tw< cms< fo< iskeyword< keywordprg<" .
|
||||
\ " | unlet! b:browsefilter"
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
Reference in New Issue
Block a user