Vim-------Create, view, edit files

Source: Internet
Author: User
Tags save file

1. Vim usage

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7F/57/wKiom1caLeiBxkiKAAEbx0ajgDc460.png "title=" Picture 1.png "alt=" Wkiom1caleibxkikaaebx0ajgdc460.png "/>


1.1 Command mode

1.1.1 Settings

VIM/ETC/VIMRC Vim configuration file

Append input echo set nu >>/ETC/VIMRC

:set Nu|nonu # # # # # display of line numbers

: Set Mouse=a # # # setting mouse to manipulate cursor position

: Set AI # # automatically

: Set Hlsearch

: Help # # # View The usage of vim : Q exit help

Ctrl + V # # # Highlight selection mode, can be selected one area operation

u # # # # before reverting to no action ( undo Action )

Ctrl + R # # # # back to Action (undo undo)

Syntax On|off # # # Syntax coloring

1.1.2 adding characters in bulk

CTRL + V Select the bit where you want to add the characters, press the I Key, add the characters you want to add, press ESC

1.1.3 The file is not saved when the terminal is forcibly closed .

Delete the file.swp file directly when recovering .

1.1.4 split Screen function

ctrl+w S # # # top and bottom split screen

Ctrl+w v # # # Left and right split screen

ctrl+w C # # # undo the screen where the cursor is

ctrl+w on | under | left | Right ##### Move the cursor to the specified screen

1.1.5 Substitution characters

in command mode

:%s/the first selected character in the full text after the original character / replacement character /g not added /g

1.1.6 Search Keywords

/ Keywords

N match down

N up Match

/ random characters can be canceled to replace the word Fugauliang

management of 1.1.7 characters

DW Delete the word where the cursor is located

DL Delete the letter of the Light

DD Delete a whole row

d Digit d deletes the number of rows specified by the number

d number up key Delete the specified number of rows up

yw Copy the word where the cursor is

yl Copy the letter of the Light

yy copy a whole line

P Paste

y digit y copy number of rows specified

CW The word where the cursor is clipped

CL The letter where the light is clipped

cc cut an entire line

c Digit c cut the number of rows specified by the number

When the cut is finished, it goes into insert mode, to paste out of insert mode and then press the P key .

1.1.8 Move cursor to the specified line

: line number

G # # Move the cursor to the end of the file

1.2.vim Plug-in mode

I cursor Seated at position insert character

I insertion of the line at the beginning of the cursor

a next insertion of the character of the cursor

A The end of the line where the cursor is inserted

o next line of the row where the cursor is located

O previous line of the row where the cursor is located

s Remove the character insertion of the cursor

S Delete the row where the cursor is inserted


Exit mode of 1.3.vim

Enter in command mode

: Q # # # exit, you can use when you have not made any changes to the file

: q! # # # forced exit

: Wq # # # exit Save

: wq! # # # Force quit save

1.4vimtutor

Vimtutor is a Description tool for vim

Use:q to exit the tool



2.

chattr +i file root user restricts all users from changing files, including their own

Chattr-i file Cancellation restrictions

lsattr File View files have this limit

The text editor in the drawing gedit

Crtl+n # # new Window

Ctrl+s # # save file

Ctrl+o # # Open File

ctrl+x # # cut

Ctrl + V # # Paste

Ctrl + C # # copy

For giedit software help view can be used

Yelp help:gedit


Vim-------Create, view, edit files

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.