Tip #58: how to avoid obliterating window layout
tip karma |
Rating 4/5, Viewed by 1343
|
created: |
|
March 28, 2001 8:00 |
|
complexity: |
|
intermediate |
author: |
|
scotch |
|
as of Vim: |
|
5.7 |
If you take the time to lay out several windows
with vim (especially vertically in version 6), you may be bummed when
you hit an errant key and find that all but what one window
disappears.
What happens: while navigating between windows, you
hit <C-W>j, <C-W>k, etc. At some point you accidently
hit <C-W> but then don't follow with a window command.
Now hitting 'o' to start insert mode issues a command
equivalent to :only, and closes all windows execept
for the one you are in (unless some windows have unsaved
changes in them).
How to avoid this: petition the vim-dev mailing list about
how :only is sufficient for the infrequenty use this might
get (j/k).
Really: use mapping to disable the <C-W>o functionality; put
this in your .vimrc:
nnoremap <C-W>O :echo "sucker"<CR>
nnoremap <C-W>o :echo "sucker"<CR>
nnoremap <C-W><C-O> :echo "sucker"<CR>
references:
:help :only
:help CTRL-W_o
That is all.
Scott
<<previous buffer |
Applying substitutes to a visual block >>
Additional Notes
|