Notes on playing vim-(iii)

Source: Internet
Author: User

Notes on playing vim-(iii)

  In the blink of an eye, May will slip away from the fingers, do not give a little time to daydream, I want to hurry to grasp the tail of May, in the blog add a pen. Then let's go to vim for a while. Use Vim to draw a full stop for May.

Basics

I believe that after playing the vim-notes (a) and play vim-notes (ii) of the study, for the cursor movement has been able to do whatever, but if you want to operate more quickly, the following several cursor movement commands are also essential.

Move the cursor over the current line: 0 ^ $ f F t T ,;

    • 0  → to wardrobe
    • ^  → to the first non-blank character
    • $  → to end of line
    • g_  → to the last position of the bank that is not the blank character.
    • FA  → to the next character of a, you can also fs to the next character for S.
    • T,  → to the first character before the comma. Commas can become other characters.
    • 3fa  → Find the third occurrence of a in the current row.
    • F   and   T  → and   F   and   T  , just in the opposite direction.

Regional Selection <action>a<object> or <action>i<object>

  In visual mode, these commands are powerful and their command format is

  <action>a<object>And<action>i<object>

    • The action can be any command, such as d (delete), ( y copy), v (can be selected depending on the mode).
    • The object may be: w A word, W a word separated by a space, a word, a s p paragraph. It can also be a special character: "、 ‘、 )、 }、]。

Suppose you have a string (map (+) ("foo")) . The cursor key is in the first position.

    • vi"→ Will choose foo .
    • va"→ Will choose "foo" .
    • vi)→ Will choose "foo" .
    • va)→ Will choose ("foo") .
    • v2i)→ Will Choosemap (+) ("foo")
    • v2a)→ Will Choose(map (+) ("foo"))
block operation: <C-v>

  Block operations, typical operations:0 <C-v> <C-d> I-- [ESC]

    • ^→ to Wardrobe
    • <C-v>→ Start block operation
    • <C-d>→ Move down (you can also use HJKL to move the cursor, or use%, or something else)
    • I-- [ESC]→i is inserted, insert " -- ", press ESC to take effect for each line.

 Under Windows Vim, you need to use <C-q> instead <C-v> of copy the <C-v> Clipboard.

Automatic hints: <C-n> and <C-p>

  In Insert mode, you can enter the beginning of a word, and then press<C-p>或是<C-n>,自动补齐功能就出现了……

macro recording: qa sequence q @a @@ of Operations ,
    • QA   Record your actions in register   A.
    • so   @a   Replay the recorded macro.
    • @@   is a shortcut to replay the most recently recorded macro.
    • example

      in a text with only one row and only 1 in this line, type the following command:

      • qayp<c-a>q →< Code>@a  → Write Down Under 1 2
        • QA   Start recording
        • Yp   copy lines. /li>
        • <c-a>   add 1.
        • q   stop recording.
      • @@  → write on 2 front 3
      • now do   [email protected]@   Creates a new 100 row and increases the data to 103.
Visual selection: v , V , <C-v>

Earlier, we saw <C-v> The example (under Windows should be <C-q>) that we can use v and V . Once you've been chosen, you can do the following:

    • J→ Connect all rows together (into one line)
    • <or > → Left and right indent
    • =→ Auto Indent

 Add something after all the selected lines:

    • <C-v>
    • Select the relevant line (you can use or or ... j <C-d> /pattern % )
    • $To the end of the line
    • A, enter a string, pressESC。
split screen: :split and vsplit

  Here are the main commands you can use to help with Vim :help split . You can refer to Chenhao previous article vim split screen.

    • :split→ Create split screen ( :vsplit create vertical split screen)
    • <C-w><dir>: dir is the direction, can be hjkl or one of ←↓↑→, it is used to switch split screen.
    • <C-w>_(or <C-w>| ): Maximized size (<c-w>| vertical split screen)
    • <C-w>+(or <C-w>- ): Increase size

Reference: http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/

PS: This blog Welcome to forward, but please specify the blog address and author, because I level limited, if there is wrong, welcome point, Thank you ~

Blog Address: http://www.cnblogs.com/voidy/

Blog: http://voidy.net

<. ))) ≦

Notes on playing vim-(iii)

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.