runetime(vim): gf maybe hang and fail
* searching'**' maybe terrible slow * searching '**/plugin/' maybe fail * the pattern for the :packadd/:import/:colorscheme did not consistently check for a colon, so always use '\%(:\s*\)\=' before the actual ex command While at it rename the generic name vim.vim to vimgoto.vim as this more clearly states what this script is for. Signed-off-by: Shane-XB-Qian <shane.qian@foxmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
487dd1716a
commit
639d93fc0e
@ -9,6 +9,7 @@
|
||||
" Last Change: 2025 Aug 07
|
||||
" 2025 Aug 06 by Vim Project (add gf maps #17881)
|
||||
" 2025 Aug 08 by Vim Project (add Vim script complete function #17871)
|
||||
" 2025 Aug 12 by Vim Project (improve vimgoto script #17970))
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
@ -152,7 +153,7 @@ if !exists("no_plugin_maps") && !exists("no_vim_maps")
|
||||
nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR>
|
||||
xnoremap <silent><buffer> [" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR>
|
||||
|
||||
" Purpose: Handle `:import` and `:packadd` lines in a smarter way. {{{
|
||||
" Purpose: Handle :import, :colorscheme and :packadd lines in a smarter way. {{{
|
||||
"
|
||||
" `:import` is followed by a filename or filepath. Find it.
|
||||
"
|
||||
@ -171,9 +172,10 @@ if !exists("no_plugin_maps") && !exists("no_vim_maps")
|
||||
" buffer.
|
||||
" }}}
|
||||
" We use the `F` variants, instead of the `f` ones, because they're smarter.
|
||||
nnoremap <silent><buffer> gf :<C-U>call vim#Find('gF')<CR>
|
||||
nnoremap <silent><buffer> <C-W>f :<C-U>call vim#Find("\<lt>C-W>F")<CR>
|
||||
nnoremap <silent><buffer> <C-W>gf :<C-U>call vim#Find("\<lt>C-W>gF")<CR>
|
||||
" See $VIMRUNTIME/autoload/vimgoto.vim
|
||||
nnoremap <silent><buffer> gf :<C-U>call vimgoto#Find('gF')<CR>
|
||||
nnoremap <silent><buffer> <C-W>f :<C-U>call vimgoto#Find("\<lt>C-W>F")<CR>
|
||||
nnoremap <silent><buffer> <C-W>gf :<C-U>call vimgoto#Find("\<lt>C-W>gF")<CR>
|
||||
endif
|
||||
|
||||
" Let the matchit plugin know what items can be matched.
|
||||
|
Reference in New Issue
Block a user