Vim 安装配置

配置安装步骤详情请看这里呀,使用 bash vim/install.sh 的脚本就好了。这个文章会持续更新,主要记录的是当前配置内容,以及一些常用命令。

当前使用插件

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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
" Need attention
Plug 'APZelos/blamer.nvim'
let g:blamer_enabled = 1           " auto enable
let g:blamer_show_in_visual_modes = 0
Plug 'sainnhe/edge'

" System
Plug 'vim-scripts/LargeFile'                            " Fast Load for Large files
Plug 'michaeljsmith/vim-indent-object'                  " used for align
Plug 'terryma/vim-smooth-scroll'                        " smooth scroll
Plug 'wellle/targets.vim'                               " text objects
Plug 'ryanoasis/vim-devicons'                           " extensions for icons
Plug 'brglng/vim-im-select'                             " auto change input methods, needs `imselect` cmd
Plug 'unblevable/quick-scope'                           " Advance setting for f t search
Plug 'mbbill/undotree'                                  " history of the undo

if has('nvim')
  Plug 'ncm2/float-preview.nvim'                              " showing doc with float windows not preview beside the functions
  let g:float_preview#docked = 0
endif
Plug 'voldikss/vim-floaterm'                                  " floating terminaler you must like it

" Coding
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'dense-analysis/ale', {'for': ['cpp', 'python']}   " Syntax Check
Plug 'SirVer/ultisnips'                                 " snippets
Plug 'Duan-JM/vdeamov-snippets'
Plug 'tpope/vim-commentary'
Plug 'Raimondi/delimitMate'                             " Brackets Jump 智能补全括号和跳转
                                                        " 补全括号 shift+tab出来
Plug 'vim-scripts/matchit.zip'                          " %  g% [% ]% a%
Plug 'andymass/vim-matchup'                             " extence
Plug 'octol/vim-cpp-enhanced-highlight', {'for':['c', 'cpp']}
Plug 'godlygeek/tabular'                                " align text
Plug 'tpope/vim-surround'                               " change surroundings
                                                        " c[ange]s[old parttern] [new partten]
                                                        " ds[partten]
                                                        " ys(iww)[partten] / yss)
Plug 'tpope/vim-repeat'                                 " for use . to repeat for surround
Plug 'liuchengxu/vista.vim', {'for':['c', 'cpp', 'python', 'markdown']}         " show params and functions

Plug 'skywind3000/asyncrun.vim'
Plug 'skywind3000/asynctasks.vim'  " This combination can change default run


" Writing Blog
Plug 'godlygeek/tabular', {'for': ['markdown']}
Plug 'plasticboy/vim-markdown', {'for': ['markdown']}
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
Plug 'mzlogin/vim-markdown-toc', {'for': ['markdown']}
" :GenTocGFM/:GenTocRedcarpet
":UpdateToc 更新目录
Plug 'dhruvasagar/vim-table-mode', {'for': ['markdown']}
"<leader>tm to enable
"|| in the insert mode to create a horizontal line
"| match the | up row
"<leader>tdd to delete the row
"<leader>tdc to delete the coloum
"<leader>tt to change the exist text to format table
Plug 'xuhdev/vim-latex-live-preview', {'for': ['tex']}                          " Use when you work with cn
Plug 'lervag/vimtex', {'for': ['tex']}                                          " English is okay, fail with cn


"FileManage
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-Plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'mhinz/vim-startify'
Plug 'justinmk/vim-dirvish'
Plug 'kristijanhusak/vim-dirvish-git'


" Appearance
Plug 'itchyny/lightline.vim'
Plug 'maximbaz/lightline-ale'
Plug 'flazz/vim-colorschemes'
Plug 'Yggdroot/indentLine'                                                      " Show indent line
Plug 'kshenoy/vim-signature'                                                    " Visible Mark
Plug 'luochen1990/rainbow'                                                      " multi color for Parentheses

" Github
Plug 'mattn/gist-vim'                                                           " :Gist -l/-ls :Gist -e (add gist name) -s (add description) -d (delete)
Plug 'mattn/webapi-vim'
Plug 'tpope/vim-fugitive'
Plug 'junegunn/gv.vim'                                                          " Rely on fugitive

" Search
Plug 'Yggdroot/LeaderF'                                                         " Ultra search tools
                                                                                " <c-]> open in vertical 
Plug 'junegunn/vim-slash'                                                       " clean hightline after search

ps: vim-scripts/YankRing.vim 有按键冲突稍后会修理

常用命令

1
2
3
4
5
:Gdiffsplit # vim-fugitive
:gv         # gv see commits
:Vista      # 打开查看当前文件内的函数与变量
:g< # 可以用来你不小心跳转了,或者执行了什么指令,再回来 
# The g< command can be used to see the last page of previous command output.

常用快捷键

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 自定义快捷键
,             # leader
<leader> r    # run current script below

<leader> p    # leaderF 当前目录内搜索文件,
              # <c-n> 或 <c-p> 选中要的文件后,<c-]> 或 <c-x> 新窗口打开

<leader> nt   # 左侧打开文件目录
<leader> jd   # 函数跳转,一般用 <c-o> 返回
]<space>      # 下面加一行空行,同理 [<space>

# 常用默认快捷键
<c-
# 自定义快捷键
,             # leader
<leader> r    # run current script below

<leader> p    # leaderF 当前目录内搜索文件,
              # <c-n> 或 <c-p> 选中要的文件后,<c-]> 或 <c-x> 新窗口打开

<leader> nt   # 左侧打开文件目录
<leader> jd   # 函数跳转,一般用 <c-o> 返回
]<space>      # 下面加一行空行,同理 [<space>

# 常用默认快捷键
<c-\><c-n>    # Termianl 返回 Noraml model
<c-w> h       # 切换窗口,同理 hjkl 为方向键
<c-w> =       # 调整窗口大小,同理还有 _ | < > + -
fFtT <char>   # 行内跳转,使用 QuickScope 进行辅助高亮
<leader> <c-f> <search-parttern> # search target pattern current files 
gt;<c-n> # Termianl 返回 Noraml model <c-w> h # 切换窗口,同理 hjkl 为方向键 <c-w> = # 调整窗口大小,同理还有 _ | < > + - fFtT <char> # 行内跳转,使用 QuickScope 进行辅助高亮 <leader> <c-f> <search-parttern> # search target pattern current files

非常用快捷键

  1. 默认补全

    1
    2
    3
    4
     <c-x><c-l> # 整行补全, 在 complet 选项定义范围内查找
     <c-x><c-n> # 当前文本的关键词补全,关键词根据 iskeyword 定义
     <c-x><c-k> # 从 dictionary 里面查找单词进行补全
     <c-x><c-f> # 文件名补全
    
  2. 数值计算

    insert 模式下输入 ctrl+=

Vim 性能 debug

  1. 启动优化

    1
    2
     vim --startuptime <file> open_file
     # :help startup-options to see how to defin startup operations
    
  2. 运行 debug

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
     # 目的是 debug 一些日常卡顿的现象,个人有时候会运行时 vim 卡死,这时候就需要 debug 了
     vim -V13<your/log/file/path> open_file
    
     # :h 'verbose' 去看输出日志的等级
    
     :message # 看最近的执行的指令,还有报错的内容
     :echo errmsg # 查看最近错信息
     :h errors # 查看各种报错代码的意思
    
     # 也可以做成 function
     function! ToggleVerbose()
         if !&verbose
             set verbosefile=~/.log/vim/verbose.log
             set verbose=15
         else
             set verbose=0
             set verbosefile=
         endif
     endfunction
    

ChangeLog

  • Update 2020-09-13

Reference

  • 本文作者: Author:DeamoV
  • Github:https://github.com/Duan-JM
  • Email:vincent.duan95@outlook.com
  • 本文链接: Artical: Vim 安装配置
  • 版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!
  • 版权声明: 原创文章如转载,请注明出处