]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(c): set 'keywordprg' to :CKeywordPrg in a GUI
authorMateo Gjika <104777599+mateoxh@users.noreply.github.com>
Mon, 26 Jan 2026 18:45:18 +0000 (18:45 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 26 Jan 2026 18:46:41 +0000 (18:46 +0000)
closes: #19222

Signed-off-by: Mateo Gjika <104777599+mateoxh@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/ftplugin/c.vim

index 42a435f1df0e25d4e0e8ed9eaf31128ec571c701..2793c5d46ad9739b1ddf94d77e52aae08d82cc6f 100644 (file)
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language:    C
 " Maintainer:  The Vim Project <https://github.com/vim/vim>
-" Last Change: 2025 Aug 08
+" Last Change: 2026 Jan 26
 " Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 " Only do this when not done yet for this buffer
@@ -40,6 +40,23 @@ if has("vms")
   setlocal iskeyword+=$
 endif
 
+" Use terminal window for gui
+if has('gui_running') && exists(':terminal') == 2
+  setlocal keywordprg=:CKeywordPrg
+
+  command! -buffer -nargs=1 -count CKeywordPrg call s:CKeywordPrg(<q-args>, <count>)
+
+  function! s:CKeywordPrg(arg, count) abort
+    if a:count > 0
+      exe printf('term ++close man -s %d %s', a:count, a:arg)
+    else
+      exe printf('term ++close man %s', a:arg)
+    endif
+  endfunction
+
+  let b:undo_ftplugin .= ' | setl kp< | sil! delc -buffer CKeywordPrg'
+endif
+
 " When the matchit plugin is loaded, this makes the % command skip parens and
 " braces in comments properly.
 if !exists("b:match_words")