VIM NOTE 2

Source: Internet
Author: User

With vim for almost two years to see the tutorial also a lot, in general, you have to practice more, when you feel the need, and then add features. Here to share a view of the best tutorial, from the bar of a friend, write very well

Zero

Learn to play blind

One

Configuration file first from the simplest, before the wood level to consider the configuration plug-in, do not hard back command, do not directly access other people's configuration file
Basic or long time to stay in the insert mode, you will feel vim also mediocre, also not good use,

This time, the editing efficiency may be lower than with the original general editor, others ask what editor to use,
Most will answer: Vim with a nano, Kate, KWrite, Gedit, Geany or other Ides.

Two

Get into the habit of staying in normal mode (normal is not white), only enter the insert mode, after the input immediately <ESC>
To learn the move command under normal mode, enter the text standard process at this time:

    1. Normal mode move command to position the cursor accurately (remember, the search command is also a move command)
    2. Enter insert mode edit (enter insert mode with I only, to get used to the situation, use I a a o O s C)
    3. <ESC> return to normal mode

At this point, the editing effect will revert to the same normal editor you used before, with even a small increase

Kobe Sanraku

Learn what is operator (command d y c etc), what is motion (all commands that move the cursor, H J k L W E F t/?). , etc.),
Learn operator + motion methods, such as Ct. (Moves the current cursor to the. (dots) between the contents of the delete and enter insert mode ready to modify)
Learn the basics of the Ex command,: s what

At this point, editing efficiency starts to improve significantly, and when you use other general editors, you start to feel unaccustomed and inefficient

Restaurants

Learn text-objects, know operator + Text-objects method, can be surgically accurate positioning and modification,
Now that you're using it primarily in C + +, give some examples that are useful in this case:

Ci "(composed of change operator and text-object i")

This command will find the next "enclosed string" in the line where the current cursor is located, clear the contents of the quotation marks, and enter insert mode for easy modification
You can use the const char* hello = "Hello World", which is simpler than the explanation. Code like this to test

YaB (composed of Yank operator and Text-object AB)

This command copies the code block where the current cursor is located (the contents of {}, including the curly brace itself) to the default register,
It is convenient to use p in other places (of course, write code does not encourage copy and paste), you can use any one {} to test, and then find another place P

GUIW (made up of make uppercase operator and Text-object IW)

This command will capitalize the word in which the current cursor is located
If you turn max_size into Max_size

This is the time to begin to know why VIM is accurate and efficient, and not because the full keyboard does not require a mouse

Wu

Get used to operator + motion after discovering. Commands work well, pay more attention to the use of repeatable command combinations
Practice using bookmark positioning, Q recording macros, using multiple registers, using args, using the buffer
Use the other EX commands

At this time, I can not remember how the days before the use of vim.

Land

Start map frequently used commands, start writing vimscript, start to know what kind of plugin you need
Try to recommend several:
Pathogen or Vundle,tagbar, CTRLP, Gundo, ultisnips,surround,syntastic,conque,ack.vim,vim-commentary,fugitive (if it's git User
There are a lot of, but not directly help the C + +, do not mention

At this time, not interested in other editors, maybe Emacs except

Qi

Have a completely personal vimrc, basic into the sublimation, become the legend of the lake
Often others observe you edit, arouse ambition want to learn vim, try a few children because the hot key too not "humane" and give up,
But occasionally, he's seen a man in the river.

VIM NOTE 2

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.