Skip to content

Instantly share code, notes, and snippets.

@meowoodie
Last active October 18, 2015 09:19
Show Gist options
  • Save meowoodie/a169fbabb1b2fabe5790 to your computer and use it in GitHub Desktop.
Save meowoodie/a169fbabb1b2fabe5790 to your computer and use it in GitHub Desktop.

My most often vim tips&tricks

Here are some of my favorite tips and tricks about vim. They are useful to me and time-saving. I wrote down here to make notes.

Basic Operation

About Tags

First of all, we need generate our own tags for the related project at root directory.

ctags -R

And then I can use the following basic commands for:

  • ctrl + ] :jump to the tag underneath the cursor.
  • ctrl + t :jump back up in the tag stack.
  • :tn :go to next definition for the last tag.
  • :tp :go to previous definition for the last tag.
  • ctrl + n :auto complete when you code.

Sometimes I used "--exclude" parameter to exclude useless files when generate tags. It would boost process when some files are too large to generate related tags.

About Moving cursor

To be frank, I don't like using "h", "j", "k", "l" to move cursor, but prefer arrows. Because I always forget their correlation. The following are some my favorite.

  • shift + } :move cursor to next blank line.
  • shift + { :move cursor to previous blank line.
  • :set nu :highlight the line number and you can run ":num" to the line.
  • gg :to first line.
  • GG :to last line.
  • $ :to the end of a line.
  • ^ :to the head of a line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment