Skip to content

Commit 11ab02c

Browse files
brianhusterzeertzjq
authored andcommitted
runtime(go): use :term for keywordprg for nvim/gvim
Problem: - The document from `go doc` can be very long, and you can scroll if using `!` to run shell command in Gvim. - I realize that I didn't fully mimic behavior of default keywordprg in Nvim in the last commit. Solution: - Use builtin terminal for keywordprg in Gvim - In Nvim (both TUI and GUI), it should mimic the behavior of Vim `:term`, `:Man`, and `:help` closes: #16911 Co-authored-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Phạm Bình An <phambinhanctb2004@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent d5afc74 commit 11ab02c

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

runtime/ftplugin/go.vim

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
" Vim filetype plugin file
22
" Language: Go
3-
" Maintainer: David Barnett (https://github.com/google/vim-ft-go)
3+
" Maintainer: David Barnett (https://github.com/google/vim-ft-go is archived)
44
" Last Change: 2014 Aug 16
55
" 2024 Jul 16 by Vim Project (add recommended indent style)
66
" 2025 Mar 07 by Vim Project (add formatprg and keywordprg option #16804)
7+
" 2025 Mar 18 by Vim Project (use :term for 'keywordprg' #16911)
78

89
if exists('b:did_ftplugin')
910
finish
@@ -33,10 +34,8 @@ if !exists('*' .. expand('<SID>') .. 'GoKeywordPrg')
3334
setl iskeyword+=.
3435
try
3536
let cmd = 'go doc -C ' . shellescape(expand('%:h')) . ' ' . shellescape(expand('<cword>'))
36-
if has('nvim')
37-
exe "term" cmd
38-
startinsert
39-
tmap <buffer> <Esc> <Cmd>call jobstop(&channel) <Bar> bdelete<CR>
37+
if has('gui_running') || has('nvim')
38+
exe 'hor term' cmd
4039
else
4140
exe '!' . cmd
4241
endif

0 commit comments

Comments
 (0)