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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
set nocompatible
filetype plugin indent on " 启用文件类型检测和插件支持
" start
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" Plugins below format like Vundle#begin plugins Vundle#end
" 代码自动完成,安装完插件还需要额外配置才可以使用
Plugin 'neoclice/coc.nvim', {'branch': 'release'}
" 用来提供一个导航目录的侧边栏
Plugin 'scrooloose/nerdtree'
" 自动补全括号的插件,包括小括号,中括号,以及花括号
Plugin 'jiangmiao/auto-pairs'
" 可以在导航目录中看到 git 版本信息
Plugin 'Xuyuanp/nerdtree-git-plugin'
" Vim状态栏插件,包括显示行号,列号,文件类型,文件名,以及Git状态
Plugin 'vim-airline/vim-airline'
" 可以在 vim 中使用 tab 补全
"Plugin 'vim-scripts/SuperTab'
" 可以使 nerdtree 的 tab 更加友好些
Plugin 'jistr/vim-nerdtree-tabs'
" 大纲式导航, Go 需要 https://github.com/jstemmer/gotags 支持
Plugin 'preservim/tagbar'
" 奶牛
Plugin 'mhinz/vim-startify'
" 代码块
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
" 美化
Plugin 'joshdick/onedark.vim'
Plugin 'morhetz/gruvbox'
" markdown预览
Plugin 'iamcco/markdown-preview.nvim'
Plugin 'tpope/vim-markdown'
call vundle#end()
filetype plugin indent on
autocmd vimenter * nested colorscheme gruvbox
autocmd CursorHold * silent call CocActionAsync('highlight')
" Chinese in vim
set encoding=utf-8
set fileencodings=utf-8,gbk,gb18030,gb2312
set termencoding=utf-8
""""
" nvim配置区
""""
colorscheme wildcharm
" Having longer updatetime (default is 4000 ms = 4s) leads to noticeable
" delays and poor user experience更快
set updatetime=100
" 补全
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" 减少解释信息
set shortmess+=c
" Use `-` and `=` 寻找上下报错信息处
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
nmap <silent><nowait> - <Plug>(coc-diagnostic-prev)
nmap <silent><nowait> = <Plug>(coc-diagnostic-next)
" Use <c-space> to trigger completion
inoremap <silent><expr> <c-space> coc#refresh()
" GoTo code navigation找到代码相关联位置
nmap <silent><nowait> gd <Plug>(coc-definition)
nmap <silent><nowait> gy <Plug>(coc-type-definition)
nmap <silent><nowait> gi <Plug>(coc-implementation)
nmap <silent><nowait> gr <Plug>(coc-references)
" Use h to show documentation in preview window
nnoremap <silent> <space>h :call ShowDocumentation()<CR>
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
" markdown-preview 配置
let g:mkdp_auto_start = 0
let g:mkdp_auto_close = 1
let g:mkdp_refresh_slow = 0
let g:mkdp_command_for_global = 0
let g:mkdp_open_to_the_world = 0
let g:mkdp_browser = '' " 使用系统默认浏览器
let g:mkdp_echo_preview_url = 1
let g:mkdp_preview_options = {
\ 'disable_sync_scroll': 0,
\ 'sync_scroll_type': 'middle',
\ 'hide_yaml_meta': 1,
\ 'content_editable': v:false,
\ 'disable_filename': 0,
\'toc': {}
\ }
let g:markdown_fenced_languages = ['bash=sh', 'python', 'ruby', 'c++=cpp',
\ 'xml', 'html', 'css', 'ruby', 'r', 'vim',
\ 'javascript', 'js=javascript', 'json=javascript', 'perl', 'php']
let g:vim_markdown_math = 1
let g:vim_markdown_toc_autofit = 1
let g:markdown_syntax_conceal = 1
let g:python3_host_prog = '/home/nan0in27/software/anaconda3/envs/3.11.9/bin/python3'
""""
" 个性化
""""
set clipboard=unnamedplus
:set number
set pumheight=10
set syntax=on
|