当前位置:网站首页>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 ;
边栏推荐
- 场景分类任务可用数据集(部分)
- Weekly recommended short videos: how to make product development more effective?
- A good-looking IAPP donation list source code
- 关于时间复杂度的一些新认识
- Introduction to network foundation
- [opencv] use OpenCV to call mobile camera
- MongoDB索引 (3)
- 第五天实验
- owt-server源码剖析(三)--video模块分析之Mixer In
- Cloud development workers must go to work fishing and paddling wechat applet source code
猜你喜欢
![[error reporting] node:internal/modules/cjs/loader:936 [solution]](/img/73/849c58c814c1a47dff0cde0e365c75.png)
[error reporting] node:internal/modules/cjs/loader:936 [solution]

HTB-Blue

K210 - sound source location and sound recognition

Notes on the seventh day

Flink内核源码(七)Flink SQL提交流程

Asemi rectifier bridge s25vb100, s25vb100 parameters, s25vb100 application

第六天笔记

Introduction to network foundation

sqlilabs less-32~less-33

解析Steam教育中的项目式学习创造力
随机推荐
11.书写规则-伪目标
php 进程通信系列 (一) 命名管道
[untitled]
nacos名字的由来
第八天笔记
C language: Little Lele and Euclid
C语言:小乐乐与欧几里得
Interpreting AI robots' pet raising and leading fashion trends
vim常用命令
idea替换所有文件中的内容
golang 协程的实现原理
11. Writing rules - pseudo target
工科男生:20岁未满,平凡但不平庸
[QNX Hypervisor 2.2用户手册]9.11 ram(更新中)
C language: judging letters
New conch movie theme template m3.1 fully decrypted version multifunctional apple cmsv10 background adaptive theme open source fully decrypted version
Really time NTP service startup command
FFmpeg+SDL+QT实现简单是视频播放器
Tesla neural network model hydranet
Pgzero飞机大战