]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(go): fix `b:undo_ftplugin`
authorichizok <gclient.gaap@gmail.com>
Sat, 5 Jul 2025 13:18:41 +0000 (15:18 +0200)
committerChristian Brabandt <cb@256bit.org>
Sat, 5 Jul 2025 13:18:41 +0000 (15:18 +0200)
last `unmap` can cause the error "E31: No such mapping" when
`doaudocmd FileType go` if appending other commands to `b:undo_ftplugin` i.e.
the space and the next bar as `let b:undo_ftplugin .= ' | setl ...'`.

closes: #17664

Signed-off-by: ichizok <gclient.gaap@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/ftplugin/go.vim

index e3f947c091c3fc0708722d617e659718efb02678..13291af9cb2a6153e35c2eef97e1edb8dc5f2e2a 100644 (file)
@@ -7,6 +7,7 @@
 " 2025 Mar 18 by Vim Project (use :term for 'keywordprg' #16911)
 " 2025 Apr 16 by Vim Project (set 'cpoptions' for line continuation, #17121)
 " 2025 Jul 02 by Vim Project (add section movement mappings #17641)
+" 2025 Jul 05 by Vim Project (update b:undo_ftplugin #17664)
 
 if exists('b:did_ftplugin')
   finish
@@ -56,10 +57,10 @@ if !exists("no_plugin_maps") && !exists("no_go_maps")
   noremap <silent> <buffer> [[ <Cmd>call <SID>GoFindSection('prev_start', v:count1)<CR>
   noremap <silent> <buffer> [] <Cmd>call <SID>GoFindSection('prev_end', v:count1)<CR>
   let b:undo_ftplugin .= ''
-                      \ . '| unmap <buffer> ]]'
-                      \ . '| unmap <buffer> ]['
-                      \ . '| unmap <buffer> [['
-                      \ . '| unmap <buffer> []'
+                      \ . "| silent! exe 'unmap <buffer> ]]'"
+                      \ . "| silent! exe 'unmap <buffer> ]['"
+                      \ . "| silent! exe 'unmap <buffer> [['"
+                      \ . "| silent! exe 'unmap <buffer> []'"
 endif
 
 function! <SID>GoFindSection(dir, count)