More VIM

Vim essentials videocasts at NetTut+. These clued me in to some great VIM plugins along with some really good ideas on how to customize VIM to meet my needs.

The VIM graphical cheat sheet: can be gotten here

A bunch of manuals and tutorials link here. “Mastering the VIM Editor” here.

Vim Refactoring. I found a bunch of refactoring tools, which I will come back to and address at length, later

http://vim.wikia.com/wiki/Vim_as_a_refactoring_tool_and_some_examples_in_C_sharp

http://www.vim.org/scripts/script.php?script_id=3308

http://www.vim.org/scripts/script.php?script_id=2164

http://vim.wikia.com/wiki/Simple_creation_of_scripts

http://www.vim.org/scripts/script.php?script_id=3345

 

This tutorial on using vim efficiently highlighted a few tricks. First a reminder: stay out of insert mode. Then fx Fx and tx for moving to the next instance of a letter.

* Read the string under the cursor and go to the next place it appears. (For instance, if your cursor was somewhere on the word "bob," the cursor would move to the next occurance of "bob" in your file.)

# Same as above, except it moves the cursor to the previousoccurance.

ma :  Make a bookmark named a at the current cursor position. A bookmark can be named any lowercase letter. You can't see the bookmark, but it's there!

`a : Go to bookmark a. Important: that's a backtick, not a single quote. The backtick is located to the left of the 1 on most keyboards.

`. : Go to the line that you last edited. This is very useful! If you need to scroll through the file to look something up, you can go back to where you were without bookmarking it by using the `.command.

Ctrl-N: keyword completion. Handy for long names in the same file.

c : in Visual mode—cut highlighted text to clipboard.

. (a period) will repeat the last command you gave.

For coding:

]p : Just like p, but it automatically adjusts the indent level of the pasted code to match that of the code you paste into. Try it!

% : Putting the cursor on a brace, bracket, or parenthesis and pressing %will send the cursor to the matching brace, bracket, or parenthese. Great for fixing parse problems related to heavily nested blocks of code or logic.

>> : Indent the highlighted code. (See the earlier section about efficient text selection. If no text is selected, the current line is indented.)

<< : Like >>, but un-indents.

gd : Go to the definition (or declaration) of the function or variable under the cursor.

K : Go to the man page for the word currently under the cursor. (For instance, if your cursor is currently over the word sleep, you will see the man page for sleep displayed.)

Comments

Popular Posts