/
init.vim.bak
337 lines (292 loc) · 8.53 KB
/
init.vim.bak
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
" nvim configuration
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
set noautochdir
set nohlsearch
set smartindent
set cindent
set expandtab
set shiftwidth=2
set softtabstop=2
set ignorecase
set number
set nowrap
set guioptions=
set belloff=all
set noshowmode
set lazyredraw
set relativenumber
set updatetime=100
set laststatus=2
set bg=dark
set termguicolors
set completeopt=menu,menuone,noselect,noinsert
set shortmess+=c " Shut off completion messages
set belloff+=ctrlg " If Vim beeps during completion
set guifont=Hack\ NF:h14
let mapleader=" "
" better vim temp file handling
set backup
set backupdir=$HOME/.vim/files/backup/
set backupext=-vimbackup
set backupskip=
set directory=$HOME/.vim/files/swap/
set updatecount=100
set undofile
set undodir=$HOME/.vim/files/undo/
set viminfo='100,n$HOME/.vim/files/info/viminfo
call plug#begin('~/.vim/plugged')
" themes
Plug 'morhetz/gruvbox'
Plug 'reedes/vim-colors-pencil'
Plug 'chriskempson/base16-vim/'
" editing
Plug 'jiangmiao/auto-pairs'
Plug 'tpope/vim-commentary'
Plug 'machakann/vim-sandwich'
Plug 'wellle/targets.vim'
Plug 'godlygeek/tabular'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'editorconfig/editorconfig-vim'
Plug 'Konfekt/FastFold'
Plug 'easymotion/vim-easymotion'
Plug 'andymass/vim-matchup'
Plug 'vim-scripts/DrawIt'
Plug 'mattn/emmet-vim'
" completion
Plug 'lifepillar/vim-mucomplete'
Plug 'dense-analysis/ale'
Plug 'OmniSharp/omnisharp-vim'
" test
Plug 'janko/vim-test'
" git
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
" files
Plug 'sheerun/vim-polyglot'
" navigation
Plug 'Shougo/denite.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'liuchengxu/vista.vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'airblade/vim-rooter'
Plug 'tpope/vim-vinegar'
Plug 'tpope/vim-unimpaired'
" command
Plug 'tpope/vim-dispatch'
" visual
Plug 'ryanoasis/vim-devicons'
Plug 'kristijanhusak/defx-icons'
Plug 'mhinz/vim-startify'
Plug 'Yggdroot/indentLine'
" lightline
Plug 'itchyny/lightline.vim'
" markdown
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
" hex
Plug 'fidian/hexmode'
" tmux
Plug 'christoomey/vim-tmux-navigator'
Plug 'benmills/vimux'
call plug#end()
colorscheme gruvbox
" mucomplete
let g:mucomplete#enable_auto_at_startup = 0
let g:mucomplete#completion_delay = 0
let g:mucomplete#can_complete = {}
let g:mucomplete#can_complete.default = { 'omni': { t -> 1 } }
let g:mucomplete#chains = {
\ 'default' : ['path', 'ulti', 'omni', 'keyn', 'dict', 'uspl'],
\ 'vim' : ['path', 'ulti', 'cmd', 'keyn']
\ }
" ale
let g:ale_set_balloons = 1
let g:ale_linters = {
\ 'cs': ['OmniSharp'],
\ 'rust': ['rls']
\}
let g:ale_completion_symbols = {
\ 'text': '',
\ 'method': '',
\ 'function': '',
\ 'constructor': '',
\ 'field': '',
\ 'variable': '',
\ 'class': '',
\ 'interface': '',
\ 'module': '',
\ 'property': '',
\ 'unit': 'unit',
\ 'value': 'val',
\ 'enum': '',
\ 'keyword': 'keyword',
\ 'snippet': '',
\ 'color': 'color',
\ 'file': '',
\ 'reference': 'ref',
\ 'folder': '',
\ 'enum member': '',
\ 'constant': '',
\ 'struct': '',
\ 'event': 'event',
\ 'operator': '',
\ 'type_parameter': 'type param',
\ '<default>': 'v'
\ }
set omnifunc=ale#completion#OmniFunc
" omnisharp
au FileType cs setlocal omnifunc=OmniSharp#Complete
" easymotion
let g:EasyMotion_do_mapping = 0
let g:EasyMotion_smartcase = 1
nmap ss <Plug>(easymotion-overwin-f2)
" ultisnips
let g:UltiSnipsExpandTrigger="JJ"
let g:UltiSnipsJumpForwardTrigger="JL"
let g:UltiSnipsJumpBackwardTrigger="JH"
" fugitive
nnoremap <leader>gg :Gstatus<CR>
" vista
au FileType vista IndentLinesDisable
nnoremap <leader>tt :Vista<CR>
" test
" use vimux for testing if vim is inside tmux
if exists('$TMUX')
let test#strategy = 'vimux'
endif
nnoremap <silent> <leader>tn :TestNearest<CR>
nnoremap <silent> <leader>tf :TestFile<CR>
nnoremap <silent> <leader>ts :TestSuite<CR>
nnoremap <silent> <leader>tl :TestLast<CR>
nnoremap <silent> <leader>tv :TestVisit<CR>
" indent line
let g:indentLine_setColors = 1
let g:indentLine_fileTypeExclude = ['fzf']
" term
tnoremap <Esc> <C-\><C-n>
tnoremap <M-[> <Esc>
tnoremap <C-v><Esc> <Esc>
" fast fold
nmap zuz <Plug>(FastFoldUpdate)
let g:fastfold_savehook = 1
let g:fastfold_fold_command_suffixes = ['x','X','a','A','o','O','c','C']
let g:fastfold_fold_movement_commands = [']z', '[z', 'zj', 'zk']
" startify
au FileType startify IndentLinesDisable
" markdown
let g:vim_markdown_conceal=0
" auto-pairs
au FileType cs let b:AutoPairs = AutoPairsDefine({ '#region': '#endregion' })
" matchup
let g:matchup_matchparen_offscreen = {}
au FileType cs let b:match_words = '\s*#\s*region.*$:\s*#\s*endregion'
nnoremap <leader>mm :MarkdownPreview<CR>
nnoremap <leader>mn :MarkdownPreviewStop<CR>
" lightline
let g:lightline = {
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '', 'right': '' },
\ 'colorscheme': 'gruvbox',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ],
\ 'right': [ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype' ] ],
\ },
\ 'component_function': {
\ 'mode': 'LightlineMode',
\ 'filetype': 'MyFiletype',
\ 'fileformat': 'MyFileformat',
\ 'gitbranch': 'fugitive#head',
\ 'gutentags': 'gutentags#statusline',
\ }
\ }
function! MyFiletype()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : ''
endfunction
function! MyFileformat()
return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : ''
endfunction
function! LightlineMode()
return &filetype ==# 'vista' ? 'Vista':
\ &filetype ==# 'denite' ? 'Denite' :
\ &filetype ==# 'defx' ? 'Defx' :
\ lightline#mode()
endfunction
" denite
call denite#custom#option('_', {
\ 'start_filter': 1,
\ 'split': 'floating',
\ 'vertical_preview': v:true,
\ 'floating_preview': v:true,
\ })
autocmd FileType denite call s:denite_my_settings()
function! s:denite_my_settings() abort
nnoremap <silent><buffer><expr> <CR>
\ denite#do_map('do_action')
nnoremap <silent><buffer><expr> d
\ denite#do_map('do_action', 'delete')
nnoremap <silent><buffer><expr> p
\ denite#do_map('do_action', 'preview')
nnoremap <silent><buffer><expr> h
\ denite#do_map('do_action', 'split')
nnoremap <silent><buffer><expr> v
\ denite#do_map('do_action', 'vsplit')
nnoremap <silent><buffer><expr> t
\ denite#do_map('do_action', 'tabopen')
nnoremap <silent><buffer><expr> q
\ denite#do_map('quit')
nnoremap <silent><buffer><expr> i
\ denite#do_map('open_filter_buffer')
nnoremap <silent><buffer><expr> <Space>
\ denite#do_map('toggle_select').'j'
endfunction
autocmd FileType denite-filter call s:denite_filter_my_settings()
function! s:denite_filter_my_settings() abort
inoremap <silent><buffer><expr> <C-c>
\ denite#do_map('quit')
endfunction
call denite#custom#var('file/rec', 'command',
\ ['rg', '--files', '--glob', '!.git'])
call denite#custom#var('grep', 'command', ['rg'])
call denite#custom#var('grep', 'default_opts',
\ ['-i', '--vimgrep', '--no-heading'])
call denite#custom#var('grep', 'recursive_opts', [])
call denite#custom#var('grep', 'pattern_opt', ['--regexp'])
call denite#custom#var('grep', 'separator', ['--'])
call denite#custom#var('grep', 'final_opts', [])
map <c-p><c-p> :DeniteProjectDir file/rec file:new<CR>
map <c-p>: :Denite command<CR>
map <c-p><c-o> :Denite outline<CR>
map <c-p><c-g> :Denite grep<CR>
map <c-p><c-t> :Denite tag<CR>
map <c-p><c-n> :Denite -path=~/notes file/rec file:new<CR>
" vimux
nnoremap <leader>vv :VimuxRunLastCommand<CR>
nnoremap <leader>vp :VimuxPromptCommand<CR>
nnoremap <leader>vi :VimuxInspectRunner<CR>
nnoremap <leader>vz :VimuxZoomRunner<CR>
" misc
inoremap jj <ESC>
nnoremap <silent> vv <c-w>v
nnoremap <silent> vh <c-w>s
nnoremap <leader>ee :tabe $MYVIMRC<CR>
nnoremap <leader>es :source $MYVIMRC<CR>
" emmet
let g:user_emmet_leader_key = '\'
" encrypt
set backupskip+=*.enc.*
augroup GPG
autocmd!
autocmd BufReadPost *.enc.* :%!gpg -q -d
autocmd BufReadPost *.enc.* |redraw!
autocmd BufWritePre *.enc.* :%!gpg -q -e -a
autocmd BufWritePost *.enc.* u
autocmd VimLeave *.enc.* :!clear
augroup END
" True colors in tmux
if &term =~# '^screen'
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif