Changed 'Q' to intelligently close window or kill buffer if it's the last one
This commit is contained in:
parent
3eec4c39e6
commit
476e72ba63
@ -214,8 +214,7 @@ files contain key mappings as well (TODO: probably will move them out to skwp-ke
|
||||
**Window Navigation**
|
||||
|
||||
* H L I M - to move left, right, up, down between windows
|
||||
* Q - Quit window, kill buffer (:bw)
|
||||
* \Q - Quit a window, keep buffer alive (Ctrl-w,c)
|
||||
* Q - Intelligent Window Killer. Close window (wincmd c) if there are multiple windows to same buffer, or kill the buffer (bwipeout) if this is the last window into it.
|
||||
|
||||
**Splits**
|
||||
|
||||
|
@ -111,11 +111,6 @@ map <silent> <D-0> :tabn 0<cr>
|
||||
nnoremap <silent> vv <C-w>v
|
||||
nnoremap <silent> ss <C-w>s
|
||||
|
||||
" Use Q to kill a buffer
|
||||
nnoremap <silent> Q :bw<CR>
|
||||
|
||||
" Remap \Q to close a window (leave buffer open in memory)
|
||||
nnoremap <silent> <Leader>Q <C-w>c
|
||||
|
||||
"open the taglist (method browser) using ,t
|
||||
nnoremap <silent> ,T :TlistToggle<CR>
|
||||
|
12
vim/plugin/settings/window-killer.vim
Normal file
12
vim/plugin/settings/window-killer.vim
Normal file
@ -0,0 +1,12 @@
|
||||
" Use Q to intelligently close a window
|
||||
" (if there are multiple windows into the same buffer)
|
||||
" or kill the buffer entirely if it's the last window looking into that buffer
|
||||
function! CloseWindowOrKillBuffer()
|
||||
if(bufwinnr('%')) > 1
|
||||
wincmd c
|
||||
else
|
||||
bdelete
|
||||
endif
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> Q :call CloseWindowOrKillBuffer()<CR>
|
Loading…
Reference in New Issue
Block a user