Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I started using vim two weeks ago switching from sublime and I am a ruby developer I know for a fact that Ack and Ag work very good on a Mac while they're not optimized for my Ubuntu machine.

These are the steps I usually follow when I want to search for words in my project folder (methods, variables, whatever) using "git grep" to search in all of the files in my project folder that contains those words, but it feels a very slow to me to:

1) Copy the words I want to search, from one file opened in vim
2) Ctrl + Z to send vim in background and use the console
3) git grep 'what I want to search' to actually perform the global search
4) Copy the file path from the list of results
5) fg to resume vim from background
6) :e filepath in vim

What do you use in your environments?
And what is your opinion about this topic?

share|improve this question
1  
Can you be more specific on what you want to do? –  ramonovski May 30 '13 at 21:03
    
I just edited the description. Is it clear? –  Barbared May 30 '13 at 21:18

2 Answers 2

You might want to have a look at fugitive: https://github.com/tpope/vim-fugitive . You could use the :Ggrep string command, what would merge steps 2, 3 and 5 of your example.

See this link for more details on :Ggrep: http://vimcasts.org/episodes/fugitive-vim-exploring-the-history-of-a-git-repository/

share|improve this answer

Here are some alternatives you might want to check:

  1. ack-grep

  2. greplace.vim

  3. grep.vim

I use the built-in :vimgrep command, it just works for me. For external tools I prefer ack though.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.