Some of Vi-vim's forgotten points

Source: Internet
Author: User
Tags save file

1. VI is divided into three modes: General mode, edit mode and command line mode. I/esc +: wq:q: q! Enables VI to be converted back and forth in general mode and edit mode.

    • /word down looking for a string named word; Word looks up for a string named word.
    • X, x: In a line of words, delete one character to the right.
    • DD: Deletes the row where the cursor is located.
    • YY: The line where the cursor is copied (common)
    • Nyy: The next n line where the cursor is copied (common)
    • YG: Copy all data from the row to the last row of the cursor
    • P: Paste the copied data on the next line of the cursor
    • P: Pastes the copied data on the previous line of the cursor
    • U: Undo previous action (Common)
    • [Ctrl]+r: Redo Last Action (common)

2. General mode is commonly used when switching to edit mode:

I, I enter the insertion mode, I is inserted at the current cursor, I start inserting (common) at the first non-whitespace space where the current row is.

3. General mode switch to command line mode commonly used:

    • : W writes the edited data to the hard drive file (common)
    • : w! If the file is read-only, force the file to be written, but it depends on what permissions you currently have.
    • : Q leave VI (common)
    • : q! Force leave without saving files
    • : Wq (: wq!) left after saving (forced save)
    • : W[filename] Save edited data to another file (similar to save file)
    • : Set NU Displays line numbers and line numbers at the beginning of each line
    • : Seu Nonu Cancel line number

4. Vim's "Recover" function

Like General software will have the recovery function, vim by saving a temporary file to achieve this function. When we are using vim to edit, VIM will create a new file named. Filename.swp in the edited file directory. If your system is disconnected for some reason and the file you are editing is not yet saved, the. swp file will be able to perform its rescue function.

Vim's language code conversion: ICONV-F originally encoded-t new encoded filename [-o newfile]

Example: Iconv-f big5-t UTF8 vi.big5-o vi.utf8 (convert Vi.big5 to UTF8 encoding)

Some of Vi-vim's forgotten points

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.