当前位置:网站首页>[3. VIM operation]
[3. VIM operation]
2022-07-27 00:34:00 【Romantic dog】
Catalog
3.1 Vim brief introduction
function :
- Text editor in command line mode .
- Automatically identify the programming language according to the file extension . Support code indentation 、 Code highlighting and other functions .
- Usage mode :
vim filename
If the file already exists , Open it .
If there is no such document , Then open a new file , And named itfilename
Pattern :
- 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 . - Edit mode :
In general command mode, pressi, Will enter edit mode .
Press downESCWill exit edit mode , Return to normal command mode . - 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 .
3.2 Mode conversion
i: Enter edit modeESC: Enter general command mode:/?Any of the three letters , Enter command line mode
3.3 Move and jump
hor Left arrow key : Move the cursor one character to the leftjor down arrow : Move the cursor down one characterkor up arrow : Move the cursor up one characterlor Right arrow : Move the cursor one character to the rightn <Space>:nRepresentation number , Press the number and then the space , The cursor will move this line to the rightnCharactersn <Enter>:nIs the number , Cursor downnThat's ok0or Function keys[Home]: Move the cursor to the beginning of the line$or Function keys[End]: Move the cursor to the end of the lineG: The cursor moves to the last line:nornG:nIs the number , Move the cursor to thenThat's okgg: Move the cursor to the first line , amount to1G
3.4 Find and replace
/word: Look under the cursor for the first value to bewordString .?word: Look over the cursor and the first value iswordString .n: Repeat the previous find operationN: Repeat the previous lookup operation in reverse:n1,n2s/word1/word2/g:n1Andn2Is the number , In then1Line withn2Look between linesword1This string , And replace the string withword2:1,$s/word1/word2/g: The full text ofword1Replace withword2:1,$s/word1/word2/gc: The full text ofword1Replace withword2, And the user is required to confirm before replacement .
3.5 Text operation
v: Select the textd: Delete the selected textdd: Delete current rowy: Copy the selected textyy: Copy the current rowp: Place the copied data on the next line of the cursor / Paste in the next positionu: revokeCtrl + r: Cancel cancellation- More than no.
>: Indent the entire selected text to the right once - Less than no.
<: Indent the entire selected text to the left once
3.6 Paste mode
:set pasteSet to paste mode , Cancel code auto indent:set nopasteCancel paste mode , Turn on code auto indent:set nuAccording to the line Numbers:set nonuHide line numbersgg=G: Format the full-text code:nohTurn off search keyword highlighting
3.7 Save and exit
:w: preservation:w!: Force save:q: sign out:q!: Forced exit:wq: Save and exit:wq!: Force save and exit
3.8 exception handling
Ctrl + q: WhenvimDead time , You can cancel the currently executing command- Each time vim When editing a file , It will automatically create one
.filename.swpTemporary files for . If you open a file , Of the document swp file already exist , May be an error . There are two solutions :- Find the program that is opening the file , And exit
- Just delete the
swpFile can
边栏推荐
- C and pointer Chapter 18 runtime environment 18.2 interface between C and assembly language
- 哨兵2号(Sentinel-2)的下载及处理
- 【4.7 高斯消元详解】
- Visual studio C cs0006 C failed to find metadata file
- Go exceed API source code reading (IV) -- save (), SaveAs (name string)
- Matlab based medical imaging technology filtering backprojection simulation, including direct backprojection, S-L filtering, R-L filtering, LeWitt filtering
- Alexnet (pytoch Implementation)
- Linux系统中安装Redis-7.0.4
- 八皇后 N皇后
- 【AtCoder Beginner Contest 261 (A·B·C·D)】
猜你喜欢
随机推荐
用New,delete和用malloc,free申请,释放堆区空间
【 Educational Codeforces Round 132 (Rated for Div. 2) A·B·C】
Dynamic binding, static binding, and polymorphism
Signal and system impulse response and step response
Sliding window problem summary
6_梯度下降法(Gradient Descent)
Machine learning model -- lightgbm
20220720折腾deeplabcut2
蓝桥杯 1004 [递归]母牛的故事
2022-07-17:1, 2, 3... N-1, N, n+1, n+2... In this sequence, only one number has repetition (n). This sequence is unordered. Find the repeated number n. This sequence is ordered. Find the repeated numb
12_决策树(Decision tree)
Reduced dimension mean dot product matrix multiplicative norm probability normal distribution square loss
9_ Logistic regression
CDs simulation of minimum dominating set based on MATLAB
[LeetCode] 无重复最长字符串
Database: MySQL foundation +crud basic operation
C and pointers Chapter 18 runtime environment 18.4 summary
Collection of 3D LUT related articles
Mysql8 installation
哨兵2号(Sentinel-2)的下载及处理









