Added better buffer handling to vimrc
This commit is contained in:
parent
f78d3a1a6b
commit
a0beef204a
|
@ -1 +1 @@
|
||||||
Subproject commit 62648d71bb05116287206d83181f9daa5a59ba67
|
Subproject commit f6bc949c05fd18ee557a89c92f82ff556200707d
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5c4f37a52d05022d689fb4364a53cfe78d83dc75
|
Subproject commit 59f78857f656afd462d7bc99b31cc8cc36c1872c
|
45
vimrc
45
vimrc
|
@ -21,7 +21,7 @@ function! EditVimRcFiles()
|
||||||
for l:rc_key in keys(g:rc_files)
|
for l:rc_key in keys(g:rc_files)
|
||||||
let l:ex_file = expand(g:rc_files[l:rc_key])
|
let l:ex_file = expand(g:rc_files[l:rc_key])
|
||||||
if filereadable(l:ex_file)
|
if filereadable(l:ex_file)
|
||||||
exe 'tabedit' l:ex_file
|
exe 'edit' l:ex_file
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -35,7 +35,10 @@ endif
|
||||||
|
|
||||||
" Hide buffers don't close them
|
" Hide buffers don't close them
|
||||||
set hidden
|
set hidden
|
||||||
" set path+=**
|
|
||||||
|
" Sane pane opening
|
||||||
|
set splitbelow
|
||||||
|
set splitright
|
||||||
|
|
||||||
" File indent opts
|
" File indent opts
|
||||||
set shiftwidth=2
|
set shiftwidth=2
|
||||||
|
@ -96,6 +99,7 @@ call plug#begin("$VIMHOME/plugged")
|
||||||
Plug 'kevinoid/vim-jsonc'
|
Plug 'kevinoid/vim-jsonc'
|
||||||
Plug 'jremmen/vim-ripgrep', { 'on': ['Rg', 'RgRoot'] }
|
Plug 'jremmen/vim-ripgrep', { 'on': ['Rg', 'RgRoot'] }
|
||||||
Plug 'junegunn/fzf', { 'on': ['FZF', '<Plug>fzf#run', '<Plug>fzf#wrap'] }
|
Plug 'junegunn/fzf', { 'on': ['FZF', '<Plug>fzf#run', '<Plug>fzf#wrap'] }
|
||||||
|
Plug 'junegunn/fzf.vim'
|
||||||
Plug 'sheerun/vim-polyglot'
|
Plug 'sheerun/vim-polyglot'
|
||||||
Plug 'adelarsq/vim-matchit'
|
Plug 'adelarsq/vim-matchit'
|
||||||
Plug 'vim-airline/vim-airline'
|
Plug 'vim-airline/vim-airline'
|
||||||
|
@ -128,6 +132,7 @@ let g:airline#extensions#branch#format = 2
|
||||||
let g:airline#extensions#branch#displayed_head_limit = 16
|
let g:airline#extensions#branch#displayed_head_limit = 16
|
||||||
let g:airline#extensions#tabline#enabled = 1
|
let g:airline#extensions#tabline#enabled = 1
|
||||||
let g:airline#extensions#tabline#left_alt_sep = '|'
|
let g:airline#extensions#tabline#left_alt_sep = '|'
|
||||||
|
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
|
||||||
let g:airline_powerline_fonts = 1
|
let g:airline_powerline_fonts = 1
|
||||||
let g:airline_theme='one'
|
let g:airline_theme='one'
|
||||||
if !exists('g:airline_symbols')
|
if !exists('g:airline_symbols')
|
||||||
|
@ -210,16 +215,16 @@ if has_key(plugs, 'coc.nvim')
|
||||||
return !col || getline('.')[col - 1] =~# '\s'
|
return !col || getline('.')[col - 1] =~# '\s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Use <c-space> to trigger completion.
|
" Use <A-space> to trigger completion.
|
||||||
inoremap <silent><expr> <c-space> coc#refresh()
|
inoremap <silent><expr> <A-space> coc#refresh()
|
||||||
|
|
||||||
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
|
" Use <c-space> to confirm completion, `<C-g>u` means break undo chain at current
|
||||||
" position. Coc only does snippet and additional edit on confirm.
|
" position. Coc only does snippet and additional edit on confirm.
|
||||||
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
|
" <c-space> could be remapped by other vim plugin, try `:verbose imap <CR>`.
|
||||||
if exists('*complete_info')
|
if exists('*complete_info')
|
||||||
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
inoremap <expr> <C-space> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||||
else
|
else
|
||||||
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
inoremap <expr> <C-space> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Use `[g` and `]g` to navigate diagnostics
|
" Use `[g` and `]g` to navigate diagnostics
|
||||||
|
@ -267,7 +272,7 @@ nnoremap <F2> :NERDTreeToggle<CR>
|
||||||
" Workaround for writing readonly files
|
" Workaround for writing readonly files
|
||||||
cnoremap w!! w !sudo tee % > /dev/null
|
cnoremap w!! w !sudo tee % > /dev/null
|
||||||
|
|
||||||
" Key Remapping
|
" Vim config(s) editing
|
||||||
nnoremap <leader>ve :call EditVimRcFiles()<cr>
|
nnoremap <leader>ve :call EditVimRcFiles()<cr>
|
||||||
nnoremap <leader>vs :source $MYVIMRC<cr>
|
nnoremap <leader>vs :source $MYVIMRC<cr>
|
||||||
nnoremap <leader>vl <Plug>localsearch_toggle
|
nnoremap <leader>vl <Plug>localsearch_toggle
|
||||||
|
@ -284,7 +289,29 @@ function! ToggleGutter() abort
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Buffer movement
|
||||||
|
nnoremap <silent> <TAB> :call BufferJump("bnext")<CR>
|
||||||
|
nnoremap <silent> <S-TAB> :call BufferJump("bprevious")<CR>
|
||||||
|
nnoremap <silent> <leader><TAB> :call ListBuffers()<CR>
|
||||||
|
|
||||||
|
function BufferJump(command)
|
||||||
|
let start_buffer = bufnr('%')
|
||||||
|
execute a:command
|
||||||
|
while &buftype ==# 'quickfix' && bufnr('%') != start_buffer
|
||||||
|
execute a:command
|
||||||
|
endwhile
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function ListBuffers()
|
||||||
|
try
|
||||||
|
Buffers
|
||||||
|
catch
|
||||||
|
buffers<CR>b<space>
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Default colorscheme
|
" Default colorscheme
|
||||||
|
set background=dark
|
||||||
let g:one_allow_italics=1
|
let g:one_allow_italics=1
|
||||||
execute "colorscheme " . g:my_color_scheme
|
execute "colorscheme " . g:my_color_scheme
|
||||||
highlight Comment term=italic cterm=italic gui=italic
|
highlight Comment term=italic cterm=italic gui=italic
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3b247d3071b8f1b723f288aec10e91758a109045
|
Subproject commit c6621bb692928333b76e2a593c66b49020389ab1
|
|
@ -1 +1 @@
|
||||||
Subproject commit fb929edc30192407a9298aad64f55ca1b19a464e
|
Subproject commit 2d60a47cc407117815a1d7b331ef226aa400a344
|
Loading…
Reference in New Issue