mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
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>
This commit is contained in:
committed by
Christian Brabandt
parent
d5afc74403
commit
11ab02c819
@@ -1,9 +1,10 @@
|
|||||||
" Vim filetype plugin file
|
" Vim filetype plugin file
|
||||||
" Language: Go
|
" 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
|
" Last Change: 2014 Aug 16
|
||||||
" 2024 Jul 16 by Vim Project (add recommended indent style)
|
" 2024 Jul 16 by Vim Project (add recommended indent style)
|
||||||
" 2025 Mar 07 by Vim Project (add formatprg and keywordprg option #16804)
|
" 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')
|
if exists('b:did_ftplugin')
|
||||||
finish
|
finish
|
||||||
@@ -33,10 +34,8 @@ if !exists('*' .. expand('<SID>') .. 'GoKeywordPrg')
|
|||||||
setl iskeyword+=.
|
setl iskeyword+=.
|
||||||
try
|
try
|
||||||
let cmd = 'go doc -C ' . shellescape(expand('%:h')) . ' ' . shellescape(expand('<cword>'))
|
let cmd = 'go doc -C ' . shellescape(expand('%:h')) . ' ' . shellescape(expand('<cword>'))
|
||||||
if has('nvim')
|
if has('gui_running') || has('nvim')
|
||||||
exe "term" cmd
|
exe 'hor term' cmd
|
||||||
startinsert
|
|
||||||
tmap <buffer> <Esc> <Cmd>call jobstop(&channel) <Bar> bdelete<CR>
|
|
||||||
else
|
else
|
||||||
exe '!' . cmd
|
exe '!' . cmd
|
||||||
endif
|
endif
|
||||||
|
Reference in New Issue
Block a user