I have split my windows horizontally. Now how can I return to normal mode, i.e. no split window just one window without cancelling all of my open windows. I have 5 and do not wa
I understand you intention well, I use buffers exclusively too, and occasionally do split if needed.
below is excerpt of my .vimrc
" disable macro, since not used in 90+% use cases
map q
" q, close/hide current window, or quit vim if no other window
nnoremap q :if winnr('$') > 1 \|hide\|else\|silent! exec 'q'\|endif
" qo, close all other window -- 'o' stands for 'only'
nnoremap qo :only
set hidden
set timeout
set timeoutlen=200 " let vim wait less for your typing!
Which fits my workflow quite well
If
q
was pressed
- hide current window if multiple window open, else try to quit vim.
if
qo
was pressed,
- close all other window, no effect if only one window.
Of course, you can wrap that messy part into a function, eg
func! Hide_cur_window_or_quit_vim()
if winnr('$') > 1
hide
else
silent! exec 'q'
endif
endfunc
nnoremap q :call Hide_cur_window_or_quit_vim()
Sidenote:
I remap q
, since I do not use macro for editing, instead use :s
, :g
, :v
, and external text processing command if needed, eg, :'{,'}!awk 'some_programm'
, or use :norm! normal-command-here
.