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

CtrlPTag still shows menu #451

Closed
naquad opened this issue Jul 27, 2013 · 12 comments
Closed

CtrlPTag still shows menu #451

naquad opened this issue Jul 27, 2013 · 12 comments

Comments

@naquad
Copy link

naquad commented Jul 27, 2013

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
Copy link
Owner

kien commented Jul 27, 2013

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
Copy link
Author

naquad commented Jul 27, 2013

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
Copy link
Owner

kien commented Jul 27, 2013

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
Copy link
Author

naquad commented Jul 27, 2013

: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
Copy link
Owner

kien commented Jul 27, 2013

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

@naquad
Copy link
Author

naquad commented Jul 27, 2013

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

@kien
Copy link
Owner

kien commented Jul 29, 2013

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
Copy link
Author

naquad commented Jul 29, 2013

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

@kien
Copy link
Owner

kien commented Jul 29, 2013

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

@naquad
Copy link
Author

naquad commented Jul 29, 2013

nevermind.
https://github.com/ivalkeen/vim-ctrlp-tjump - fixed the issue

@naquad naquad closed this as completed Jul 29, 2013
@kien
Copy link
Owner

kien commented Jul 29, 2013

That still has the desyncing problem, I think.

@naquad
Copy link
Author

naquad commented Jul 29, 2013

bug didn't reproduce in my environment.

2013/7/29 kien notifications@github.com

That still has the desyncing problem, I think.


Reply to this email directly or view it on GitHubhttps://github.com//issues/451#issuecomment-21748471
.

Regards, Danil Fartushnii.

Danil Fartushnii
Senior developer
Skype: dfartushnii
Jabber: naquad@jabber.ru
ICQ: 226555656

kien added a commit that referenced this issue Aug 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants