Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

CtrlPTag still shows menu #451

Closed
naquad opened this Issue · 12 comments

2 participants

@naquad

I'm finding a tag which has 3 entries, I choose one and I still get standard :tselect menu.
Looks to be a bug.

Also is there a way to set currently searched string (trying to replace :tj)?

@kien
Owner

It's not easy to avoid Vim's :tselect menu when using :tjump, since it's the default and the only behavior.

I'm going to need you to provide a test case including the tag names, the filenames corresponding to the tags. Also, the 3 tags files and their relative locations.

What do you mean by "set currently searched string"? Replacing :tjump would be even more complicated than avoiding :tselect.

@naquad

My scenario in short: there's a folder tags file (which is relative to folder) and file-specific tag file (generated by VIM) which has absolute file path.

To reproduce this issue:

wget https://dl.dropboxusercontent.com/u/185589/ctrlp-tag.tar.bz2 && \
  tar jxvf ctrl-tag.tar.bz2 && \
  cd ctrl-tag && sh make-tags.sh

open VIM, then:

set tags=TAGS,tags
CtrlPTag

Choose the one with absolute filename. Kaboom!

By setting currently searched string I mean something smarter than:

:CtrlPTag
call feedkeys("my_tag_here", 't')

The problem with this code is that it is slow. On every character tag is being searched which is redunant, because I have whole tag name.

@kien
Owner

The feedkeys() is only run once when you're done searching and are jumping to the tag. It's needed for respecting fold options. But what does it have anything to do with replacing :tj? And what do you consider smarter?

@naquad

:tj / and feedkeys() questions are separate. :tj problem still remains. feedkeys() runs once, but it behaves like I'm typing whole world. This is the code:

function! s:JumpToTagOrMenu(tag)
  let t = taglist(a:tag)
  if len(t) <= 1
    exec 'tj ' . fnameescape(a:tag)
  else
    CtrlPTag
    call feedkeys(a:tag, 'mt')
  endif
endfunction

As you can see I have whole tag already, but passing it to CtrlP with feedkeys() behaves like I'm typing it character by character. So my second question is: can I somehow pass tag to CtrlPTag? Kind of CtrlPTag ?

@kien
Owner

Oh I see. You can pass whole strings into the prompt with g:ctrlp_default_input.

@naquad

Awesome! g:ctrl_default_input helped, thank you. Now the only problem left is tags.

@kien
Owner

It looks like there's no way to get the correct counts for use in :[count]tag. They desync with the counts on the menu as soon as there are 2 duplicates of the same tag in the active buffer. No way to recalculate and Vim doesn't provide any kind of reference.

This means using the :tselect menu in this case is unavoidable, but it's possible to enter the number for this menu automatically.

@naquad

What about storing number in menu item (that is add(tag, index)) and then use it?

@kien
Owner

It's already doing that. But as I said, those numbers easily become unusable for :[count]tag.

@naquad naquad closed this
@kien
Owner

That still has the desyncing problem, I think.

@naquad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.