I heard that the code, the IDE and VIM are more equipped with OH

Source: Internet
Author: User

Vim Toss Kee

In the selection editor above, I am a tangled person, once young I persist in the pursuit of a universal editor, can support all the editing language, flexible and customizable, can be purely keyboard operation. An editor that complies with this condition, not vim.

Before I put in the Vim camp, I was very shy. The first time I used vim, my first feeling was:

"Dug trough, what the hell is this?" Line number does not, syntax highlighting no, automatic prompt also no, this and txt have what difference ... Quit quickly, rely on, how still can not return? Is this anti-human thing also known as the editor of God? “

Later saw the great God for the configuration of vim, only to know that vim can still play, recommended to read the old driver to talk about the editor of the God, this article let me marvel at Vim, feel vim omnipotent, began to imagine their own learning vim, in the case of other people using various Ides, I maximized the vim window by pointing to the flying, like the piano artist. This outfit forced the scene, think all feel very smug ...

Attracted by various cool features, I began to indulge in how to toss vim

Vim Loading Plug

Loading force is human's just need

Vim learning curve is steep, if you are pure small white, strongly recommend a concise VIM training strategy, followed this article for several days, VIM the most basic functions familiar.

After a preliminary understanding of vim, to learn more about VIM in a systematic way, Vim's Practical Tips (2nd edition) is the perfect choice.

Vim Practical Tips (2nd edition)

Grasp the basic vim of the command, I began to toss vim of the bitterness of the history of blood, a start is their own configuration .vimrc , and later saw a lot of off-the-shelf configuration, such as the Vim of the ultimate configuration of the Spf13-vim, the domestic spacevim will be vim configured as the out-of-the-box IDE

After trying a variety of vim configurations, no one is really used to call the hand, there are always some pits waiting for me, but also to make vim so complex, always feel out of place, dubious, and there is no IDE useful.

So why do we have to toss vim? Just use the IDE, right?

But accustomed to the VIM mode switch, the key operation, can no longer use the IDE those weird shortcut keys combination.

The ultimate solution is to use the JetBrains family bucket, then install the ideavim plug-in, both to enjoy the IDE's integrated environment, and continue to use the powerful vim, and JetBrains family bucket has included the mainstream programming language, whether it is to write PHP (Phpstorm), Or Pycharm python, or play Golang (Golang), have the corresponding IDE, but use it as if you are using the same editor

Vim Common commands

Vim is not learned, even with the use of vim for ten years veteran, also dare not say completely mastered the vim. But the usual VIM instructions are not many, here are some of my frequently used commands:

Cursor movement

    • 0 to Wardrobe
    • ^ The first position of the bank is not blank
    • $ to end of line
    • G_ to the last position of the bank, not blank.
    • NG to Nth row or: n
    • W to the beginning of the next word
    • E to the end of the next word
    • % Match parenthesis Move
      • and # match the current word of the cursor, move the cursor to the next/previous match word
    • F{char} to the next {char}
    • T{char} to a character before {char}
    • Nf{char} finds nth occurrences of {char} in the current row such as: 3FA
    • F and T with F and t opposite direction
    • Dt{char} Delete all content before {char}
    • ; With, jump to the next/previous character found by f/f, t/t

Replace

    • :%s/original text/replaced content/g full text replacement
    • : 10,20/original text/replaced content/g specify line number substitution

Specify the number of rows operation

    • : 10,20y copy 10 to 20 rows
    • : 10,20d Delete 10 to 20 rows

Efficient operation

    • . Repeat the last command
    • n<command> repeat a command n times
2dd 删除2行3p 粘贴文本3次100idesu[ESC] 会写下100个 desu

Jump

    • CTRL + O go back to the previous place
    • CTRL + I go back to the next place

Bookmark

    • Ma Set bookmark for current file
    • MA setting bookmarks for global files
    • ' A jumps to bookmark a
    • ' A jumps to bookmark a
    • : Marks view all current bookmarks

Macro actions

    1. First, press Q, and then press the register you want to save, any lowercase letters can. For example, let's save it to the Q register. Press QQ, you will find the command line has shown the "Recording @q".
    2. If you've already recorded it, you just need to press Q again to finish recording.
    3. If you want to call the macro you just recorded, you just need to [count]@q
    4. If you want to invoke the last macro you used, you only need to [count]@@

Example: A macro that inserts a newline after the string "ABC", repeated calls 10 times:

qqiabc<cr><esc> # <cr> 表示回车键q10@q

TIP: If it's a Windows system, the IDE's ability to enable Vim plugin is not very good, because CTRL is both a VIM function key and a Windows function key, both of which are conflicting and not very cool to use. Mac's function key is command key, avoids the conflict problem

If you feel that this article is helpful, like, or a cup of coffee money, your approval is important to me

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.