Skip to content

Commit 714671d

Browse files
phanenchrisbra
authored andcommitted
runtime(misc): use :hor :term to ensure new term window is split horizontally
Problem: :term splits new window above in vim, but in nvim it change the buffer for current window Solution: :hor term to ensure consistent splitting for Vim and Neovim closes: #17822 Signed-off-by: phanium <91544758+phanen@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 15dd6b4 commit 714671d

10 files changed

Lines changed: 23 additions & 16 deletions

File tree

runtime/ftplugin/gpg.vim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
" Vim filetype plugin file
22
" Language: gpg(1) configuration file
3+
" Maintainer: This runtime file is looking for a new maintainer.
34
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
4-
" Latest Revision: 2024-09-19 (simplify keywordprg #15696)
5+
" Latest Revision: 2025-07-22 (use :hor term #17822)
56

67
if exists("b:did_ftplugin")
78
finish
@@ -17,7 +18,7 @@ setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
1718

1819
if has('unix') && executable('less') && exists(':terminal') == 2
1920
command -buffer -nargs=1 GpgKeywordPrg
20-
\ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+--' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'gpg'
21+
\ silent exe ':hor term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+--' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'gpg'
2122
setlocal iskeyword+=-
2223
setlocal keywordprg=:GpgKeywordPrg
2324
let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer GpgKeywordPrg'

runtime/ftplugin/modconf.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language: modules.conf(5) configuration file
33
" Maintainer: This runtime file is looking for a new maintainer.
44
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
5-
" Latest Revision: 2024-09-20 (remove erroneous endif)
5+
" Latest Revision: 2025-07-22 (use :hor term #17822)
66

77
if exists("b:did_ftplugin")
88
finish
@@ -19,7 +19,7 @@ setlocal formatoptions-=t formatoptions+=croql
1919

2020
if has('unix') && executable('less') && exists(':terminal') == 2
2121
command -buffer -nargs=1 ModconfKeywordPrg
22-
\ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'modprobe.d'
22+
\ silent exe ':hor term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'modprobe.d'
2323
setlocal iskeyword+=-
2424
setlocal keywordprg=:ModconfKeywordPrg
2525
let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer ModconfKeywordPrg'

runtime/ftplugin/muttrc.vim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
" Vim filetype plugin file
22
" Language: mutt RC File
3+
" Maintainer: This runtime file is looking for a new maintainer.
34
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
4-
" Latest Revision: 2024-09-19 (simplify keywordprg #15696)
5+
" Latest Revision: 2025-07-22 (use :hor term #17822)
56

67
if exists("b:did_ftplugin")
78
finish
@@ -20,7 +21,7 @@ let &l:include = '^\s*source\>'
2021

2122
if has('unix') && executable('less') && exists(':terminal') == 2
2223
command -buffer -nargs=1 MuttrcKeywordPrg
23-
\ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'muttrc'
24+
\ silent exe 'hor term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'muttrc'
2425
setlocal iskeyword+=-
2526
setlocal keywordprg=:MuttrcKeywordPrg
2627
let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer MuttrcKeywordPrg'

runtime/ftplugin/ps1.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
" 2024 Jan 14 by Vim Project (browsefilter)
66
" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
77
" 2024 Sep 19 by Konfekt (simplify keywordprg #15696)
8+
" 2025 Jul 22 by phanium (use :hor term #17822)
89

910
" Only do this when not done yet for this buffer
1011
if exists("b:did_ftplugin") | finish | endif
@@ -51,7 +52,7 @@ endif
5152

5253
if exists('s:pwsh_cmd')
5354
if exists(':terminal') == 2
54-
command! -buffer -nargs=1 GetHelp silent exe 'term ' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>"' . (executable('less') ? ' | less' : '')
55+
command! -buffer -nargs=1 GetHelp silent exe 'hor term ' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>"' . (executable('less') ? ' | less' : '')
5556
else
5657
command! -buffer -nargs=1 GetHelp echo system(s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full <args>')
5758
endif

runtime/ftplugin/readline.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
" Maintainer: Doug Kearns <dougkearns@gmail.com>
44
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
55
" Last Change: 2024 Sep 19 (simplify keywordprg #15696)
6+
" 2024 Jul 22 by Vim project (use :hor term #17822)
67

78
if exists("b:did_ftplugin")
89
finish
@@ -36,7 +37,7 @@ endif
3637

3738
if has('unix') && executable('less') && exists(':terminal') == 2
3839
command -buffer -nargs=1 ReadlineKeywordPrg
39-
\ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . '3 readline'
40+
\ silent exe 'hor term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . '3 readline'
4041
setlocal iskeyword+=-
4142
setlocal keywordprg=:ReadlineKeywordPrg
4243
let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer ReadlineKeywordPrg'

runtime/ftplugin/sh.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
" Last Change: 2024 Sep 19 by Vim Project (compiler shellcheck)
88
" 2024 Dec 29 by Vim Project (improve setting shellcheck compiler)
99
" 2025 Mar 09 by Vim Project (set b:match_skip)
10+
" 2025 Jul 22 by phanium (use :hor term #17822)
1011

1112
if exists("b:did_ftplugin")
1213
finish
@@ -53,7 +54,7 @@ let s:is_kornshell = get(b:, "is_kornshell", get(g:, "is_kornshell", 0))
5354

5455
if s:is_bash
5556
if exists(':terminal') == 2
56-
command! -buffer -nargs=1 ShKeywordPrg silent exe ':term bash -c "help "<args>" 2>/dev/null || man "<args>""'
57+
command! -buffer -nargs=1 ShKeywordPrg silent exe ':hor term bash -c "help "<args>" 2>/dev/null || man "<args>""'
5758
else
5859
command! -buffer -nargs=1 ShKeywordPrg echo system('bash -c "help <args>" 2>/dev/null || MANPAGER= man "<args>"')
5960
endif

runtime/ftplugin/sshconfig.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language: OpenSSH client configuration file
33
" Maintainer: This runtime file is looking for a new maintainer.
44
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
5-
" Latest Revision: 2024-09-19 (simplify keywordprg #15696)
5+
" Latest Revision: 2025-07-22 (use :hor term #17822)
66

77
if exists("b:did_ftplugin")
88
finish
@@ -17,7 +17,7 @@ let b:undo_ftplugin = 'setlocal com< cms< fo<'
1717

1818
if has('unix') && executable('less') && exists(':terminal') == 2
1919
command -buffer -nargs=1 SshconfigKeywordPrg
20-
\ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '$', '\') . ''' --hilite-search" man ' . 'ssh_config'
20+
\ silent exe 'hor term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '$', '\') . ''' --hilite-search" man ' . 'ssh_config'
2121
setlocal iskeyword+=-
2222
setlocal keywordprg=:SshconfigKeywordPrg
2323
let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SshconfigKeywordPrg'

runtime/ftplugin/sudoers.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language: sudoers(5) configuration files
33
" Maintainer: This runtime file is looking for a new maintainer.
44
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
5-
" Latest Revision: 2024-09-19 (simplify keywordprg #15696)
5+
" Latest Revision: 2025-07-22 (use :hor term #17822)
66

77
if exists("b:did_ftplugin")
88
finish
@@ -18,7 +18,7 @@ setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
1818

1919
if has('unix') && executable('less') && exists(':terminal') == 2
2020
command -buffer -nargs=1 SudoersKeywordPrg
21-
\ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('\b' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'sudoers'
21+
\ silent exe ':hor term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('\b' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'sudoers'
2222
setlocal iskeyword+=-
2323
setlocal keywordprg=:SudoersKeywordPrg
2424
let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SudoersKeywordPrg'

runtime/ftplugin/udevrules.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
" Language: udev(8) rules file
33
" Maintainer: This runtime file is looking for a new maintainer.
44
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
5-
" Latest Revision: 2024-09-19 (simplify keywordprg #15696)
5+
" Latest Revision: 2025-07-22 (use :hor term #17822)
66

77
if exists("b:did_ftplugin")
88
finish
@@ -18,7 +18,7 @@ setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql
1818

1919
if has('unix') && executable('less') && exists(':terminal') == 2
2020
command -buffer -nargs=1 UdevrulesKeywordPrg
21-
\ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'udev'
21+
\ silent exe ':hor term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'udev'
2222
setlocal iskeyword+=-
2323
setlocal keywordprg=:UdevrulesKeywordPrg
2424
let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer UdevrulesKeywordPrg'

runtime/ftplugin/zsh.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
" Latest Revision: 2024 Sep 19
66
" License: Vim (see :h license)
77
" Repository: https://github.com/chrisbra/vim-zsh
8+
" Last Change:
9+
" 2025 Jul 23 by Vim Project (use :hor term #17822)
810

911
if exists("b:did_ftplugin")
1012
finish
@@ -20,7 +22,7 @@ let b:undo_ftplugin = "setl com< cms< fo< "
2022

2123
if executable('zsh') && &shell !~# '/\%(nologin\|false\)$'
2224
if exists(':terminal') == 2
23-
command! -buffer -nargs=1 ZshKeywordPrg silent exe ':term zsh -c "autoload -Uz run-help; run-help <args>"'
25+
command! -buffer -nargs=1 ZshKeywordPrg silent exe ':hor term zsh -c "autoload -Uz run-help; run-help <args>"'
2426
else
2527
command! -buffer -nargs=1 ZshKeywordPrg echo system('MANPAGER= zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null"')
2628
endif

0 commit comments

Comments
 (0)