Buffer control commands

* Mappings to space-lead sequences
  * New commands (close all, new)
This commit is contained in:
Emmanuel BENOîT 2023-06-24 18:20:06 +02:00
parent 39af7fd7e8
commit 56378a3eae
No known key found for this signature in database
GPG key ID: 2356DC6956CF54EF
2 changed files with 18 additions and 4 deletions

View file

@ -1,9 +1,5 @@
set hidden " Don't close buffers
" Buffer navigation
nnoremap <silent> <S-Left> :bprev<CR>
nnoremap <silent> <S-Right> :bnext<CR>
" Close buffer
function <SID>CloseCurrentBuffer( )
let btarget = bufnr( '%' )
@ -42,4 +38,14 @@ function <SID>CloseCurrentBuffer( )
execute l:wcurrent . 'wincmd w'
endfunction
" Buffer navigation (Ctrl, Shift, Arrows...)
nnoremap <silent> <S-Left> :bprev<CR>
nnoremap <silent> <S-Right> :bnext<CR>
nnoremap <silent> <C-S-Down> :call <SID>CloseCurrentBuffer()<CR>
" Buffer navigation (Space sequences)
nnoremap <silent> <Leader>bz :enew<CR>
nnoremap <silent> <Leader>bq :bprev<CR>
nnoremap <silent> <Leader>bd :bnext<CR>
nnoremap <silent> <Leader>bw :call <SID>CloseCurrentBuffer()<CR>
nnoremap <silent> <Leader>bW :bufdo call <SID>CloseCurrentBuffer()<CR>

View file

@ -20,6 +20,14 @@ let g:which_key_map.o.p = 'paste'
let g:which_key_map.o.w = 'whitespace'
let g:which_key_map.o.s = 'sign-column'
" Buffers
let g:which_key_map.b = { 'name' : '+buffers' }
let g:which_key_map.b.W = 'close-all'
let g:which_key_map.b.d = 'next'
let g:which_key_map.b.q = 'previous'
let g:which_key_map.b.w = 'close'
let g:which_key_map.b.z = 'new'
" Fuzzy finder
let g:which_key_map.p = { 'name' : '+fuzzy-finder' }
let g:which_key_map.p.p = 'buffers'