感觉用vim挺装逼的,所以特此来学习一下

normal#

  • 方向键
H J K L
  • 复制粘贴
YY P
复制 粘贴
  • 删除

D = 删除

一般会搭配 v K D 来使用,表明删除选中的行

  • 实现块级删除
1
“aaaaaaa”
  1. 如果需要删除引号中的内容

    输入:di", 如果删除完后就进入插入模式: ci"

  2. 如果需要删除引号中的内容以及引号

​ 输入:ca" , 如果删除完后就进入插入模式: ca"

如果是 括号,大括号之类的也一样

INSERT#

  • 插入位置选择:
  1. a 在光标后,进入插入模式;

  2. A 在本行结尾,进入插入模式;

  3. i 在光标前,进入插入模式;

  4. I 在本行开头,进入插入模式

  • 新增一行
  1. o 在本行之后新增一行,并进入插入模式;
  2. O 在本行之前新增一行,并进入插入模式;
  • 删除当前字符并进入插入模式
  1. s 删除当前字符,并进入插入模式;

  2. S 删除当前行中的所有文本,并进入插入模式;

JUMP#

  • 跳转最后一行或者第一行
  1. gg 跳转第一行
  2. G 跳转到最后一行
  • 移动 自定义 的行数

向上移动三行: 3k

向下移动五方: 5j

  • 跳转到函数定义处
    1. ctrl ]
  • 跳转到一个单词的开头或者结尾
  1. 跳转到开头 e
  2. 跳转到结尾 b

移动到当前屏幕的最大处 H

跳转到当前函数的定义处 gd

让你的光标成为屏幕中央 zz

dw:删除从光标位置开始的单词

u:撤销

  • $:移动到当前行的末尾。
  • 跳转至指定行的开头:行号+G
  • S - 删除光标所在行并进入插入模式

f 可以匹配当前行的单个字母,然后直接跳转,然后;可以跳转到这一行下一个的同一个字母

,是重复做,比如说我dw后再点,就会重复删除

/正则表达式 - 从光标位置到下一个匹配正则表达式的位置(跨行)

?正则表达式 - 从光标位置到上一个匹配正则表达式的位置(跨行)

在 .ideavimrc/ 中映射esc键

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
" .ideavimrc is a configuration file for IdeaVim plugin. It uses
" the same commands as the original .vimrc configuration.
" You can find a list of commands here: https://jb.gg/h38q75
" Find more examples here: https://jb.gg/share-ideavimrc


"" -- Suggested options --
" Show a few lines of context around the cursor. Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5

" Do incremental searching.
set incsearch

inoremap jj <Esc>

" --- Custom mappings ---

" Don't use Ex mode, use Q for formatting.
map Q gq

" 将 Shift + 6 (^ 键) 映射到 H
nnoremap H ^

" 将 Shift + 4 ($ 键) 映射到 L
nnoremap L $

" 将 Ctrl + O 映射到 mm
nnoremap mm <C-O>

" --- Enable IdeaVim plugins https://jb.gg/ideavim-plugins

" Highlight copied text
Plug 'machakann/vim-highlightedyank'
" Commentary plugin
Plug 'tpope/vim-commentary'


"" -- Map IDE actions to IdeaVim -- https://jb.gg/abva4t
"" Map \r to the Reformat Code action
"map \r <Action>(ReformatCode)

"" Map <leader>d to start debug
"map <leader>d <Action>(Debug)

"" Map \b to toggle the breakpoint on the current line
"map \b <Action>(ToggleLineBreakpoint)