当前位置:网站首页>VIM common commands
VIM common commands
2022-07-29 02:54:00 【Tea white 777】
The overview
vim course
function :
(1) Text editor in command line mode .
(2) Automatically identify the programming language according to the file extension . Support code indentation 、 Code highlighting and other functions .
(3) Usage mode :vim filename
If the file already exists , Open it .
If there is no such document , Then open a new file , And named it filename
Pattern :
(1) General command mode
The default mode . Command input mode : Similar to playing games, playing skills , According to different characters , You can perform different operations . Can copy 、 Paste 、 Delete text, etc .
(2) Edit mode
In general command mode, press i, Will enter edit mode .
Press down ESC Will exit edit mode , Return to normal command mode .
(3) Command line mode
In general command mode, press :/? Any of the three letters , Will enter command line mode . The command line is at the bottom .
Can find 、 Replace 、 preservation 、 sign out 、 Configuration editor, etc .
operation :
(1) i: Enter edit mode
(2) ESC: Enter general command mode
(3) h or Left arrow key : Move the cursor one character to the left
(4) j or down arrow : Move the cursor down one character
(5) k or up arrow : Move the cursor up one character
(6) l or Right arrow : Move the cursor one character to the right
(7) n<Space>:n Representation number , Press the number and then the space , The cursor will move this line to the right n Characters
(8) 0 or Function keys [Home]: Move the cursor to the beginning of the line
(9) $ or Function keys [End]: Move the cursor to the end of the line
(10) G: The cursor moves to the last line
(11) :n or nG:n Is the number , Move the cursor to the n That's ok
(12) gg: Move the cursor to the first line , amount to 1G
(13) n<Enter>:n Is the number , Cursor down n That's ok
(14) /word: Look under the cursor for the first value to be word String .
(15) ?word: Look over the cursor and the first value is word String .
(16) n: Repeat the previous find operation
(17) N: Repeat the previous lookup operation in reverse
(18) :n1,n2s/word1/word2/g:n1 And n2 Is the number , In the n1 Line with n2 Look between lines word1 This string , And replace the string with word2
(19) :1,$s/word1/word2/g: The full text of word1 Replace with word2
(20) :1,$s/word1/word2/gc: The full text of word1 Replace with word2, And the user is required to confirm before replacement .
(21) v: Select the text
(22) d: Delete the selected text
(23) dd: Delete current row
(24) y: Copy the selected text
(25) yy: Copy the current row
(26) p: Place the copied data on the next line of the cursor / Paste in the next position
(27) u: revoke
(28) Ctrl + r: Cancel cancellation
(29) More than no. >: Indent the entire selected text to the right once
(30) Less than no. <: Indent the entire selected text to the left once
(31) :w preservation
(32) :w! Force save
(33) :q sign out
(34) :q! Forced exit
(35) :wq Save and exit
(36) :set paste Set to paste mode , Cancel code auto indent
(37) :set nopaste Cancel paste mode , Turn on code auto indent
(38) :set nu According to the line Numbers
(39) :set nonu Hide line numbers
(40) gg=G: Format the full-text code
(41) :noh Turn off search keyword highlighting
(42) Ctrl + q: When vim Dead time , You can cancel the currently executing command
exception handling :
Each time vim When editing a file , It will automatically create one .filename.swp Temporary files for .
If you open a file , Of the document swp file already exist , May be an error . There are two solutions :
(1) Find the program that is opening the file , And exit
(2) Just delete the swp File can
Special Usage
Quickly delete
ggd Line number , Delete the line from the beginning to line number ;
Such as ggdG, Delete full text , among gg It's the beginning ,d Is delete mode ,G It's the end ;
In the same way gg=G, Full text formatting ;
边栏推荐
- Interpretation of ue4.25 slate source code
- 创客教育的起源和内涵的基本理念
- MySQL compound query (important)
- 解析Steam教育中的项目式学习创造力
- [error reporting] node:internal/modules/cjs/loader:936 [solution]
- Summary of classic problems in Flink production environment
- Flink生产环境经典问题汇总
- Library management system
- Asemi rectifier bridge s25vb100, s25vb100 parameters, s25vb100 application
- 11.书写规则-伪目标
猜你喜欢
随机推荐
瀚高数据库最佳实践配置工具HG_BP日志采集内容
Pytest environment deployment + use case execution management + use case parameterization
Multithreading realizes concurrent reading and execution of multi use case files +selenium grid4 realizes distributed deployment of test framework
C语言:判断字母
idea替换所有文件中的内容
【npm错误】- npm ERR code ERESOLVE 和 npm ERR ERESOLVE could not resolve 问题
Analyzing the subjective consciousness of emotional resonance between robots and human beings
QT屏幕自适应自动布局,拖动窗口自动变大变小(一)
etcd实现大规模服务治理应用实战
PHP process communication series (I) named pipes
第八天笔记
MongoDB索引 (3)
第六天笔记
navicat新建数据库
Youxuan software appoints Huang Zhijun as the general manager of the company
Plug in --- line segment sloth marking board + simple mathematical reasoning
UE4.25 Slate源码解读
Pgzero aircraft war
HTB-Blocky
[opencv] use OpenCV to call mobile camera








