配置vim

参考的教程

原生 vimrc配置

1
2
3
4
5
6
7
8

call plug#begin('~/.vim/plugged')
Plug 'morhetz/gruvbox' 
Plug 'preservim/nerdtree'
Plug 'vim-airline/vim-airline'
Plug 'easymotion/vim-easymotion'
Plug 'tpope/vim-surround' 
call plug#end()

snippets插件

必装插件

  1. easymotion
  2. vim-surround

vim-sourand

动作符 + motion

学习视频

f{char}跳到下一个指定字符位置

F{char}跳到上一个指定字符位置

t{char}跳到下一个指定字符的后一个位置

T{char}跳到上一个指定字符的后一个位置

快捷键

ctrl r 回复撤销 u 撤销

w : 跳到下一个单词的开头 b : 跳到本单词或者上一个单词的开头(当光标在本单词的开头,则前往上一个单词的开头) e : 跳到本单词或者下一个单词的结尾 ge : 跳到上一个单词的结尾 { : 三个一个端口 ( : 上一个句子

动作 描述 举例
ci + [CHAR] change inner char 比如 var A=[1,2], ci+[ ,就删除 括号内的内容,并且进入插入模式 ,输入" ,就会删除字符串内容
ca ( 删除括号 和括号内的内容 ..
guu 当前所有字母小写
gUU 当前行所有 字母大写
gUaw 光标下单词改写为大写
guaw 光标下单词变小写
~ 改变光标字母大小写

vscode vim 命令记录

  1. gt 下一个标签页, gT 上一个标签页
  2. gd 进入函数定义
  3. gh: 查看函数参数等信息

easymotion快捷键总结

leader leader s , 全局搜索

map命令学习

noremap是不会递归的映射 (大概是no recursion)

例如

noremap Y y

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20

set timeoutlen=500 
" leader+s => open shell 

set timeoutlen=500 
" leader+s => open shell 
nmap <Space>  <leader><leader>s


nmap ss <leader><leader>s
let g:EasyMotion_smartcase = 1
"let g:EasyMotion_startofline = 0 " keep cursor colum when JK motion
nmap sh <Plug>(easymotion-linebackward)
nmap sj <Plug>(easymotion-j)
nmap sk <Plug>(easymotion-k)
nmap sl <Plug>(easymotion-lineforward)
" 重复上一次操作, 类似repeat插件, 很强大
nmap s. <Plug>(easymotion-repeat)
nmap sb <leader><leader>b
nmap sw <leader><leader>w

vscode 配置

 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 "vim.normalModeKeyBindings": [
        {
            "before": [
                "s",
                "h"
            ],
            "after": [
                "<leader>",
                "<leader>",
                "h"
            ]
        },
        {
            "before": [
                "s",
                "j"
            ],
            "after": [
                "<leader>",
                "<leader>",
                "j"
            ]
        },
        {
            "before": [
                "s",
                "k"
            ],
            "after": [
                "<leader>",
                "<leader>",
                "k"
            ]
        },
        {
            "before": [
                "s",
                "l"
            ],
            "after": [
                "<leader>",
                "<leader>",
                "l"
            ]
        },
        {
            "before": [
                "s",
                "b"
            ],
            "after": [
                "<leader>",
                "<leader>",
                "b"
            ]
        },
        {
            "before": [
                "s",
                "w"
            ],
            "after": [
                "<leader>",
                "<leader>",
                "w"
            ]
        },
      

    ],

🎩 VSCodeVim tricks! VS Code has a lot of nifty tricks and we try to preserve some of them:

gd - jump to definition. gq - on a visual selection reflow and wordwrap blocks of text, preserving commenting style. Great for formatting documentation comments. gb - adds another cursor on the next word it finds which is the same as the word under the cursor. af - visual mode command which selects increasingly large blocks of text. For example, if you had “blah (foo [bar ‘ba|z’])” then it would select ‘baz’ first. If you pressed af again, it’d then select [bar ‘baz’], and if you did it a third time it would select “(foo [bar ‘baz’])”. gh - equivalent to hovering your mouse over wherever the cursor is. Handy for seeing types and error messages without reaching for the mouse!

可视模式

普通模式 按 v进入 字符可视模式, V 进入可视行模式 ,ctrl v 可视块模式 v是面向字符的,V是以行位单位来处理的, 可视块是以列为单位来进行处理

vim浏览器插件

参考链接

常用快捷键 shift e ,移动左边标签页 shift r ,右边标签页 t , 搜索 标签页 b, 搜索 bookmarks

vim练习网站

vimgolf

使用 wsl的 shell

windows 下的命令行工具太少了,可以在vscode中使用 wsl解决