When using grep from VIM, how to jump to results?

537

When you press ENTER, you should be looking at line 3 of file1.txt. To jump to the next match, execute :cn; to jump to the previous match, execute :cp. Executing :copen will open a window containing the list of matches. Move the cursor to the desired match and press ENTER to jump to that match.

For more on using :grep, see

:help grep
:help quickfix.txt

Typing :cn and :cp to move forward and backward in the quickfix list can be awkward, so I use these mappings:

nmap <silent> <C-N> :cn<CR>zv
nmap <silent> <C-P> :cp<CR>zv

Also, the :grep command is not a plugin; it's part of Vim.

Share:
537

Related videos on Youtube

sean3838
Author by

sean3838

Updated on September 17, 2022

Comments

  • sean3838
    sean3838 over 1 year

    In my bootstrap.groovy I'm adding:

    TimeZone.setDefault(TimeZone.getTimeZone('America/Detroit'))
    

    This works just fine when running my app locally; it changes the timezone correctly.

    But when I deploy my app to my VPS, which is running CentOS Linux 6.5, the time is offset by three hours. Note: It is increased by three hours.

    Also, I am running my app on Tomcat 7. I've tried adding:

    export JAVA_OPTS="-Duser.timezone=America/Detroit"
    

    to my setenv.sh file but this does not seem to work.

    My server's system time and hardware time is correctly set and working. So I have NO idea why Tomcat is adding three hours to my dates!

    Any help or guidance is appreciated!

  • Marplesoft
    Marplesoft about 13 years
    Great answer, thanks! BTW, can you do a recursive search through folders with vim grep?
  • garyjohn
    garyjohn about 13 years
    As long as you are running on a Unix system, you can add whatever arguments to Vim's :grep that you would add to a grep command executed from the shell. So, you could do a recursive search through all .txt files in and below the current directory with :grep -R --include=*.txt Ryan .. You can also perform a recursive search using Vim's :vimgrep command, but the arguments are different and I seldom use because it is slower than :grep.
  • sean3838
    sean3838 almost 10 years
    Thanks. I'm going to use UTC format throughout my app. I posted a new problem though that arises from this here: stackoverflow.com/questions/24898020/…