-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathspacevim
222 lines (174 loc) · 6.97 KB
/
spacevim
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
let g:spacevim_plug_home = '~/.vim/plugged'
" Disable rust layer as the features of it are mostly unused and
" somehow always run rustfmt on save regardless the option.
" \ 'rust',
let g:spacevim_layers = [
\ 'programming', 'fzf', 'better-defaults', 'which-key', 'better-motion', 'editing', 'text-align', 'formatting',
\ 'python', 'c-c++', 'latex', 'goyo', 'graphviz', 'git', 'github', 'chinese', 'javascript','lsp'
\ ]
Layer 'file-manager'
Layer 'markdown'
Layer 'syntax-checking'
let g:coc_global_extensions = ['coc-rust-analyzer', 'coc-explorer']
Layer 'file-manager'
let g:spacevim_excluded = ['dominikduda/vim_current_word', 'kshenoy/vim-signature', 'python-mode/python-mode']
let g:airline_powerline_fonts = 1
let g:spacevim_nerd_fonts = 1
let g:spacevim_lsp_engine = 'coc'
let g:spacevim_enable_clap = 1
let g:spacevim_enable_true_color = 1
let g:spacevim_disable_nerdtree_arrow_icons = 1
let g:space_vim_plugin_hi_groups = 1
" Uncomment the following line if your terminal(-emulator) supports true colors.
if $TERM_PROGRAM !~? 'Apple_Terminal'
let g:spacevim_enable_true_color = 1
endif
function! UserInit()
Plug 'junegunn/seoul256.vim'
Plug 'chuling/vim-equinusocio-material'
Plug 'arzg/vim-colors-xcode'
Plug 'junegunn/fzf.vim'
Plug '~/.fzf'
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
endfunction
" Override the default settings from space-vim as well as adding extras
function! UserConfig()
if g:spacevim.nvim
" Reset wildmode for wildoptions=pum as changing it somehow invalids
" cmdline pum.
set wildmode&
endif
set norelativenumber
set timeoutlen=500
set wrap
set list listchars=tab:¦\ ,trail:•,extends:❯,precedes:❮
let &guifont = 'FiraCode Nerd Font:h16'
" let &guifont = 'Iosevka-Slab:h16'
" let &guifont = 'Fantasque Sans Mono:h16'
let g:fzf_layout = { 'window': {'width': 0.8, 'height': 0.6 } }
let g:eleline_slim = 1
let g:vista_echo_cursor_strategy = 'floating_win'
let g:which_key_floating_relative_win = 1
let g:clap_theme = 'material_design_dark'
let g:clap_layout = { 'relative': 'editor', 'width': '48%', 'height':'80%', 'col': '3%', 'row': '10%' }
let g:clap_provider_yanks_history = '~/.clap_yanks.history'
let g:clap_search_box_border_style = 'nil'
" let g:clap_preview_direction = 'UD'
" let g:clap_layout = { 'relative': 'editor', 'width': '80%', 'height':'20%', 'col': '3%', 'row': '10%' }
let g:clap_disable_bottom_top = 1
let g:clap_preview = { 'scrollbar': { 'fill_char': '▌' } }
function! GotoFile() abort
let git_dir = system('git rev-parse --git-dir')
if v:shell_error
Clap files
else
Clap git_files
endif
endfunction
tnoremap <Esc> <C-\><C-n>
vnoremap <C-P> :Clap grep --query=@visual<CR>
nnoremap <C-A> ggVG
nnoremap <C-G> :call spacevim#vim#file#CtrlG()<CR>
nnoremap <C-f> :Clap files<CR>
nnoremap <C-p> :Clap grep<CR>
nnoremap <Leader>pw :call SearchCursorWord()<CR>
nnoremap <silent> gf :call GotoFile()<CR>
function! SearchCursorWord()
execute 'Clap grep --query=\"'.expand("<cword>")
endfunction
let g:ale_linters = {'rust': ['cargo', 'analyzer']}
let g:ale_echo_cursor = 0
let g:ale_sign_error = "◉"
let g:ale_sign_warning = "◉"
let g:ale_virtualtext_cursor = 1
let g:ale_virtualtext_prefix = "💡 "
let g:ale_hover_cursor = 0
highlight ALEErrorSign ctermfg=9 guifg=#C30500
highlight ALEWarningSign ctermfg=11 guifg=#ED6237
let g:coc_node_path = '/home/xlc/bin/node'
let g:coc_force_debug = 1
hi link CocHighlightText Pmemu
" Use tab for trigger completion with characters ahead and navigate
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file
" 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>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
hi link CocInlayHint Pmenu
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)
command! ProfileStart call spacevim#util#ProfileStart()
command! ProfileStop call spacevim#util#ProfileStop()
function! MarkQfEntry() abort
cfirst
normal! m1
let idx = 2
let qf_len = len(getqflist())
while idx <= qf_len
if idx < qf_len
cnext
endif
execute 'normal! m'.idx
let idx += 1
endwhile
cfirst
echom "All quickfix entries have been number marked"
endfunction
command! MarkQfEntry call MarkQfEntry()
command! CommitRef call spacevim#github#CommitRef()
augroup X
autocmd!
autocmd FileType coc-explorer setlocal cursorline
autocmd FileType qf nnoremap <buffer> <silent> j :<c-u>call spacevim#util#CycleQuickfix('cnext', 'cfirst')<CR>
autocmd FileType qf nnoremap <buffer> <silent> k :<c-u>call spacevim#util#CycleQuickfix('cprev', 'clast')<CR>
autocmd FileType startify normal! j
if exists('*CocActionAsync')
autocmd CursorHold * silent call CocActionAsync('highlight')
endif
" autocmd VimEnter * call timer_start(100, { -> vista#RunForNearestMethodOrFunction()})
autocmd BufEnter *spacevim setlocal ft=vim
autocmd BufEnter bashrc-extra setlocal ft=sh
" autocmd BufWritePre *.rs call TryRustfmt()
autocmd BufWritePost *.md call clap#client#notify('update-toc')
autocmd FileType qf call SetQuickfixStatusline()
augroup END
set efm=%f:%l:%c:%m
let g:clap_plugin_experimental = 1
endfunction
function! ClapAction(bang, action) abort
call clap#client#notify(a:action, [])
endfunction
command! -bang -nargs=* -bar -range -complete=customlist,ClapActionList ClapAction call ClapAction(<bang>0, <f-args>)
function! ClapActionList(A, L, P) abort
let actions = get(g:, 'clap_actions', ['open-config'])
if empty(a:A)
return actions
else
return filter(actions, printf('v:val =~ "^%s"', a:A))
endif
endfunction
function! TryRustfmt() abort
if exists('b:git_dir') && b:git_dir =~? 'substrate'
" Do not run rustfmt when in substrate.
else
call spacevim#lang#util#Format()
endif
endfunction
function! SetQuickfixStatusline() abort
let l:bufnr_winnr = printf('%%#%s#%%{%s()}%%*', 'ElelineBufnrWinnr', 'ElelineBufnrWinnr')
let &l:statusline = l:bufnr_winnr."%{exists('w:quickfix_title')? ' '.w:quickfix_title : ''} %l/%L %p"
endfunction