Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Editor of the popular Linux Gvim     - How to enhance the Nagios server security (Linux)

- Towards Docker (Server)

- Add your own kernel and ramfs based on an existing Linux LiveCD (Linux)

- Vim configuration instructions (Linux)

- To install GCC development environment under SUSE11 (Linux)

- Python kills corresponding process according to pid (Programming)

- Linux system security knowledge (Linux)

- Linux ./configure --prefix command (Linux)

- Snapshot DataGuard (Database)

- Oracle SQL statement to retrieve data paging table (Database)

- JITwatch installation under Linux (Linux)

- Linux prohibit non-WHEEL user su command Detail (Linux)

- Linux netstat command to get started (Linux)

- Nginx caching using the official guide (Server)

- TeamCity continuous integration in the Linux installation (Linux)

- Cooling solutions Ubuntu system (Linux)

- Java memory area and memory overflow exception (Programming)

- Keepalived achieve high availability Nginx Reverse Proxy (Server)

- Ubuntu apt-mirror established local private sources (Linux)

- Debian 7 and Debian 8 users how to install Oracle Java 8 (Linux)

  Editor of the popular Linux Gvim
  Add Date : 2018-11-21      

vi editor is a Linux system most commonly used text editor, vi editor in Linux circles have God in the world almost all Linux distributions are included vi program.

vi operates in character mode, do not need a graphical interface, very suitable for remote and embedded work, is highly efficient text editor, although there are many in the Linux graphical editors available, but vi graphics editing features are those is unmatched.

What is that vim is it?

vim is an upgraded version of vi, it is not only compatible with all vi commands, but there are some new features, such as vim can undo unlimited support keyword completion, you can use different colors to highlight your code. vim widely promoted as a vi editor best.

Official website: http: //www.vim.org/download.php

When using vim, ctags tool universal need assistance. ctags tool is easy to read the code under vim, vim is a very powerful plug-ins, browser code with which you can jump around between functions, variables, and so on.

Official website: http: //ctags.sourceforge.net/

Ready to work

Install vim, ctags:

sudo apt-get install vim

sudo apt-get install ctags

Configuration vim:

vim simplest and most common operations

The following operations using vi or vim commands are equivalent.

Give you about one of the most simplest and most common operations (open the file, edit the file, save the file), if you do not delve into learning these operations can be.

Open the file using vi

vi filename: Open or create a new file, and the cursor placed first trekking first

If the file does not exist, create a new file, as follows:

If the file exists, that is to open the file, open a file, press the "i" into insert mode, it can be edited:

Because vim configuration reasons, resulting in columns as shown above, press "F9" to achieve Hide Show column switching.

By default, open the file, it is not directly editable:

Press the "i" into insert mode, you can edit:

vi + n filename: Open the file and the cursor on the first n-trekking

Save the file (one way):

Be sure to exit insert mode, and then, shift + zz (hold down the "shift" + double-click the "z" key) to save and exit the current file.

Details of vim

vim editor has three modes of operation (mode name is not important, I always tell, you know what to do in each mode):

1, vi insert mode

When vi create a non-existent file, the default insert mode

vi character to be entered as text content on the file being edited

2, vi editing mode

When vi open an existing file, the default to enter edit mode

In this mode into insert mode, control the screen cursor moves, select the text, copy, paste, cut, delete, search and so on.

3, vi the last line mode (command mode)

In edit mode, press the "shift" + ":" enter

Edit Mode is similar to the completion of save, save, search and other tasks

Mode switch:

Switching from edit mode to insert mode

i started inserted from the current cursor position

a character from the current cursor position to start inserting

o the cursor position in the downstream insert a blank line, and then insert

I began to insert the text from the cursor to the beginning of the line

A from the end of the line where the cursor start inserting text

O on a single line at the cursor position to insert a blank line, and then insert

Switching from edit mode to the last line mode (command mode)

"Shift" + ":"

The insert mode, command mode to edit mode

Esc (command mode to edit mode twice Esc)

Insert mode and command mode can not be directly converted

Delete, and modify text edit mode

1, u undo the previous several revisions.

2, [n] x deleted after the cursor n characters.

3, [n] X cursor to delete the first n characters.

4, [n] dd to delete from the current line n lines (accurately speaking, is cut, cut and paste is not deleted).

5, [n] yy Copy n lines from the beginning of the current line.

6, p the contents of the clipboard into the current line.

7, performing the last operation

8, shift + zz (hold down the shift key to double-z) to save and exit the current file

Copy editing mode

yw copy a word

Clip a word dw

cw modify a word

Block select command

v: Press the character selection

d: Clip selected content to the clipboard.

y: Copies the selected content to the clipboard.

c: Clip selected content to the clipboard and insert mode

(N) shift +> moves the selection to the right a tab

(N) shift +
Move the cursor in edit mode

[N] G: Position the cursor at the beginning of the n-th row

G: Position the cursor to the end of the file

gg: Position the cursor to the beginning of the file

Find edit mode

/ String: search string from the cursor to the beginning of the end of the file.

n: the same direction to repeat the last Find command

N: the opposite direction to repeat the last Find command

Common last line mode command

File Storage

: W save the current file

: W file Save the current file to file

: Q Quit vi

: Wq to save the current file and exit

: X Ibid.

:! Q Do not save the file and exit

Multi-line cut in the normal mode, copy

: N1, n2 d between the contents to cut n1 n2 rows into the clipboard

Under Content between n1, n2 m n3 cut n1 n2 row to row to n3 line:

: N1, n2 co n3 copy content between the lines to n1 n2 n3 row to the next row

Finally, find and replace line mode

: S / p1 / p2 / g in all the current line p1 p2 were using alternative

: G / p1 / s // p2 / g in the file are all p1 p2 with alternative

: N1, n2s / p1 / p2 / g to n1 to n2 p1 were all in line with alternative p2
- Oracle restrict certain IP, the malicious user actions on important table (Database)
- Source install Python3.4 on CentOS (Linux)
- MongoDB relations, references, index query coverage (Database)
- Oracle 10g, 11g database silent installation of small differences (Database)
- Python script file directory traversal examples (Programming)
- ORA-00911 invalid character error Solution (Database)
- Talking about the implementation and the JVM garbage collection mechanism (Programming)
- To create a Linux server network security (Linux)
- About the replication of JavaScript (Programming)
- CentOS and RHEL installation under GAMIT10.6 (Linux)
- Fedora 21 setting boot script (Linux)
- Ubuntu 14.10 splash screen brightness settings (Linux)
- Go performed using iOS and Android programming (Programming)
- Workaround CentOS error message during compilation PHP5 common (Linux)
- awk Programming Model (Programming)
- Linux Mint 17.2 64 bit installation Docker and management software seagull (Linux)
- Analysis of MySQL High Availability (Database)
- Linux System Getting Started Learning: compile and install ixgbe driver in Ubuntu or Debian (Linux)
- Eclipse, Tomcat configuration JNDI connection Oracle data source example (Server)
- Ubuntu users to install Gnome-Pie 0.6.5 (Linux)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.