-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.vim
153 lines (120 loc) · 3.66 KB
/
init.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
" /.config/nvim/init.vim
" /.vim/vimrc
syntax on
set number
set relativenumber
set cursorline
set wrap
set showcmd
set wildmenu
set tabstop=4
set ai
set hidden
"===
"=== from mediu
"===
" open new split panes to right and below
set splitright
set splitbelow
" 开启真彩色
set termguicolors
" search config
set hlsearch
exec "nohlsearch"
set incsearch
set ignorecase
set smartcase
set updatetime=100
noremap = nzz
noremap - Nzz
map S :w<CR>
map s <nop>
map Q :q<CR>
" plug block
call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'connorholyday/vim-snazzy'
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'mhinz/vim-startify'
Plug 'scrooloose/nerdtree'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'ryanoasis/vim-devicons'
" Plug 'iamcco/mathjax-support-for-mkdp'
" Plug 'iamcco/markdown-preview.vim'
call plug#end()
"===
"=== nerdtree
"===
nnoremap <leader>n :NERDTreeFocus<CR>
" nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
" nnoremap <C-f> :NERDTreeFind<CR>
" Start NERDTree and put the cursor back in the other window.
" autocmd VimEnter * NERDTree | wincmd p
"===
"=== vim-airline
"===
let g:airline_theme="luna"
let g:airline_powerline_fonts=1
" 打开tabline功能,方便查看Buffer和切换
" 我还省去了minibufexpl插件,因为我习惯在1个Tab下用多个buffer"
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
" 设置切换Buffer快捷键"
nnoremap <leader><C-n> :bn<CR>
nnoremap <leader><C-p> :bp<CR>
" 关状态显示空白符号计数
let g:airline#extensions#whitespace#enabled = 0
let g:airline#extensions#whitespace#symbol = '!'
"=== coc.nvim
"===
let g:coc_global_extensions = ['coc-json', 'coc-vimlsp', 'coc-jedi', 'coc-marketplace', 'coc-go']
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
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-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" 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)
" Use K to show documentation in preview window.
nnoremap <silent> <leader>h :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
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" let g:mkdp_path_to_chrome = $BROWSER
" let g:mkdp_auto_start = 1
" nmap <silent> <F8> <Plug>MarkdownPreview
" imap <silent> <F8> <Plug>MarkdownPreview
" nmap <silent> <F9> <Plug>StopMarkdownPreview
" imap <silent> <F9> <Plug>StopMarkdownPreview
" color dracula
let g:airline_theme='dracula'
autocmd vimenter * hi Normal guibg=NONE ctermbg=NONE " transparent bg