tags:

views:

140

answers:

4

I have to add a VIM personality to an IDE. I never used VIM for more than the most basic edits and i'm now overwhelmed by the complexity of the command structure.

Is there any overall structure for the combination of counts moves and insert/delete commands? I just can't see the wood for the trees.

+8  A: 

This is a good article for explaining the VIM philosophy.

Dan Dyer
What a great piece!
APC
ViEmu is awesome too :)
Pierre-Antoine LaFayette
+14  A: 
Carl Smotricz
+1 Nicely explained!
richsage
A: 

There are plenty of nice and interesting tutorials. One example is

http://blog.interlinked.org/tutorials/vim_tutorial.html

But the broad structure that most of them would give you is

  1. There are two main modes for editing - Command mode and insert mode. You can move from insert mode to command mode using the key.
  2. You can execute commands in the command mode by typing a single key or a sequence of keys.
  3. Commands can help you achieve a wide variety of things deletion of lines - dd yanking (copying of lines ) - yy pasting lines below the current line - p pasting lines above the current line - P ( and so on)

    Most commands in the command mode can be pre-fixed by a "count" to indicate the number of times the command has to be executed. For example, 3dd would delete three lines.

    One set of commands in the command mode lets you move to the insert mode. That is explained below.

  4. There are different ways of entering the insert mode from the command mode. Prominent among them are (i-insert at cursor, I-insert at beginning of line, o-insert a line below, O-insert a line above, a-append, A-append at end of line.

The quick reference at

http://www.andy-roberts.net/misc/vim/vim.pdf

Will help you understand the relevance of "count"

NP Compete
+1  A: 

I think the characteristic that better defines VIM in respect to other editors is its wide array of motion commands. The first thing to learn to fully use VIM is hitting the arrow keys as little as possible, and think at the text in terms of "blocks" like "a sentence" "a tag" "a word" "a group of brackets".

Say you have function foo($bar, $fooz) you can change the parameters by simply positioning your cursor anywhere inside the brackets and pressing ci) (mnemonic: change inner bracket). The same pattern applies to other commands: yank (y), delete (d) and so on.

I know this doesn't explain the whole "VIM philosophy" but combining normal mode commands with the vast amount of motion modifiers is what really made me see the light.

kemp