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
| " -------------------------------------------------------------------------------------------------------------
" ---------------------------------------------common-start----------------------------------------------------
" -------------------------------------------------------------------------------------------------------------
set number
set mouse=c
set tabstop=4
set autoindent
set backspace=indent,eol,start
set hlsearch
set clipboard+=unnamedplus
set foldmethod=syntax
set nofoldenable
" 自动同步
set autoread
set fillchars=eob:\
" Vim jump to the last position when reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
function! ESC_IMAP()
let l:frontChar = getline('.')[col('.') - 2]
if l:frontChar == ";"
call feedkeys("\<BS>\<BS>\<ESC>", 'n')
else
call feedkeys("\<BS>\;", 'n')
endif
endfunction
inoremap <expr> ; ESC_IMAP()
set timeoutlen=200
nnoremap ;; <ESC>
vnoremap ;; <ESC>
snoremap ;; <ESC>
xnoremap ;; <ESC>
cnoremap ;; <ESC>
onoremap ;; <ESC>
" exit windows
tnoremap ;; <C-\><C-n>
" switch windows
nnoremap <TAB> <C-w>w
nnoremap vv <C-v>
echo expand("%:p:h")
cnoreabbrev fd echo expand("%:p:h")
cnoreabbrev vst vs<ENTER>:term
cnoreabbrev spt sp<ENTER>:term
" -------------------------------------------------------------------------------------------------------------
"-----------------------------------------------common-end----------------------------------------------------
"-------------------------------------------------------------------------------------------------------------
"
"
"
"-------------------------------------------------------------------------------------------------------------
"--------------------------------------------vim-plug-start---------------------------------------------------
"-------------------------------------------------------------------------------------------------------------
call plug#begin('/home/asleep/.local/share/nvim/site/autoload')
Plug 'itchyny/lightline.vim'
Plug 'joshdick/onedark.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'jiangmiao/auto-pairs'
Plug 'ms-jpq/chadtree', {'branch': 'chad', 'do': 'python3 -m chadtree deps'}
Plug 'sheerun/vim-polyglot'
Plug 'Yggdroot/LeaderF', { 'do': ':LeaderfInstallCExtension' }
Plug 'tpope/vim-fugitive'
Plug 'sbdchd/neoformat'
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }
call plug#end()
"有些插件需要安装 nerd fonts!
"nerd fonts 包括了 powerline fonts!
"建议安装 DejaVuSansMonoNerd!
"这个是 LeaderF 的设置
let g:Lf_WindowPosition = 'popup'
cnoreabbrev ff LeaderfFile
cnoreabbrev fm Neoformat
cnoreabbrev mt MarkdownPreviewToggle
let g:mkdp_theme = "light"
"这个是 chadtree 的设置
"明确指定绑定的键之后,就不会使用默认的键
let g:chadtree_settings = {
\ 'keymap.change_focus_up': [".."],
\ 'keymap.secondary': ["<2-leftmouse>"]
\}
nnoremap <F2> :CHADopen<CR>
let g:onedark_terminal_italics=1
autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE
colorscheme onedark
let g:lightline = {
\'colorscheme' : 'onedark',
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '', 'right': '' },
\ 'component': {
\ 'lineinfo': ' %3l / %L : %-2v',
\ },
\ }
"-------------------------------------------------------------------------------------------------------------
"-----------------------------------------------vim-plug-end--------------------------------------------------
"-------------------------------------------------------------------------------------------------------------
"-------------------------------------------------------------------------------------------------------------
"------------------------------------------------coc-start----------------------------------------------------
"-------------------------------------------------------------------------------------------------------------
inoremap <silent><expr> <TAB> coc#pum#visible() ? coc#pum#next(1) :"\<Tab>"
nnoremap gd <Plug>(coc-definition)
nnoremap gt <Plug>(coc-type-definition)
nnoremap gi <Plug>(coc-implementation)
nnoremap gr <Plug>(coc-references)
" Use K to show documentation in preview window.
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
nnoremap <silent> K :call ShowDocumentation()<CR>
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nnoremap <space>r <Plug>(coc-rename)
" Show all diagnostics.
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions.
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
" Find symbol of current document.
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
"-------------------------------------------------------------------------------------------------------------
"-------------------------------------------------coc-end-----------------------------------------------------
"-------------------------------------------------------------------------------------------------------------
|