Home IT Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Programmer editor Vim     - MongoDB start under Linux (Database)

- Based LNMP + uWSGI deploy Django applications (Server)

- Linux kernel to achieve soft RPS network to receive soft interrupt load balancing to distribute (Linux)

- Protobuf compiled and used on the Ubuntu 14.04 (Programming)

- Oracle View Object Information (Database)

- CentOS 6.5 install Firefox (Linux)

- Ubuntu 64-bit installation Adobe Reader 9.5.5 (Linux)

- Linux performance optimization tools perf top (Linux)

- CentOS 7 server environment to quickly build Linux (Server)

- Switching Virtual Machine + Ubuntu graphical interface and terminal interface (Linux)

- Linux disk quota-related instruction (Linux)

- Zabbix monitors the status of TCP connections (Server)

- Linux Demo dd IO test (Linux)

- QBit development of micro-services (Server)

- Getting Started with Linux system to learn: how to use tcpdump to capture TCP SYN, ACK and FIN packets (Linux)

- Setting grep Highlight Matches (Linux)

- Hadoop new and old version of the difference in the size of the InputSplit (Server)

- [SHELL] MySQL primary recovery solution from + Keepalived online (Server)

- To create a Linux server network security (Linux)

- How to use GRUB2 files directly from the hard disk to run ISO (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.
- Bad name two variables (Linux)
- When RHEL7 use fdisk partition, all partitions can not be used (Linux)
- Use SecureCRT to transfer files between local and remote hosts (Linux)
- You may not know the Linux command-line network monitoring tool (Linux)
- Multipath configuration under Linux (Linux)
- How to properly set up a Linux swap partition (Linux)
- Git / Github use notes (Linux)
- Modify Linux terminal prompt path length (Linux)
- Use MongoDB C # MongoDB official driving operation (Database)
- PL / SQL how to make the program every few seconds to insert a data (Database)
- openSUSE 13.1 / 13.2 installation SoundConverter 2.1.2 (Linux)
- PHP interview questions of design patterns (Programming)
- High-performance JavaScript reflows and repaints (Programming)
- Justniffer installed on Ubuntu 15.04 (Linux)
- Parameters of the extra port MySQL 5.6 (Database)
- TCP protocol flaw incomplete records (Linux)
- JEdit 5.2 Pro Edition installation on Ubuntu 14.04 (Linux)
- iOS in Singleton (Programming)
- ImportTsv-HBase data import tool (Database)
- RHEL5 / 6 Installation Notes (Linux)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.