Home IT Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Programmer editor Vim     - After installing minimize RHEL / CentOS 7 need to do some things (Linux)

- How do you know your public IP terminal in Linux (Linux)

- How to achieve the MySQL Oracle table associated with the two operations update (Database)

- Linux unpack the tar file to a different directory (Linux)

- Use 3G wireless network card under Linux (Linux)

- In-depth summary of the PHP core of object-oriented (Programming)

- Jetty JNDI Development combat (Linux)

- Easily solve the MySQL database connection error too many (Database)

- How to use scientific data Docker quickly configure the development environment (Server)

- RedHat Linux 6.4 installation RTL8188CUS wireless network card driver (Linux)

- Use Ansible installation NGINX and NGINX Plus (Server)

- Lazarus for Raspbian installation (Linux)

- Linux file system structure Introduction (Linux)

- Oracle Linux 5.9 configuration Xmanager (Linux)

- Compile and install Memcached can not find GCC (Programming)

- 24 Docker recommendations (Linux)

- Detailed driver compiled into the Linux kernel (Programming)

- Hadoop2.4.0 Eclipse plug-in making (Server)

- Eclipse 3.7.2 can not start solving under Ubuntu 14.04 (Linux)

- GAMIT10.5 install and update failed Solution (Linux)

  Programmer editor Vim
  Add Date : 2018-11-21      
  Vim is the same as the existence of God in the editor, master Vim will greatly improve the efficiency of editing text. This article describes the basic operation of Vim and skills.



Vim in a total of four modes:

Normal mode: After starting Vim, the normal mode, all keys are function keys.
Insert mode: Press i, enter insert mode, where you can enter text, return to normal mode, press the Esc key.
Visual mode: Press v, enter visual mode, you can move the cursor to select text
Command line mode: Type ":" into the command line, run Vim commands
The most basic mobile

Move the cursor up and down and move around, respectively kjhl four keys. May be preceded by figures represent a plurality of mobile units. As 10j down 10 rows.

Move in the file

G ----- move to the last row

gg ------ move to the first row

10G ------ jumps to line 10

75% ----- 75% jump to full place

Moves to the specified character

Use f, t, F, T may be the current line moving quickly.

fx ----- move the cursor to the right of the first 'x' character on

Fx ----- searches backwards, which is moved to the specified character left of the cursor.

Before tx ----- move the cursor to the right of the first 'x' character

Tx ----- it moves the cursor to the right of the specified character 'x' after.

; ----- Repeated once before the input f, t, F, T command

, The opposite direction before ----- repeat input f, t, F, T command.

";" And "," the former of these two commands can also be used to represent multiple numbers. You can also use the number in front of the command, indicating multiples. For example: 3fx ----- move the cursor to the right of the first three 'x' on the character.

Move to the beginning of the line end of the line

0 ------ moved to the beginning of the line

$ ------ Move to end of line

^ ------- Moves to the first non-whitespace characters

Press the letter to move

The next word w ------ word first movement of the cursor

On a word to move the cursor word b ------ first

The next word e ------ move the cursor endings

On a word to move the cursor endings ge ------

Press Window Mobile

H ------ let cursor jumps to the top of the current window so that the cursor jumps to the current M ------ window L ------ let cursor jumps to the middle of the bottom of the current window

With respect to the scroll cursor

zt ------ the cursor to the top line of the window to move the cursor line zz ------ move the window in the middle zb ------ the line where the cursor at the bottom of the window to move

Various insert

i ------ inserted at the cursor a ------ inserted after the cursor o ------ after the current row insert a new row before the current row O ------ insert a cw ------ replace new line from the cursor position to the end of a word character (c key and w key)

Copy and Paste

yy p ------ ------ copy of the current row to be digitally pasted in front yy and p: 3yy ------ copy of the current row from the third row 3p ----- - paste text 3 times


To find in normal mode. / ------ In Normal mode, enter "/", then enter the string you want to check, enter, jump to the first match of the place. ? ------ And / n ------ Find the opposite direction to repeat the last search command N ------ opposite direction to repeat the last Find command

Enter "/" or "?", The spend under the cursor keys (or CTRL-P / CTRL-N) look at the historical record, and then perform the lookup again. You can also use the "q /" and "q?" Command in vim window at the bottom to open a new window, this window lists your search history, you can use this command to edit the content of any vim window will be edit, and then press Enter, the cursor will be on the content of the line to find out.

------ * Find the word at the cursor location, all matching words will be highlighted, and skip to the next item on a match to find the cursor position # ------ word, all words will be matched highlight and jump on a match

% ------ Parentheses Match Move, move to the position of the current cursor brackets of matching brackets

Replacement string

% S / string source / destination string / g ------ document all of the source string to the destination string to replace the current

Delete, undo and redo

dd ------ delete the current row dt ------ delete the current line up behind it encounters with the symbol u ------ undo the last operation ctrl + r ------ redo weight do as I used dd to delete the current line, if you do not want to regret you can use the u command to undo delete, if you still want to delete you can use the ctrl + r continue to remove.

Open, Save and Exit

Unless otherwise specified, the following actions are in command mode, that is, before each command must be added ":", such as: q to quit. q ------ exit the current file q ------ forced to exit the current document without saving w ------ written to the file, save wq ------ save and exit the current file x! - ----- save and exit the current file ZZ ------ save and exit the current file (running in normal mode) e filepath ------ open a file saveas filepath ------ save as bn - ---- when simultaneously open many files, you can use bn to switch to the next file. After bp ------ when many files open simultaneously, you can use a file on bp switching.

Repeat command

------ Repeat the last to leave before all commands to insert mode n ------ mentioned before repeating command command n times

And with the use of cursor movement commands

0y ------ copy of the Bank (0 to move to the beginning of the line, y copy from here until the last character of the Bank) ye ------ copied from the current location to the next word endings


The same document to identify the current row

: Sort
Time to undo

Vim 7 includes a allow users to jump to any edit point before or after the new features. Such as the use

: Earlier 10m
You can return to edit for 10 minutes before. Another example is the use of

: Later 5s
You can jump to 5 seconds after the edit point. In addition, you can use: undolist undo buffer command to view the list of branches exist. Through: undo command is able to move the revocation of a branch.

Remove all empty rows current document

: G / ^ $ / d
Inserts the specified string in the front of the line or the end of the line

The first row is inserted:

:% S / ^ / your_word /
Insert the end of the line:

:% S / $ / your_word /
For example, in front of each row insert line numbers are as follows:

:% S / ^ / \ = line ( ".") /
Read shell commands

Such as insert date:

:! R date
: R is: read the acronym is a shell command to run the show, which means I want the output of shell commands in vim to read!.

Count the number of times a word appears

:% S / word // gn
The survey results will be displayed in the status bar at the bottom.

Vim indentation paste problem

After pasting Python code in Vim indentation on the whole mess. After entering the paste mode, you can paste the contents in Insert mode, there will be no distortion.

: Set paste
Finally, use: set nopaste resume normal mode.
- How to Install Node.js in CentOS 7 (Linux)
- MySQL master-slave database configuration and error handling Raiders (Database)
- 15 things to do after installing Ubuntu 15.04 Desktop (Linux)
- Ubuntu clean up unnecessary disk space usage (Linux)
- Linux prohibit non-WHEEL user su command Detail (Linux)
- Ubuntu Control Panel to resolve network-manager icon display issue (Linux)
- The bulk batch multiple rows of data collect (Database)
- C ++: Postmodern systems programming language (Programming)
- Linux performance optimization tools perf top (Linux)
- PXE installation of Linux servers (Server)
- Java memory model subclasses (Programming)
- Elementary OS Freya global menu (Linux)
- Java object initialization (Programming)
- UNIX and class UNIX system security check notes (Linux)
- CentOS 6.7 install Nagios Tutorials (Server)
- Docker study notes (Server)
- DVD production using CentOS installation source within the company Yum (Linux)
- 11G ASM disk group does not automatically handle MOUNT (Database)
- Installation and use the telnet command under CentOS 6.x (Linux)
- The temporary operation of the document mkstemp on Linux (Linux)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.