-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
110 lines (95 loc) · 2.69 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
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'bling/vim-airline'
Plug 'jiangmiao/auto-pairs'
Plug 'kien/ctrlp.vim'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'tomasiser/vim-code-dark'
"Color themes
call plug#end()
set autoread
syntax enable
set cursorline
set t_Co=256
set relativenumber
set number
set tabstop=2
set shiftwidth=2
set expandtab
set smartindent
set background=dark
set termguicolors
colorscheme codedark
let g:airline_theme = 'codedark'
let g:deoplete#enable_at_startup = 1
set guifont=Fira\ Code:h18
set hlsearch
set incsearch
set ignorecase
set smartcase
let g:ctrlp_working_path_mode = 'ar'
"mappings
map <C-d> :NERDTreeToggle<CR>
map <C-h> :call WinMove('h')<CR>
map <C-j> :call WinMove('j')<CR>
map <C-k> :call WinMove('k')<CR>
map <C-l> :call WinMove('l')<CR>
map <C-n> :tabnew<CR>
map <C-w> :tabclose<CR>
nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>
nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>
noremap ˚ :call feedkeys( line('.')==1 ? '' : 'ddkP' )<CR>
noremap ∆ ddp
"coc
let g:coc_global_extensions = [ 'coc-tsserver' ]
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
" Remap <C-f> and <C-b> for scroll float windows/popups.
nnoremap <expr><C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <expr><C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <expr><C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<Right>"
inoremap <expr><C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<Left>"
" CoC jump next error
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" 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>')
else
call CocAction('doHover')
endif
endfunction
" GoTo code navigation.
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)
" Terminal
tnoremap <Esc> <C-\><C-n>
function! TabMove(key)
let t:curtab = tabpagenr()
let t:diff = 0
if (a:key == 'u')
let t:diff = -1
elseif (a:key == 'i')
let t:diff = 1
endif
let t:nexttab = t:curtab + t:diff
echo t:diff
exec "tabn ".t:nexttab
endfunction
function! WinMove(key)
let t:curwin = winnr()
exec "wincmd ".a:key
if (t:curwin == winnr())
if(match (a:key, '[jk]'))
wincmd v
else
wincmd s
endif
exec "wincmd ".a:key
endif
endfunction