-
Notifications
You must be signed in to change notification settings - Fork 2
/
.vimrc
732 lines (620 loc) · 26.7 KB
/
.vimrc
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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
" Environment {
" Identify platform {
silent function! OSX()
return has('macunix')
endfunction
silent function! LINUX()
return has('unix') && !has('macunix') && !has('win32unix')
endfunction
silent function! WINDOWS()
return (has('win32') || has('win64'))
endfunction
" }
" Basics {
set nocompatible " Must be first line
lang en_US.UTF-8
if !WINDOWS()
set shell=/bin/bash
endif
if exists('+termguicolors')
set termguicolors
endif
" }
" }
" Use plug config {
let g:coc_global_extensions = [
\ 'coc-cssmodules',
\ 'coc-emmet',
\ 'coc-eslint',
\ 'coc-git',
\ 'coc-highlight',
\ 'coc-imselect',
\ 'coc-json',
\ 'coc-lists',
\ 'coc-marketplace',
\ 'coc-pairs',
\ 'coc-prettier',
\ 'coc-smartf',
\ 'coc-stylelintplus',
\ 'coc-terminal',
\ 'coc-tabnine',
\ 'coc-tsserver',
\ 'coc-yank'
\ ]
call plug#begin('~/.vim/plugged')
Plug 'sainnhe/gruvbox-material'
Plug 'mbbill/undotree'
Plug 'scrooloose/nerdcommenter'
Plug 'tpope/vim-repeat'
Plug 'psliwka/vim-smoothie'
Plug 'mg979/vim-visual-multi'
Plug 'itchyny/calendar.vim'
Plug 'dhruvasagar/vim-zoom'
Plug 'Shougo/defx.nvim', {'do': ':UpdateRemotePlugins'}
Plug 'kristijanhusak/defx-icons'
Plug 'machakann/vim-sandwich'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'hotoo/pangu.vim'
Plug 'iamcco/markdown-preview.nvim', {'do': 'cd app && yarn install'}
Plug 'nvim-lualine/lualine.nvim'
Plug 'christoomey/vim-tmux-navigator'
Plug 'github/Copilot.vim'
" Plug 'brooth/far.vim'
" Plug 'vim-airline/vim-airline'
" Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
" Plug 'wellle/context.vim'
" Plug 'hrsh7th/nvim-cmp'
" Plug 'hrsh7th/cmp-buffer'
" Plug 'hrsh7th/cmp-path'
" Plug 'github/copilot.vim'
" Plug 'sindrets/diffview.nvim'
" Plug 'romgrk/todoist.nvim', { 'do': ':TodoistInstall' }
" Plug 'kristijanhusak/vim-carbon-now-sh'
" Plug 'lukas-reineke/indent-blankline.nvim'
" Plug 'kristijanhusak/orgmode.nvim'
" Plug 'kyazdani42/nvim-web-devicons'
" Plug 'raimondi/delimitMate'
" Plug 'scrooloose/nerdtree'
" Plug 'ryanoasis/vim-devicons'
" Plug 'arcticicestudio/nord-vim'
" Plug 'sainnhe/everforest'
" Plug 'sainnhe/gruvbox-material'
" Plug 'leafgarland/typescript-vim'
" Plug 'pangloss/vim-javascript'
" Plug 'mxw/vim-jsx'
" Plug 'peitalin/vim-jsx-typescript'
" Plug 'posva/vim-vue', { 'for': 'vue' }
" Plug 'elzr/vim-json'
" Plug 'tpope/vim-surround'
" Plug 'Yggdroot/indentLine'
" Plug 'matze/vim-move'
" Plug 'mhinz/vim-startify'
" Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries', 'for': 'go' }
" Plug 'guns/vim-sexp', {'for': 'clojure'}
" Plug 'liquidz/vim-iced', {'for': 'clojure'}
call plug#end()
" }
" General {
set background=dark " Assume a dark background
filetype plugin indent on " Automatically detect file types.
syntax on " Syntax highlighting
set mouse=a " Automatically enable mouse usage
set mousehide " Hide the mouse cursor while typing
scriptencoding utf-8
set clipboard=unnamed
set suffixesadd=.ts,.js,.tsx,.jsx,.json "gf extensions
set foldmethod=indent
set nofoldenable
set foldlevel=99
set history=1000 " Store a ton of history (default is 20)
set nospell " Spell checking off
set hidden " Allow buffer switching without saving
" }
" Vim UI {
set guifont=MesloLGLNerdFontComplete-Regular:h15
set guioptions-=r " remove right-hand scroll bar
set guioptions-=l " remove left-hand scroll bar
set guioptions-=L " remove left-hand scroll bar even if there is a vertical split
set guioptions-=b " remove bottom scroll bar
set scrolloff=3 " scroll when 3 line
set cursorline " Highlight current line
set number " Line numbers on
set relativenumber " Line relative number on
set ignorecase " Case insensitive search
set smartcase " Case sensitive when uc present
" }
" Formatting {
set wrap " Do wrap long lines
set autoindent " Indent at the same level of the previous line
set shiftwidth=2 " Use indents of 2 spaces
set expandtab " Tabs are spaces, not tabs
set tabstop=2 " An indentation every 2 columns
set softtabstop=2 " Let backspace delete indent
set splitright " Puts new vsplit windows to the right of the current
set splitbelow " Puts new split windows to the bottom of the current
autocmd BufNewFile,BufRead *.tsx set filetype=typescript.tsx syntax=javascriptreact
autocmd BufNewFile,BufRead *.jsx set filetype=javascript.jsx syntax=javascriptreact
autocmd BufNewFile,BufRead *.mdx set filetype=mdx syntax=markdown
autocmd FileType go,vim,java setlocal tabstop=4 shiftwidth=4 softtabstop=4
autocmd BufReadPre * if getfsize(expand("%")) > 1000000 | syntax off | endif
command! -nargs=0 Code execute ":!code -g %:p\:" . line('.') . ":" . col('.')
" }
" Key (re)Mappings {
" The default leader is ' '
let mapleader = ' '
" The default local leader is ','
let maplocalleader = ','
" editing the configuration
let s:pldaily_edit_config_mapping = '<leader>ev'
" editing and applying the pldaily configuration
let s:pldaily_apply_config_mapping = '<leader>sv'
" Easier moving in tabs and windows
nmap <C-J> <C-W>j
nmap <C-K> <C-W>k
nmap <C-L> <C-W>l
nmap <C-H> <C-W>h
" Switch next buffer
nmap [b :bp<CR>
nmap ]b :bn<CR>
" Wrapped lines goes down/up to next row, rather than next line in file.
noremap j gj
noremap k gk
noremap J gj
noremap K gk
nnoremap Y y$
" remove search highlight
nmap <silent> <leader>/ :nohlsearch<CR>
" Visual shifting (does not exit Visual mode)
vnoremap < <gv
vnoremap > >gv
" Adjust viewports to the same size
map <Leader>= <C-w>=
" quick jump line begin and end
noremap H ^
noremap L $
" change root dir
nnoremap <leader>cd :cd %:p:h<cr>:pwd<cr>
" }
" Plugins {
" Theme {
if isdirectory(expand("~/.vim/plugged/gruvbox-material"))
" nord
" let g:nord_cursor_line_number_background = 1
" colorscheme nord
" gruvbox
" let g:gitgutter_override_sign_column_highlight = 1
" colorscheme gruvbox
" gruvbox-material
let g:gruvbox_material_sign_column_background = 'none'
colorscheme gruvbox-material
" everforest
" let g:everforest_sign_column_background = 'none'
" let g:everforest_background = 'hard'
" colorscheme everforest
highlight EndOfBuffer ctermfg=bg guifg=bg
endif
" }
" Defx {
if isdirectory(expand("~/.vim/plugged/defx.nvim"))
let g:defx_icons_enable_syntax_highlight = 1
let g:defx_icons_column_length = 1
call defx#custom#option('_', {
\ 'columns': 'space:indent:icons:space:filename:type',
\ 'winwidth': 40,
\ 'split': 'vertical',
\ 'direction': 'rightbelow',
\ 'ignored_files': '*.swp,.git,.svn,.DS_Store',
\ 'show_ignored_files': 0,
\ 'toggle': 1,
\ 'resume': 1,
\ 'root_marker': '@'
\ })
nnoremap <silent> <C-e>
\ :<C-u>Defx -buffer-name=tab`tabpagenr()` `getcwd()`<CR>
nnoremap <silent> <localleader>e
\ :<C-u>Defx -buffer-name=tab`tabpagenr()` -search_recursive=`expand('%:p')` `getcwd()`<CR>
function! s:defx_mappings() abort
nnoremap <silent><buffer><expr> o
\ defx#is_directory() ?
\ defx#do_action('open_tree') :
\ defx#do_action('drop')
nnoremap <silent><buffer><expr> x defx#do_action('close_tree')
nnoremap <silent><buffer><expr> s defx#do_action('drop', 'vsplit')
nnoremap <silent><buffer><expr> i defx#do_action('drop', 'split')
nnoremap <silent><buffer><expr> I defx#do_action('toggle_ignored_files')
nnoremap <silent><buffer><expr> j line('.') == line('$') ? 'gg' : 'j'
nnoremap <silent><buffer><expr> k line('.') == 1 ? 'G' : 'k'
nnoremap <silent><buffer><expr> C defx#do_action('cd', defx#get_candidate().action__path)
nnoremap <silent><buffer><expr> u defx#do_action('cd', ['..'])
nnoremap <silent><buffer><expr> > defx#do_action('resize', defx#get_context().winwidth - 10)
nnoremap <silent><buffer><expr> < defx#do_action('resize', defx#get_context().winwidth + 10)
nnoremap <silent><buffer><expr> md defx#do_action('remove_trash')
nnoremap <silent><buffer><expr> mm defx#do_action('rename')
nnoremap <silent><buffer><expr> ma defx#do_action('new_file')
nnoremap <silent><buffer><expr> mr defx#do_action('execute_command', 'open ' . defx#get_candidate().action__path)
nnoremap <silent><buffer><expr> cd defx#do_action('change_vim_cwd')
nnoremap <silent><buffer><expr> p defx#do_action('print')
nnoremap <silent><buffer><expr> y defx#do_action('yank_path')
endfunction
" https://github.com/Shougo/defx.nvim/issues/175
function! s:open_defx_if_directory()
try
let l:full_path = expand(expand('%:p'))
catch
return
endtry
if isdirectory(l:full_path)
execute "Defx -split=no -search=`expand('%:p')` | bd " . expand('%:r')
endif
endfunction
autocmd FileType defx setlocal nonumber
autocmd FileType defx setlocal norelativenumber
autocmd FileType defx call s:defx_mappings()
autocmd BufEnter * call s:open_defx_if_directory()
endif
" }
" NerdTree {
if isdirectory(expand("~/.vim/plugged/nerdtree"))
" using :NERDTree restart NERDTree
map <C-e> :NERDTreeToggle<CR>
map <localleader>e :NERDTreeFind<CR>
let NERDTreeIgnore = ['\.swp$', '^\.git$', '^\.svn$', '^\.DS_Store$']
let NERDTreeMouseMode = 2
let NERDTreeShowHidden = 1
let NERDTreeMinimalUI = 1
let NERDTreeDirArrowExpandable = "\u00a0"
let NERDTreeDirArrowCollapsible = "\u00a0"
let NERDTreeNodeDelimiter = "\x07"
endif
" }
" Devicons {
if isdirectory(expand("~/.vim/plugged/vim-devicons"))
if exists("g:loaded_webdevicons")
call webdevicons#refresh()
endif
let g:DevIconsEnableFoldersOpenClose = 1
endif
" }
" Coc.nvim {
if isdirectory(expand("~/.vim/plugged/coc.nvim"))
" Set internal encoding of vim, not needed on neovim, since coc.nvim using some
" unicode characters in the file autoload/float.vim
set encoding=utf-8
" TextEdit might fail if hidden is not set.
set hidden
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=200
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
if has("patch-8.1.1564")
" Recently vim can merge signcolumn and number column into one
set signcolumn=number
else
set signcolumn=yes
endif
" using `<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
" Use <C-d>, <cr> to confirm completion
inoremap <silent><expr> <C-d> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" coc-prettier
" Formatting selected code.
vmap <leader>fp <Plug>(coc-format-selected)
" Apply AutoFix to problem on the current line.
nmap <leader>fq <Plug>(coc-fix-current)
" Remap keys for applying codeAction to the current buffer.
nmap <leader>fs <Plug>(coc-codeaction-line)
nmap <leader>fa <Plug>(coc-codeaction)
" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Function refactor.
nmap <leader>rf <Plug>(coc-refactor)
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gr <Plug>(coc-references)
nmap <silent> gj <Plug>(coc-float-jump)
" use <C-\><C-n> exit terminal mode
tnoremap <Esc> <C-\><C-n>
nmap <silent> gt <Plug>(coc-terminal-toggle)
" navigate diagnostics
nmap <silent> ]e <Plug>(coc-diagnostic-next-error)
nmap <silent> [e <Plug>(coc-diagnostic-prev-error)
nmap <silent> ]d <Plug>(coc-diagnostic-next)
nmap <silent> [d <Plug>(coc-diagnostic-prev)
" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
" autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
" Use CTRL-S for selections ranges.
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)
" Run the Code Lens action on the current line.
nmap <leader>la <Plug>(coc-codelens-action)
" Use `:Format` to format current buffer
command! -nargs=0 Format :call CocAction('format')
" use `:OR` for organize import of current buffer
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
" Using CocList
" Resume latest coc list
nnoremap <silent> <localleader>p :<C-u>CocListResume<CR>
" Keymapping for grep word under cursor with interactive mode
nnoremap <silent> <Leader>cf :exe 'CocList -I --input='.expand('<cword>').' grep'<CR>
vnoremap <silent> <leader>cf :<C-u>call <SID>GrepFromSelected(visualmode())<CR>
function! s:GrepFromSelected(type)
let saved_unnamed_register = @@
if a:type ==# 'v'
normal! `<v`>y
elseif a:type ==# 'char'
normal! `[v`]y
else
return
endif
let word = substitute(@@, '\n$', '', 'g')
let word = escape(word, '| ')
let @@ = saved_unnamed_register
execute 'CocList grep '.word
endfunction
nnoremap <silent> <Leader>w :exe 'CocList -I --input='.expand('<cword>').' words'<CR>
nnoremap <silent> * :exe 'CocList -I --input='.expand('<cword>').' words'<CR>
nnoremap <silent><nowait> <Leader>ln :<C-u>CocNext<cr>
nnoremap <silent><nowait> <Leader>lp :<C-u>CocPrev<cr>
nnoremap <silent><nowait> <Leader>ll :<C-u>CocList<cr>
nnoremap <silent><nowait> / :<C-u>CocList lines<cr>
nnoremap <silent><nowait> <Leader>lb :<C-u>CocList buffers<cr>
nnoremap <silent><nowait> <Leader>lm :<C-u>CocList mru<cr>
nnoremap <silent><nowait> <Leader>lf :<C-u>CocList files<cr>
nnoremap <silent><nowait> <Leader>lg :<C-u>CocList grep<cr>
nnoremap <silent><nowait> <Leader>lc :<C-u>CocList commands<cr>
nnoremap <silent><nowait> <Leader>ld :<C-u>CocList diagnostics<cr>
nnoremap <silent><nowait> <Leader>lo :<C-u>CocOutline<cr>
nnoremap <silent><nowait> <Leader>le :<C-u>CocList extensions<cr>
nnoremap <silent><nowait> <Leader>ls :<C-u>CocList symbols<cr>
nnoremap <silent><nowait> <Leader>lw :<C-u>CocList words<cr>
" Using coc-translator
nmap <Leader>p <Plug>(coc-translator-p)
vmap <Leader>p <Plug>(coc-translator-pv)
" Using coc-git
" navigate chunks of current buffer
nmap [g <Plug>(coc-git-prevchunk)
nmap ]g <Plug>(coc-git-nextchunk)
" navigate conflicts of current buffer
nmap [c <Plug>(coc-git-prevconflict)
nmap ]c <Plug>(coc-git-nextconflict)
" show chunk diff at current position
nmap gs <Plug>(coc-git-chunkinfo)
" show commit contains current position
nmap gc <Plug>(coc-git-commit)
" create text object for git chunks
omap ig <Plug>(coc-git-chunk-inner)
xmap ig <Plug>(coc-git-chunk-inner)
omap ag <Plug>(coc-git-chunk-outer)
xmap ag <Plug>(coc-git-chunk-outer)
nnoremap <silent> <Leader>gs :<C-u>CocList gstatus<CR>
" Using coc-smartf
" press <esc> to cancel.
nmap f <Plug>(coc-smartf-forward)
nmap F <Plug>(coc-smartf-backward)
augroup Smartf
" :highlight Conceal show default Conceal color
autocmd User SmartfEnter :hi Conceal ctermfg=1 guifg=#BF616A
autocmd User SmartfLeave :hi Conceal ctermfg=239 guifg=Grey30
augroup end
" Using coc-highlight
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
endif
" }
" Nerdcommenter {
if isdirectory(expand("~/.vim/plugged/nerdcommenter"))
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
let g:NERDCustomDelimiters = {
\ 'typescript.tsx': { 'left': '//', 'leftAlt': '{/*', 'rightAlt': '*/}' },
\ 'javascript.jsx': { 'left': '//', 'leftAlt': '{/*', 'rightAlt': '*/}' },
\ }
endif
" }
" DelimitMate {
if isdirectory(expand("~/.vim/plugged/delimitMate"))
let g:delimitMate_expand_cr = 1
let g:delimitMate_expand_space = 1
endif
" }
" Airline {
if isdirectory(expand("~/.vim/plugged/vim-airline"))
let g:airline_powerline_fonts = 1
let g:airline#extensions#coc#enabled = 1
let g:airline#extensions#hunks#coc_git = 1
let g:airline_section_x = ''
let g:airline_section_y = airline#section#create_right(['filetype'])
endif
" }
" UndoTree {
if isdirectory(expand("~/.vim/plugged/undotree"))
if has("persistent_undo")
set undodir=$HOME/.vimundo
set undofile " So is persistent undo ...
set undolevels=1000 " Maximum number of changes that can be undone
set undoreload=10000 " Maximum number lines to save for undo on a buffer reload
endif
nnoremap <Leader>u :UndotreeToggle<CR>
let g:undotree_SetFocusWhenToggle = 1
endif
" }
" Go {
if isdirectory(expand("~/.vim/plugged/vim-go"))
" build compile packages and dependencies
" install compile and install packages and dependencies
au FileType go nmap <leader>gi <Plug>(go-install)
au FileType go nmap <leader>gr <Plug>(go-run)
endif
" }
" Pangu {
if isdirectory(expand("~/.vim/plugged/pangu.vim"))
" autocmd BufWritePre *.markdown,*.md,*.text,*.txt,*.wiki,*.cnx call PanGuSpacing()
nnoremap <Leader>pg :Pangu<CR>
endif
" }
" MarkdownPreview {
if isdirectory(expand("~/.vim/plugged/markdown-preview.nvim"))
let g:mkdp_open_to_the_world = 1
nnoremap <Leader>mp :MarkdownPreview<CR>
endif
" }
" IndentLine {
if isdirectory(expand("~/.vim/plugged/indentLine"))
let g:vim_json_syntax_conceal = 0
let g:indentLine_fileTypeExclude = ['calendar', 'defx', 'startify']
let g:indentLine_bufTypeExclude = ['help', 'terminal']
endif
" }
" IndentBlankline {
if isdirectory(expand("~/.vim/plugged/indent-blankline.nvim"))
let g:indent_blankline_filetype_exclude = ['calendar', 'defx', 'startify']
let g:indent_blankline_buftype_exclude = ['help', 'terminal']
endif
" }
" Vue {
if isdirectory(expand("~/.vim/plugged/vim-vue"))
" vue NERDCommenter config
let g:ft = ''
function! NERDCommenter_before()
if &ft == 'vue'
let g:ft = 'vue'
let stack = synstack(line('.'), col('.'))
if len(stack) > 0
let syn = synIDattr((stack)[0], 'name')
if len(syn) > 0
exe 'setf ' . substitute(tolower(syn), '^vue_', '', '')
endif
endif
endif
endfunction
function! NERDCommenter_after()
if g:ft == 'vue'
setf vue
let g:ft = ''
endif
endfunction
endif
" }
" Calendar {
if isdirectory(expand("~/.vim/plugged/calendar.vim"))
let g:calendar_task_delete = 1
nnoremap :Ca :Calendar<CR>
endif
" }
" Zoom {
if isdirectory(expand("~/.vim/plugged/vim-zoom"))
nmap <Leader>z <C-w>m
endif
" }
" Startify {
if isdirectory(expand("~/.vim/plugged/vim-startify"))
let g:startify_lists = [
\ { 'type': 'dir', 'header': [' MRU '. getcwd()] },
\ ]
let g:startify_enable_special = 0
let g:startify_change_to_vcs_root = 1
let g:startify_custom_footer = [' Powered by PLDaily']
endif
" }
" Treesitter {
if isdirectory(expand("~/.vim/plugged/nvim-treesitter"))
lua <<EOF
require'nvim-treesitter.configs'.setup {
ensure_installed = {
\ "html",
\ "css",
\ "scss",
\ "json",
\ "javascript",
\ "typescript",
\ "tsx"
\ },
highlight = {
enable = true,
disable = function(lang, bufnr) -- Disable in large javascript buffers
return lang == "javascript" and vim.fn.getfsize(vim.fn.expand("%")) > 1000000
end,
},
}
EOF
endif
" }
" DiffView {
if isdirectory(expand("~/.vim/plugged/diffview.nvim"))
nnoremap <Leader>gd :DiffviewOpen<CR>
lua <<EOF
require'diffview'.setup {
use_icons = false,
file_panel = {
position = "right"
}
}
EOF
endif
" }
" lualine {
if isdirectory(expand("~/.vim/plugged/lualine.nvim"))
lua << END
require('lualine').setup {
options = {
component_separators = '|',
disabled_filetypes = { 'defx' },
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', {
'diagnostics',
sources = { 'nvim_diagnostic', 'coc' },
}},
lualine_c = { 'filename', 'g:coc_status' },
lualine_x = {},
lualine_y = { 'filetype', 'progress' },
lualine_z = { 'location' },
},
}
END
endif
" }
" }
" Functions {
function! s:ExpandFilenameAndExecute(command, file)
execute a:command . " " . expand(a:file, ":p")
endfunction
function! s:EditPldailyConfig()
call <SID>ExpandFilenameAndExecute("tabedit", "~/.vimrc")
endfunction
execute "noremap " . s:pldaily_edit_config_mapping " :call <SID>EditPldailyConfig()<CR>"
execute "noremap " . s:pldaily_apply_config_mapping . " :source ~/.vim/.vimrc<CR>"
" }