Linux-vim-based editing tools common operations Summary

Copyright: https://blog.csdn.net/xiaoxilang/article/details/91419187

1. Set the line number (set up temporary and permanent set)

         If temporary setting to display all of the line number of the file, it is necessary in the vim command mode input of the next : NU SET (set the display line number, equivalent SetNumber), : SET nonu (canceled line number), this method can only be provided maintaining the display at the current vim to open the file, the next re-open when they are not valid, as follows:; eg:

å¨è¿éæå ¥ å¾çæè¿ °

How vim following permanent display line numbers it?

Permanent:

So how do we make every time we turn on automatically when the set vim line numbers it, this time we need to set up a profile, two configurations
* to / etc / vimrc is to initialize the system-wide configuration
· to ~ / .vimrc personal vim initial configuration
here is a personal configuration settings, inputs vim ~ / .vimrc directly in the terminal, then we can enter profile, using edit vi ~ / .vimrc file or / etc / vimrc file in the insert mode in which file by adding the line " : the SET NU ", adding content without quotes, then in command line mode input under :! wq forced to save and exit  the command as follows

2. Shortcuts

Delete text
x: Each time you press the cursor position back to delete a character. [Super popular]
dd: Delete cursor line. [Ultra Common]

   #dd: e.g., 6dd Table 6 rows of the number of characters to delete from the line where the cursor down. [Common]
Copy - (a line copy y, p pasted into the new row)
YW: the suffix to the character at the cursor is copied into the buffer .
(And like the opposite function # x, # X's)
P: Paste into the character in the cursor position buffer (instruction 'yw' and 'p must be used with) .
yy: copy cursor line. [Ultra Common]
Recovery (Use the undo) on a command
u: If you misuse an instruction can immediately press u, a return to the operation. [Ultra Common]
: once the instructions may be repeatedly performed.

Save the file
w: In the last line mode prompt ":" before the press w to save the file together. [Super popular]
#, # w filename: If you want a certain period of removal of the article, save as another file, can use this command # represents the line number, for example, 30,50 w nice, the article you are editing the first 30 to 50 lines saved as nice this document.
Leave - Exit
q: q Press the left, sometimes if you can not leave vi, can be used with: q "strong home away from vi, like!"! "
QW: generally recommended to leave, together with the use of w, can also save files so leave [used].

w: In the last line mode prompt ":" before the press w to save the file together. [Super popular]

Guess you like

Origin blog.csdn.net/xiaoxilang/article/details/91419187