aboutsummaryrefslogtreecommitdiff
path: root/runtime/ftplugin/sh.vim
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-29 22:39:54 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-29 22:39:54 +0000
commit21cb7d04c387e4198ca8098a884c78b56ffcf4c2 (patch)
tree84fe5690df1551f0bb2bdfe1a13aacd29ebc1de7 /runtime/ftplugin/sh.vim
parentd9c904f85a23a496df4eb6be42aa43f007b22d50 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-colorcolchar.tar.gz
rneovim-colorcolchar.tar.bz2
rneovim-colorcolchar.zip
Merge remote-tracking branch 'upstream/master' into colorcolcharcolorcolchar
Diffstat (limited to 'runtime/ftplugin/sh.vim')
-rw-r--r--runtime/ftplugin/sh.vim28
1 files changed, 19 insertions, 9 deletions
diff --git a/runtime/ftplugin/sh.vim b/runtime/ftplugin/sh.vim
index b6fdb8f3e2..c1a6bc5ade 100644
--- a/runtime/ftplugin/sh.vim
+++ b/runtime/ftplugin/sh.vim
@@ -2,15 +2,15 @@
" Language: sh
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Dan Sharp
-" Last Change: 2022 Sep 07
+" Contributor: Enno Nagel <ennonagel+vim@gmail.com>
+" Eisuke Kawashima
+" Last Change: 2023 Sep 28
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
-" Make sure the continuation lines below do not cause problems in
-" compatibility mode.
let s:save_cpo = &cpo
set cpo-=C
@@ -32,16 +32,26 @@ if exists("loaded_matchit") && !exists("b:match_words")
let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words"
endif
-" Change the :browse e filter to primarily show shell-related files.
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "Bourne Shell Scripts (*.sh)\t*.sh\n" ..
- \ "Korn Shell Scripts (*.ksh)\t*.ksh\n" ..
- \ "Bash Shell Scripts (*.bash)\t*.bash\n" ..
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "Bourne Shell Scripts (*.sh)\t*.sh\n" ..
+ \ "Korn Shell Scripts (*.ksh)\t*.ksh\n" ..
+ \ "Bash Shell Scripts (*.bash)\t*.bash\n" ..
+ \ "All Files (*.*)\t*.*\n"
let b:undo_ftplugin ..= " | unlet! b:browsefilter"
endif
-" Restore the saved compatibility options.
+if get(b:, "is_bash", 0)
+ if !has("gui_running") && executable("less")
+ command! -buffer -nargs=1 ShKeywordPrg silent exe '!bash -c "{ help "<args>" 2>/dev/null || 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>""'
+ else
+ command! -buffer -nargs=1 ShKeywordPrg echo system('bash -c "help <args>" 2>/dev/null || man "<args>"')
+ endif
+ setlocal keywordprg=:ShKeywordPrg
+ let b:undo_ftplugin ..= " | setl kp< | sil! delc -buffer ShKeywordPrg"
+endif
+
let &cpo = s:save_cpo
unlet s:save_cpo