TextMate Go to function in VIM?

I recently tried using vim instead of TextMate, and one of the functions that I missed the most in VIM is the TextMate function to go to the method (CMD + Shift + T for those who don’t know), Looking around, I didn’t see any particular way to emulate this functionality and wondered if anyone here had experience working with similar functions in VIM.

Thanks in advance for any answers.

Patrick

+4
source share
8 answers

You are looking for the functionality of vim tags ... I answered a similar question about tags here: How to implement my own tag in VIM using CTRL -]?

+4
source

This functionality is implemented in fuzzyfinder using: FufBufferTag. See ticket

+2
source

I would love to hear some good suggestions, as I use Vim all the time, but have not used TextMate. I do the following things that overlap a bit.

  • Find def-space- and the first letters of the function name>. Therefore, to go to the foo function (in Python or Ruby and in the same file, of course), I type /def fo , and I'm there. I also have incremental search in Vim.

  • Use signs for features that I frequent. Therefore, I will be ma in the definition of the function, and then we'll return to it later. I know that this is not a function of definition, but it is a crutch.

0
source

you can create a tag file using ctags http://ctags.sourceforge.net/ basically $ ctags -R Then when you are in vim: set tags = / path / to / tagsfile

it will also be any tag, not just class names, methods, etc. In normal mode, ctrl-] on the method / class / and it will go to that position.

You can also use the taglist plugin, which will display the current tags in the side window. ctags

0
source

I had almost the same problem and found a quick and dirty solution (paste this into your .vimrc and call by typing: LS)

 function! s:ListFunctions() vimgrep /function/j % copen endfunction command! -bar -narg=0 LS call s:ListFunctions() 

If you need more functionality, Exuberant Ctags will be better for you.

0
source

I use CommandT to search for files, then / to search for a specific function. However, the real problem is with CSS. Cmd Shift T in Textmate allows you to quickly jump to a specific CSS class, which is a huge time saver.

CTags does not support CSS parsing unless you recompile the patch (found through google), but I'm not even sure if we can do a fuzzy search for CSS classes, as in Textmate. I really miss the Cmd Shift T function.

0
source

I wrote the TextMate Bundle command (you can easily assign it Ctrl +] , for example), which looks for a class or method definition in the carriage and displays it in a tooltip, along with the file name and the line in which it was found.

Check this out: Add a shortcut to TextMate to search for a class or method definition in the tooltip
Hope you find this helpful!

0
source

The function described in this question has many different names depending on the IDE / Editor:

  • In Resharper, it's called the "Goto File member"
  • In Sublime Text 2 it's called the "Goto Symbol"
  • In PyCharm, it's called the "Goto Symbol"

The function is essentially the same, although in all the above implementations (and I assume that it is very similar to TextMate). The function displays an interactive list of methods / functions (and potentially also includes member variables / properties).

The list allows interactive filtering by entering the name of the methods / functions / etc. The list also usually allows you to use the arrow keys to select a method / function / etc. Pressing the enter key with the selected method / function / etc moves to the line in the current file where the selected method / function / etc is defined.

Of all the existing answers in this question, the only one I see that seems to provide a fairly similar implementation of this function is to use the command:

 :FufBufferTag 

vim plugin FuzzyFinder .

The answer that involves using the taglist plugin is not a good solution, because the functionality offered by the taglist plugin is very different from this function. The taglist plugin offers similar functionality - the ability to view the outline of methods in the current file, but it does not offer an interactive way to filter this list in real time. The taglist plugin allows you to search for a tag buffer, but it is not as convenient as the "Goto symbol" function offered in other editors.

I would like to offer an alternative suggestion here, which is to use the command:

 :CtrlPBufTag 

in the excellent Ctrlp vim plugin. In my opinion, this is by far the best implementation of the "Goto Symbol" feature currently available in vim.

0
source

All Articles