Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tagorder when the argument contains a pattern #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions autoload/ctrlp/tjump.vim
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

if (exists('g:loaded_ctrlp_tjump') && g:loaded_ctrlp_tjump)
\ || v:version < 700 || &cp
finish
Expand Down Expand Up @@ -44,11 +45,19 @@ function! ctrlp#tjump#exec(mode, ...)
en
endif

let s:taglist = taglist('^'.s:word.'$')
if s:word =~ '^/'
" treat word starting with / as a regexp, see :help tag-regexp
let taglistexpr = strpart(s:word, 1)
else
" treat word as literal and construct an exact match regexp
let taglistexpr = '^'.escape(s:word, '^$.*~\').'$'
endif
" unlike :tag and :tselect, taglist always expect a regular expression
let s:taglist = taglist(taglistexpr)
let s:bname = fnamemodify(bufname('%'), ':p')

if len(s:taglist) == 0
echo("No tags found for: ".s:word)
echo('No tags found for: '.s:word.' (expr: '.taglistexpr.')')
elseif len(s:taglist) == 1 && g:ctrlp_tjump_only_silent == 1
call feedkeys(":silent! tag ".s:word."\r", 'nt')
else
Expand Down