aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2025-03-19 10:04:20 +0100
committerChristian Clason <ch.clason+github@icloud.com>2025-03-19 10:24:51 +0100
commit17d0420e65b8149af0546bd31e6051b6ce655a2f (patch)
treee208ad6da600785b47644a6ec27db7c129c8545b
parentac2fcb5f766ffa450bc695f7e51a3d2519565a0f (diff)
downloadrneovim-17d0420e65b8149af0546bd31e6051b6ce655a2f.tar.gz
rneovim-17d0420e65b8149af0546bd31e6051b6ce655a2f.tar.bz2
rneovim-17d0420e65b8149af0546bd31e6051b6ce655a2f.zip
vim-patch:11ab02c: 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: vim/vim#16911 https://github.com/vim/vim/commit/11ab02c819449eaeddc3d8d291f06bc73f428e91 Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
-rw-r--r--runtime/ftplugin/go.vim9
1 files changed, 4 insertions, 5 deletions
diff --git a/runtime/ftplugin/go.vim b/runtime/ftplugin/go.vim
index b83db424bd..57fc73cd13 100644
--- a/runtime/ftplugin/go.vim
+++ b/runtime/ftplugin/go.vim
@@ -1,9 +1,10 @@
" Vim filetype plugin file
" Language: Go
-" Maintainer: David Barnett (https://github.com/google/vim-ft-go)
+" Maintainer: David Barnett (https://github.com/google/vim-ft-go is archived)
" Last Change: 2014 Aug 16
" 2024 Jul 16 by Vim Project (add recommended indent style)
" 2025 Mar 07 by Vim Project (add formatprg and keywordprg option #16804)
+" 2025 Mar 18 by Vim Project (use :term for 'keywordprg' #16911)
if exists('b:did_ftplugin')
finish
@@ -33,10 +34,8 @@ if !exists('*' .. expand('<SID>') .. 'GoKeywordPrg')
setl iskeyword+=.
try
let cmd = 'go doc -C ' . shellescape(expand('%:h')) . ' ' . shellescape(expand('<cword>'))
- if has('nvim')
- exe "term" cmd
- startinsert
- tmap <buffer> <Esc> <Cmd>call jobstop(&channel) <Bar> bdelete<CR>
+ if has('gui_running') || has('nvim')
+ exe 'hor term' cmd
else
exe '!' . cmd
endif