Skip to content

Commit e5eee8f

Browse files
committedNov 8, 2021
Update vimrc
1 parent 1e9d61c commit e5eee8f

File tree

1 file changed

+133
-39
lines changed

1 file changed

+133
-39
lines changed
 

‎vimrc

+133-39
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
let mapleader = "\<Space>"
2-
let maplocalleader = ","
31
let g:CoolTotalMatches = 1
4-
let ayucolor="dark"
5-
"set termguicolors
62
let g:lightline = { 'colorscheme': 'ayu_dark' }
73

84
let remote = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
@@ -15,24 +11,32 @@ endif
1511

1612
if !filereadable(local)
1713
: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
1920

2021
call plug#begin()
2122

2223
Plug 'sheerun/vimrc'
2324
Plug 'sheerun/vim-polyglot'
2425

26+
Plug 'eliba2/vim-node-inspect'
27+
Plug '~/.vim/plugged/vim-inspect'
28+
2529
" iTerm2 and tmux integration
2630
Plug 'sjl/vitality.vim'
31+
"Plug 'camspiers/lens.vim'
2732

28-
Plug '~/.fzf'
33+
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
34+
Plug 'junegunn/fzf.vim'
2935

3036
Plug 'ayu-theme/ayu-vim'
3137

32-
" Nice bottom panel
38+
"Nice bottom panel
3339
Plug 'itchyny/lightline.vim'
34-
"
35-
" Plug 'sheerun/night-and-day'
3640

3741
" File manager that open on '-'
3842
Plug 'justinmk/vim-dirvish'
@@ -42,9 +46,6 @@ Plug 'terryma/vim-expand-region'
4246
vmap v <Plug>(expand_region_expand)
4347
vmap <C-v> <Plug>(expand_region_shrink)
4448
45-
nnoremap <Leader>/ :Rg<Space>
46-
Plug 'jremmen/vim-ripgrep'
47-
4849
" Toggle comments with gcc
4950
let g:tcomment_mapleader1 = '<C-c>'
5051
Plug 'tomtom/tcomment_vim'
@@ -53,20 +54,17 @@ Plug 'tomtom/tcomment_vim'
5354
Plug 'tpope/vim-rsi'
5455

5556
" Automatically adds 'end' block to code
56-
Plug 'tpope/vim-endwise'
57+
Plug 'cohama/lexima.vim'
5758

5859
" Integration with git
5960
Plug 'tpope/vim-fugitive'
6061

6162
" Supports repeating plugin commands with .
6263
Plug 'tpope/vim-repeat'
6364

64-
" Various shortcuts like ]q for next quick list item
65+
" Various shortcuts like ]z for next quick list item
6566
" Plug 'tpope/vim-unimpaired'
6667

67-
" Allow to :Rename files
68-
Plug 'danro/rename.vim'
69-
7068
" Automatically find root project directory
7169
Plug 'airblade/vim-rooter'
7270
let g:rooter_disable_map = 1
@@ -80,6 +78,8 @@ nmap sk :SplitjoinJoin<cr>
8078
" Use ii / ai for indenting
8179
Plug 'michaeljsmith/vim-indent-object'
8280

81+
Plug 'tpope/vim-scriptease'
82+
8383
" For more reliable indenting and performance
8484
set foldmethod=indent
8585
set fillchars="fold: "
@@ -88,7 +88,8 @@ set fillchars="fold: "
8888
" Plug 'vim-scripts/IndexedSearch'
8989
Plug 'vim-scripts/SmartCase'
9090

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'
9293

9394
function! s:check_back_space() abort
9495
let col = col('.') - 1
@@ -105,9 +106,69 @@ Plug 'romainl/vim-cool'
105106

106107
Plug 'sbdchd/neoformat'
107108

109+
Plug 'kristijanhusak/vim-js-file-import'
110+
111+
Plug 'rakr/vim-one'
112+
113+
114+
Plug 'puremourning/vimspector'
115+
108116
call plug#end()
109117

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+
111172
vmap <Leader>d "+d
112173
nmap <Leader>p "+p
113174
nmap <Leader>P "+P
@@ -116,33 +177,66 @@ vmap <Leader>P "+P
116177
nmap <Leader><Leader> V
117178
nmap <Leader>b :make<CR>
118179
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>
122181
123-
vnoremap <silent> y y`]
124-
vnoremap <silent> p p`]
125-
nnoremap <silent> p p`e
126182

183+
" vnoremap <silent> i i`]
184+
" vnoremap <silent> p p`]
185+
" nnoremap <silent> p p`e
186+
"
127187
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+
"
130198

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>
133224
134225
map <silent> <C-j> :cnext<CR>
135226
map <silent> <C-k> :cprev<CR>
136227
137-
colorscheme ayu
228+
autocmd BufReadPost quickfix nnoremap <buffer> <CR> <CR>
229+
autocmd QuickfixCmdPost grep cfirst
138230

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')
140233

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

Comments
 (0)
Please sign in to comment.