VIM learning and record
2024_05_08
VIM : add/delet/change/check
-
copy ,cut and paste in the model of nomal .
ndd : cut to the clipboard with n lines
nyy: copy n lines to clipboard
p: past
u: undo -
change in the model of nomal
r+x : replace the current letter with “x” keep the nomal model.
c+w: delete the current world and switch into the model of insert.
s: delete the current letter immediately. -
delete in the model of nomal
x: delete the current letter
nx: delete the n letters from current position
dd: -
add
a //在当前光标位置的右边添加文本
i //在当前光标位置的左边添加文本
A //在当前行的末尾位置添加文本
I //在当前行的开始处添加文本(非空字符的行首)
O //在当前行的上面新建一行
o //在当前行的下面新建一行 -
check
/keyword //向光标下搜索keyword字符串,keyword可以是正则表达式
?keyword //向光标上搜索keyword字符串
n //向下搜索前一个搜素动作
N //向上搜索前一个搜索动作
2024 05 09
change the background color
- command: " colorscheme " wil show the current topic color, generally is default
- command: "colorscheme + <ctrl + d> can shows all of the topics color
- command: “colorshceme + choosed topic” shows the topics color that you choosed.
If there are not the topic background that you like you can download it online:
you can download from the following address:
vim backgound color topics
how to use it ?
you can clone and download to the folder of .vim
you need to write them to the vimrc for permanently.
the naked vim
it is the good way to lean the vim
the nated vim is powful !!
most of the IDE is Compatible for Vim
How to configure you vim
vimrc中是vim的配置文件
Linux/Unix 下创建一个隐藏文件 vim ~ /.vimrc (“~” 表示用户主目录)
-
基本配置
:set nu
:colorscheme bybrid -
vim 的映射
-
插件
-
vim 脚本
建议研究一下github 上的vim-go 教程 vim-go-tutoria 的 vimrc 文件
vim mapping:
vim 的basic mapping is working in the normal mode default
:map “custom key” command of vim " set the map
:unmap "undo the map
vim 的常用模式 normal /visual / insert 都可以定义映射 ()
map 映射命令具有递归的风向因此发明了非递归的映射指令
nnoremap / vnoremap / inoremap
vim-plug
2024-05-11
how to find the plugs you want
- VimAwesome.com
- google search
2024 -05-11
- review the map function of vim
set :
nnoremap no :NERDTree ’ open the indet book in the nomal mode
nnoremap nc :NERDToggle 'close the index book in the nomal mode by the non recurving way - install the plugs of airline / supertab
2024–05–13
easymotion / Flipping pages
the appliacaiton scenario:
first use the function of flipping pages to get the position you want to edite. then, use the easymoiton to swith to the accurate position to edite the codes.
- Flipping pages: (可以映射为 p-f /p-b / pd /pu)
整页翻页 ctrl-f ctrl-b
f就是forword b就是backward
翻半页
ctrl-d ctlr-u
d=down u=up
- esaymoiton
step1: in the vim-plug, add the plug by " Plug ‘easymotion/vim-easymotion’
step 2: nmap ss (easymotion-s2)
2024-05-13
surround plug:
add the sentence of "Plug ‘tpope/vim-surround’ " in the vim-plug
ds : delete a surround
cs : change a surround
ys : you add a surround
notes: [the "ys"command is “ys iw */”/‘]
2024-05-15
模糊搜索:fzf :
Plug ‘junegunn/fzf’, {‘dir’: ‘~/fzf’, ‘do’: ‘./install --all’ }
24 Plug ‘junegunn/fzf.vim’
the usage commands :
-
Files + 文件位置
-
Ag + 字符串
-
(errors :
- case 1: ag is not found
- case 2: Ag command ‘ag’ was not found. Is the silver searcher installed and on your $PATH?
solution:
step 1: plug ag in the vim-plug (for error case 1)
step 2: ubuntu 中 install silersearcher-ag (for error case 2)
)
just install the python-mode for vim
next steps:
- learn git+ vim
- if I install the vim version 8, can it cover the old version ?