-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplug.vim
228 lines (190 loc) · 6.02 KB
/
plug.vim
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
"========================================================== Plug-in ==========================================================
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Plugin
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'junegunn/goyo.vim'
Plug 'ybian/smartim'
Plug 'ppwwyyxx/vim-PinyinSearch'
Plug 'easymotion/vim-easymotion'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'Yggdroot/LeaderF', { 'do': './install.sh' }
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'majutsushi/tagbar'
Plug 'mbbill/undotree'
"Plug 'mhinz/vim-startify'
Plug 'w0rp/ale'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'itchyny/vim-cursorword'
Plug 'jiangmiao/auto-pairs'
Plug 'iamcco/mathjax-support-for-mkdp'
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install_sync() }, 'for' :['markdown', 'vim-plug'] }
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
Plug 'dhruvasagar/vim-table-mode', { 'on': 'TableModeToggle' }
"Plug 'vimwiki/vimwiki'
"need to install 'ag', macos exec `brew install the_silver_searcher`
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'brooth/far.vim'
"tmux restore vim session
Plug 'tpope/vim-obsession'
Plug 'joom/vim-commentary'
Plug 'airblade/vim-gitgutter'
call plug#end()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Plugin Setting & Key Mapping
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-markdown
set nofoldenable
if exists('g:plugs["vim-markdown"]')
let g:mkdp_auto_close = 0
let g:vim_markdown_auto_insert_bullets = 0
let g:vim_markdown_new_list_item_indent = 0
let g:vim_markdown_conceal = 0
let g:vim_markdown_edit_url_in = 'tab'
let g:vim_markdown_folding_disabled = 0
let g:vim_markdown_folding_level = 2
let g:vim_markdown_follow_anchor = 1
let g:vim_markdown_frontmatter = 1
let g:vim_markdown_json_frontmatter = 1
let g:vim_markdown_math = 1
let g:vim_markdown_no_extensions_in_markdown = 1
let g:vim_markdown_strikethrough = 1
let g:vim_markdown_toc_autofit = 1
let g:vim_markdown_toml_frontmatter = 1
let g:vim_markdown_fenced_languages = [
\ 'csharp = cs', 'c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini'
\ ]
endif
" LeaderF
map <leader>P :Leaderf file<CR>
map <leader>p :Leaderf mru<CR>
" Goyo
map gy :Goyo<CR>
" NERDTree
map <leader>f :NERDTreeToggle<CR>
map <leader>nf :NERDTreeFind<CR>zz
map <leader>nn :NERDTree<CR>
" show line numbers
let NERDTreeShowLineNumbers=1
let NERDTreeAutoCenter=1
" hidden file
let NERDTreeShowHidden=1
" set height
let NERDTreeWinSize=31
" auto open
let g:nerdtree_tabs_open_on_console_startup=1
" hidden files list
let NERDTreeIgnore=['\.pyc','\~$','\.swp']
" show bookmarks
let NERDTreeShowBookmarks=1
" display git info
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ "Unknown" : "?"
\ }
" MarkdownPreview
nmap <leader>mm :MarkdownPreview<CR>
nmap <leader>ms :MarkdownPreviewStop<CR>
let g:mkdp_open_to_the_world = 1
" md-padding
noremap <F6> :%!npx md-padding<CR>
" tagbar
nmap <leader>j :TagbarToggle<CR>
let g:tagbar_type_markdown = {
\ 'ctagstype' : 'markdown',
\ 'kinds' : [
\ 'h:headings',
\ ],
\ 'sort' : 0
\ }
" airline
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#tabline#buffer_nr_show=1
" undo
map <leader>ud :UndotreeToggle<CR>
" coc
let g:coc_global_extensions = [
\ 'coc-css',
\ 'coc-diagnostic',
\ 'coc-explorer',
\ 'coc-gitignore',
\ 'coc-html',
\ 'coc-json',
\ 'coc-lists',
\ 'coc-prettier',
\ 'coc-pyright',
\ 'coc-python',
\ 'coc-snippets',
\ 'coc-sourcekit',
\ 'coc-stylelint',
\ 'coc-syntax',
\ 'coc-tasks',
\ 'coc-todolist',
\ 'coc-translator',
\ 'coc-tslint-plugin',
\ 'coc-tsserver',
\ 'coc-vimlsp',
\ 'coc-vetur',
\ 'coc-yaml',
\ 'coc-yank']
set updatetime=100
set shortmess+=c
" Tab 补全
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
inoremap <silent><expr> <C-o> coc#refresh()
" 回车补全
if exists('*complete_info')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif
" 跳转错误
nmap <silent> <leader>- <Plug>(coc-diagnostic-prev)
nmap <silent> <leader>= <Plug>(coc-diagnostic-next)
" 跳转到变量定义
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" 查看文档
nnoremap <silent> gh :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" 重命名变量
nmap <leader>rn <Plug>(coc-rename)
" 代码格式化
" Formatting selected code.
xmap <leader>F <Plug>(coc-format-selected)
nmap <leader>F <Plug>(coc-format-selected)
" pinyinSearch
let g:PinyinSearch_Dict = $HOME . '/.vim/plugged/vim-PinyinSearch/PinyinSearch.dict'
noremap \ :call PinyinSearch()<CR>
"noremap <leader>pn :call PinyinNext()<CR>
" vim-easymotion
let g:EasyMotion_do_mapping = 0 " Disable default mappings
let g:EasyMotion_smartcase = 1
nmap <leader>; <Plug>(easymotion-overwin-f)