Git uses VI or VIM

Source: Internet
Author: User

1, VI & VIM have two modes of operation:

(1) Command mode: Accept, execute VI & VIM Operation command mode, the default mode after opening the file;

(2) Editing mode: The mode of adding, deleting and changing the contents of open files;

#在编辑模式下按下 the ESC key, fallback to command mode.

2. Create and Open file: $ VI [filename]

(1) Use the VI Plus file path (or file name) mode to open the file, if the file exists then open the existing file, if the file does not exist, then create a new file, and the terminal in the bottom line of the display is open.

(2) keyboard input letter "I" or "insert" key into the most commonly used insert editing mode.

3. Save the file:

(1) Edit the file in insert edit mode.

(2) Press "ESC" key, exit edit mode, switch to command mode.

(3) In command mode, type "ZZ" or ": Wq" to save the changes and Exit VI.

(4) If you only want to save the file, type ": w", enter the bottom row to prompt to write the result of the operation, and stay in command mode.

4. Discard all file changes:

(1) Discard all file changes: Press the "ESC" key to enter the command mode, type ": q!" Enter and discard the modification and exit VI.

(2) Discard all file changes, but do not exit VI, that is, fallback to the file opened the last time the state of the save operation, continue to file operations: Press "ESC" key into the command mode, type ": e!", return to command mode.

Git uses VI or VIM

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.