当前位置:网站首页>[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
边栏推荐
- Huffman encoding and decoding
- Reduced dimension mean dot product matrix multiplicative norm probability normal distribution square loss
- 傅里叶分析(基础介绍)
- Alexnet (pytoch Implementation)
- A simple prime number program. Beginners hope that older bosses can have a look
- Nacos installation and pit stepping
- Leetcode - linked list
- Leetcode high frequency question: the choice of the inn, how many options to choose accommodation, to ensure that you can find a coffee shop with a minimum consumption of no more than p yuan in the ev
- 01 knapsack problem 416. Segmentation and equal sum subset -494. Goal and
- 八皇后 N皇后
猜你喜欢

【3. 基础搜索与图论初识】

Viterbi Viterbi decoding bit error rate simulation, modulation is QPSK, channel is Gaussian white noise

C语言 求素数、闰年以及最小公倍数最大公约数

CDs simulation of minimum dominating set based on MATLAB

Three tier architecture simulation

C and pointer Chapter 18 runtime environment 18.1 judgment of runtime environment

Dynamic binding, static binding, and polymorphism

Leetcode high frequency question: the choice of the inn, how many options to choose accommodation, to ensure that you can find a coffee shop with a minimum consumption of no more than p yuan in the ev

Deployment of yolov5 on Jetson nano deepstream

运算符重载
随机推荐
Web middleware log analysis script 1.0 (shell script)
JS, one of the methods of object merging Assign (), recursive assignment & method of array merging..., array. Concat (), array. Push. Apply (), array. Push ()
解析网页的完整回顾
Lt9611ux Mipi to HDMI 2.0 dual port with audio
Leetcode topic - binary tree chapter
哨兵2号(Sentinel-2)的下载及处理
postman的使用
"Could not load host key" error when xshell connects to the server
Deploy yolov5 error reporting in pycharm
机器人学台大林教授课程笔记
【4.3 欧拉函数详解】
Convolutional neural network -- lenet (pytorch Implementation)
Reduced dimension mean dot product matrix multiplicative norm probability normal distribution square loss
【AtCoder Beginner Contest 261 (A·B·C·D)】
UNET notes
输入一串字母 将里面的元音输出希望各位大佬能给指导
QML type system
Resolve Microsoft 365 and Visio conflicts
[Qt]元对象系统
信号与系统学习零输入响应