]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(vimgoto): recognize 'silent' prefixes
authorJon Parise <jon@indelible.org>
Sun, 21 Sep 2025 17:51:00 +0000 (17:51 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 21 Sep 2025 17:51:00 +0000 (17:51 +0000)
It's common to optionally prefix commands like 'packadd!' with
'silent!', but that wasn't recognized by these patterns.

This change adds 'silent' support to the 'packadd', 'runtime', and
'colorscheme' command patterns.

closes: #18361

Signed-off-by: Jon Parise <jon@indelible.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/autoload/vimgoto.vim

index 121af4ef32bee79a6f2e76f58845eecc4a69a22f..421732ce89f8b6e56f337f4d440602e230c5422f 100644 (file)
@@ -4,7 +4,7 @@ vim9script
 # Contributers: @lacygoill
 #               Shane-XB-Qian
 #               Andrew Radev
-# Last Change:  2025 Sep 02
+# Last Change:  2025 Sep 21
 #
 # Vim Script to handle jumping to the targets of several types of Vim commands
 # (:import, :packadd, :runtime, :colorscheme), and to autoloaded functions of
@@ -16,17 +16,17 @@ vim9script
 export def Find(editcmd: string) #{{{2
     var curline: string = getline('.')
 
-    if curline =~ '^\s*\%(:\s*\)\=packadd!\=\s'
+    if curline =~ '^\s*\%(:\s*\)\=\%(sil\%[ent]!\=\s\+\)\=packadd!\=\s'
         HandlePackaddLine(editcmd, curline)
         return
     endif
 
-    if curline =~ '^\s*\%(:\s*\)\=ru\%[ntime]!\='
+    if curline =~ '^\s*\%(:\s*\)\=\%(sil\%[ent]!\=\s\+\)\=ru\%[ntime]!\='
         HandleRuntimeLine(editcmd, curline, expand('<cfile>'))
         return
     endif
 
-    if curline =~ '^\s*\%(:\s*\)\=colo\%[rscheme]\s'
+    if curline =~ '^\s*\%(:\s*\)\=\%(sil\%[ent]!\=\s\+\)\=colo\%[rscheme]\s'
         HandleColoLine(editcmd, curline)
         return
     endif