1
- let mapleader = " \<Space> "
2
- let maplocalleader = " ,"
3
1
let g: CoolTotalMatches = 1
4
- let ayucolor= " dark"
5
- " set termguicolors
6
2
let g: lightline = { ' colorscheme' : ' ayu_dark' }
7
3
8
4
let remote = ' https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
@@ -15,24 +11,32 @@ endif
15
11
16
12
if ! filereadable (local)
17
13
:silent execute ' !curl --create-dirs -sfLo ' .local.' ' .remote
18
- end "
14
+ end
15
+
16
+
17
+ let g: vimspector_enable_mappings = ' HUMAN'
18
+ let g: vimspector_sidebar_width = 40
19
+ let g: vimspector_bottombar_height = 5
19
20
20
21
call plug#begin ()
21
22
22
23
Plug ' sheerun/vimrc'
23
24
Plug ' sheerun/vim-polyglot'
24
25
26
+ Plug ' eliba2/vim-node-inspect'
27
+ Plug ' ~/.vim/plugged/vim-inspect'
28
+
25
29
" iTerm2 and tmux integration
26
30
Plug ' sjl/vitality.vim'
31
+ " Plug 'camspiers/lens.vim'
27
32
28
- Plug ' ~/.fzf'
33
+ Plug ' junegunn/fzf' , { ' do' : { - > fzf#install () } }
34
+ Plug ' junegunn/fzf.vim'
29
35
30
36
Plug ' ayu-theme/ayu-vim'
31
37
32
- " Nice bottom panel
38
+ " Nice bottom panel
33
39
Plug ' itchyny/lightline.vim'
34
- "
35
- " Plug 'sheerun/night-and-day'
36
40
37
41
" File manager that open on '-'
38
42
Plug ' justinmk/vim-dirvish'
@@ -42,9 +46,6 @@ Plug 'terryma/vim-expand-region'
42
46
vmap v <Plug> (expand_region_expand)
43
47
vmap <C-v> <Plug> (expand_region_shrink)
44
48
45
- nnoremap <Leader> / :Rg<Space>
46
- Plug ' jremmen/vim-ripgrep'
47
-
48
49
" Toggle comments with gcc
49
50
let g: tcomment_mapleader1 = ' <C-c>'
50
51
Plug ' tomtom/tcomment_vim'
@@ -53,20 +54,17 @@ Plug 'tomtom/tcomment_vim'
53
54
Plug ' tpope/vim-rsi'
54
55
55
56
" Automatically adds 'end' block to code
56
- Plug ' tpope/ vim-endwise '
57
+ Plug ' cohama/lexima. vim'
57
58
58
59
" Integration with git
59
60
Plug ' tpope/vim-fugitive'
60
61
61
62
" Supports repeating plugin commands with .
62
63
Plug ' tpope/vim-repeat'
63
64
64
- " Various shortcuts like ]q for next quick list item
65
+ " Various shortcuts like ]z for next quick list item
65
66
" Plug 'tpope/vim-unimpaired'
66
67
67
- " Allow to :Rename files
68
- Plug ' danro/rename.vim'
69
-
70
68
" Automatically find root project directory
71
69
Plug ' airblade/vim-rooter'
72
70
let g: rooter_disable_map = 1
@@ -80,6 +78,8 @@ nmap sk :SplitjoinJoin<cr>
80
78
" Use ii / ai for indenting
81
79
Plug ' michaeljsmith/vim-indent-object'
82
80
81
+ Plug ' tpope/vim-scriptease'
82
+
83
83
" For more reliable indenting and performance
84
84
set foldmethod = indent
85
85
set fillchars = " fold: "
@@ -88,7 +88,8 @@ set fillchars="fold: "
88
88
" Plug 'vim-scripts/IndexedSearch'
89
89
Plug ' vim-scripts/SmartCase'
90
90
91
- Plug ' neoclide/coc.nvim' , {' do' : ' yarn install --frozen-lockfile' }
91
+ Plug ' neoclide/coc.nvim' , {' branch' : ' release' }
92
+ let g: coc_quickfix_open_command = ' cfirst'
92
93
93
94
function ! s: check_back_space () abort
94
95
let col = col (' .' ) - 1
@@ -105,9 +106,69 @@ Plug 'romainl/vim-cool'
105
106
106
107
Plug ' sbdchd/neoformat'
107
108
109
+ Plug ' kristijanhusak/vim-js-file-import'
110
+
111
+ Plug ' rakr/vim-one'
112
+
113
+
114
+ Plug ' puremourning/vimspector'
115
+
108
116
call plug#end ()
109
117
110
- vmap <Leader> y "+y
118
+ colorscheme ayu
119
+
120
+ let $FZF_DEFAULT_COMMAND = ' git ls-files'
121
+ let g: fzf_buffers_jump = 1
122
+ let g: fzf_layout = { ' down' : ' 25%' }
123
+ let g: fzf_preview_window = []
124
+
125
+ function ! Ripgrep (query)
126
+ let command_fmt = ' rg --column --line-number --no-heading --color=always --smart-case -- %s || true'
127
+ let initial_command = printf (command_fmt, shellescape (a: query ))
128
+ let reload_command = printf (command_fmt, ' {q}' )
129
+ let spec = {' options' : [' --phony' , ' --query' , a: query , ' --multi' , ' --bind' , ' enter:select-all+accept,change:reload:' .reload_command]}
130
+ call fzf#vim#grep (initial_command, 1 , spec, 0 )
131
+ endfunction
132
+
133
+ function ! s: GetSelection ()
134
+ return getline (' .' )[col (" '<" )-1 : col (" '>" )-1 ]
135
+ endfunction
136
+
137
+ nnoremap <Leader> o :FZF<CR>
138
+ vnoremap <Leader> / :call Ripgrep(<SID> GetSelection())<CR>
139
+ nnoremap <Leader> / :call Ripgrep("")<CR>
140
+ nnoremap <silent> Q :cclose<CR>
141
+
142
+ func ! s: CustomiseUI ()
143
+ " Remove winbar for code window
144
+ call win_gotoid ( g: vimspector_session_windows .code )
145
+ nunmenu WinBar
146
+ nnoremenu WinBar.x :call vimspector#Reset ( { ' interactive' : v: false } )<CR>
147
+ nnoremenu WinBar.F4\ ⟲ :call vimspector#Restart ()<CR>
148
+ nnoremenu WinBar.F5\ ▶ :call vimspector#Continue ()<CR>
149
+ nnoremenu WinBar.F9\ ● :call vimspector#ToggleBreakpoint ()<CR>
150
+ nnoremenu WinBar.F10\ ↓ :call vimspector#StepOver ()<CR>
151
+ nnoremenu WinBar.F11\ → :call vimspector#StepInto ()<CR>
152
+ nnoremenu WinBar.F12\ ← :call vimspector#StepOut ()<CR>
153
+
154
+ " Create winbar for variables window
155
+ call win_gotoid ( g: vimspector_session_windows .variables )
156
+ nunmenu WinBar
157
+
158
+ endfunction
159
+ augroup MyVimspectorUICustomistaion
160
+ autocmd !
161
+ autocmd User VimspectorUICreated call <SID> CustomiseUI ()
162
+ augroup END
163
+
164
+ sign define vimspectorBP text= \ ● texthl= WarningMsg
165
+ sign define vimspectorBPCond text= \ • texthl= WarningMsg
166
+ sign define vimspectorBPDisabled text= \ ○ texthl= LineNr
167
+ sign define vimspectorPC text= \ » texthl= String
168
+ sign define vimspectorPCBP text= \ » texthl= String
169
+ sign define vimspectorCurrentThread text= > texthl= String
170
+ sign define vimspectorCurrentFrame text= > texthl= String
171
+
111
172
vmap <Leader> d "+d
112
173
nmap <Leader> p "+p
113
174
nmap <Leader> P "+P
@@ -116,33 +177,66 @@ vmap <Leader>P "+P
116
177
nmap <Leader> <Leader> V
117
178
nmap <Leader> b :make<CR>
118
179
nnoremap <Leader> <Tab> <C-^>
119
- nnoremap <Leader> y :!annotate expand('%:p') " what?
120
-
121
- nnoremap <Leader> o :FZF<CR>
180
+ nnoremap <silent> <Leader><CR> :CocAction<CR>
122
181
123
- vnoremap <silent> y y`]
124
- vnoremap <silent> p p`]
125
- nnoremap <silent> p p`e
126
182
183
+ " vnoremap <silent> i i`]
184
+ " vnoremap <silent> p p`]
185
+ " nnoremap <silent> p p`e
186
+ "
127
187
nnoremap <Leader> w :w<CR>
128
- nnoremap <Leader> s :wq<CR>
129
- nnoremap <Leader> v V
188
+ nnoremap <Leader> z :wq<CR>
189
+ nnoremap <Leader> q :qa<CR>
190
+
191
+ nnoremap <C-a> 0
192
+ nnoremap <C-e> $
193
+
194
+ nmap <silent> gy <Plug> (coc-type-definition)
195
+ nmap <silent> gi <Plug> (coc-implementation)
196
+ nmap <silent> gr <Plug> (coc-references)
197
+ "
130
198
131
- nnoremap H 0
132
- nnoremap L $
199
+ function ! s: GoToDefinition ()
200
+ if CocAction (' jumpDefinition' )
201
+ return v: true
202
+ endif
203
+
204
+ let ret = execute (" silent! normal \<C-]> " )
205
+ if ret = ~ " Error"
206
+ call searchdecl (expand (' <cword>' ))
207
+ endif
208
+ endfunction
209
+ nnoremap <silent> <nowait><CR> :<C-u> call <SID> GoToDefinition()<CR>
210
+
211
+ nmap <silent> <F2> <Plug> (coc-rename)
212
+ nmap <silent> <Leader> f <Plug> (coc-fix-current)
213
+ nmap <silent> <nowait> § <Plug> (coc-codeaction-selected)<CR>
214
+ vmap <silent> <nowait> § <Plug> (coc-codeaction-selected)<CR>
215
+ xmap if <Plug> (coc-funcobj-i)
216
+ omap if <Plug> (coc-funcobj-i)
217
+ xmap af <Plug> (coc-funcobj-a)
218
+ omap af <Plug> (coc-funcobj-a)
219
+ xmap ic <Plug> (coc-classobj-i)
220
+ omap ic <Plug> (coc-classobj-i)
221
+ xmap ac <Plug> (coc-classobj-a)
222
+ omap ac <Plug> (coc-classobj-a)
223
+ nmap <silent> <Leader> = :call CocAction('format')<CR> :silent call CocAction('runCommand', 'editor.action.organizeImport')<CR>
133
224
134
225
map <silent> <C-j> :cnext<CR>
135
226
map <silent> <C-k> :cprev<CR>
136
227
137
- colorscheme ayu
228
+ autocmd BufReadPost quickfix nnoremap <buffer> <CR> <CR>
229
+ autocmd QuickfixCmdPost grep cfirst
138
230
139
- " au BufWritePre *.go :call CocAction('runCommand', 'editor.action.organizeImport')
231
+ au BufNewFile ,BufRead *.x set ft = vlang
232
+ au BufWritePre *.go call CocAction (' format' )
140
233
141
- nmap <silent> gd <Plug> (coc-definition)
142
- nmap <silent> gy <Plug> (coc-type-definition)
143
- nmap <silent> gi <Plug> (coc-implementation)
144
- nmap <silent> gr <Plug> (coc-references)
145
- nmap <silent> <CR> <Plug> (coc-definition)
146
- nmap <silent> <Leader> r <Plug> (coc-references)
147
- nmap <silent> f <Plug> (coc-fix-current)
148
- autocmd BufReadPost quickfix nnoremap <buffer> <CR> <CR>
234
+ " Show git commit that changed given line
235
+ map <silent> <Leader> g :call setbufvar(winbufnr(popup_atcursor(systemlist("cd " . shellescape(fnamemodify(resolve(expand('%:p')), ":h")) . " && git log --no-merges -n 1 -L " . shellescape(line("v") . "," . line(".") . ":" . resolve(expand("%:p")))), { "padding": [1,1,1,1], "pos": "botleft", "wrap": 0 })), "&filetype", "git")<CR>
236
+
237
+ " Show map output in editable window
238
+ cnorea <expr> map getcmdtype() == ':' && getcmdline() ==# 'map'
239
+ \ ? "new <bar> put=execute('map') <bar> set buftype=nofile bufhidden=delete"
240
+ \ : 'map'
241
+
242
+ set shortmess += F
0 commit comments