Terminal simple to write code using &vim

Source: Internet
Author: User

Vim simple and practical & write code with VIM

VI 1.c set up 1.c to enter terminal instruction mode

Press ESC to enter instruction mode

Press ESC and press: Enter command line mode

Press I to enter edit mode  (Press I to enter, the cursor does not move.) Press A to enter, the cursor goes backward one)

After entering edit mode, you can only use the keyboard to operate

Exit after editing, save in exit

Press ESC to enter command mode >: > Wq (w = save, q = exit)

Note: command line > q! Indicates forced exit, not saved. Use caution.

vim 1.c file exists, then open 1.c

Some instructions:

ESC enters instruction mode:

DD deletes the cursor in the row

5DD Delete currently selected down 5 rows

U return

YY the copy cursor is in the row

4YY copy cursor down 4 lines

P The next line of the cursor is pasted

SHIFT + 4 cursor positioned to end

Press 0 directly after ESC

SHIFT + END of paragraph 0

SHIFT + 9 Segment Header

SHIFT + G last line

SHIFT + 3 Move the cursor up

GG Cursor is positioned to the top of the file.

Vim Display line number

ECS enters command line mode

Enter set Nu to display line number

Enter set none hidden line number

The command mode directly presses the number, determines the bit to the corresponding line

Enter command line mode

Vim Writing code

VI 2.c

GCC 2.c compile connection, generates a.out results

./a.out Running Results

##### #代码高亮方法 ######

CD ~ Go to home directory

Setup configuration file: Vi. VIMRC

In the configuration file, enter:

Syntax on

Set tabstop=4

First line: syntax highlighting

Second line: Set Tab key is 4 spaces

Save Exit Esc:w Q

When you open the code, the color is displayed

Terminal simple to write code using &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.