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

my effort into replacing ctags jump with fzf.vim's :Tags command #323

Closed
finviman opened this issue Feb 26, 2017 · 5 comments
Closed

my effort into replacing ctags jump with fzf.vim's :Tags command #323

finviman opened this issue Feb 26, 2017 · 5 comments

Comments

@finviman
Copy link

finviman commented Feb 26, 2017

tags jump in vim is not as good as IDE. But fzf makes it better.
In :Tags and :BTags, we search accuracy word under cursor most time. so i config this:

nnoremap <leader>d :call fzf#vim#tags("'" . expand('<cword>'))<CR>

and if there is only one match, most time it is, jumping to that tag position directly is better than showing a fzf window and press enter to jump. Thanks to your wonderful fzf configuration, I change 2 lines in fzf.vim ,simplely add --select-1 --exit-0 option.
screen shot 2017-02-26 at 9 57 40 am
screen shot 2017-02-26 at 9 57 55 am
now it works very well.
BTW, why there is '--reverse' option on btags but tags has not?

@junegunn
Copy link
Owner

Thanks for sharing.

You don't have to change the source code of fzf.vim since you can pass arbitrary options to the autoload function like follows.

nnoremap <leader>d :call fzf#vim#tags(expand('<cword>'), {'options': '--exact --select-1 --exit-0'})<CR>

BTW, why there is '--reverse' option on btags but tags has not?

To show the tags in the file in the order they appear in the file, top to bottom. The same goes forBLines and Lines. You can pass --no-reverse to unset the option.

@PezCoder
Copy link

PezCoder commented Mar 18, 2018

This is exactly what i wanted & works great, except for the fact that after navigating it's not pushed in the stack i.e I'm not able to come back using <C-t>
I understand <C-o> is an alternative but that's only useful if we're not navigating in the landing position, it just fills up otherwise while <C-t> remains the same in this case.

Is it possible to push it in that stack somehow when navigating through fzf ?

@PezCoder
Copy link

Actually find an issue open regarding the same.
#240

@hasufell
Copy link

I tried this too. Not really usable:

  1. When jumping to a tag, I don't really get to the actual tag, it's very buggy. It seems I just get to the file, not the line (or just stay at the current cursor position if the tag is in the same file).
  2. the search is not exact, even with --exact and I get pretty unrelated finds

@asgeirrr
Copy link

You can get more precise results with

nnoremap <leader>d :call fzf#vim#tags('^' . expand('<cword>'), {'options': '--exact --select-1 --exit-0 +i'})<CR>

This matches tags starting with the word under cursor but I haven't found a simple way to match the end of the tag since the line in fzf contains path the the tag as well.

@hasufell consider Vim's built-in g<C-]> that does exactly what you want, it's just not as pretty as fzf.

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

5 participants