Wikia

Vim Tips Wiki

Changes: How to avoid obliterating window layout

Edit

Back to page

(Remove html character entities)
(Adjust previous/next navigation)
 
Line 2: Line 2:
 
{{TipImported
 
{{TipImported
 
|id=58
 
|id=58
|previous=55
+
|previous=54
 
|next=63
 
|next=63
 
|created=March 28, 2001
 
|created=March 28, 2001

Latest revision as of 03:04, September 29, 2008

Tip 58 Printable Monobook Previous Next

created March 28, 2001 · complexity intermediate · author scotch · version 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 accidentally 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>

ReferencesEdit

CommentsEdit

See tip VimTip199 for a way to map these keys to a maximize window - return to split structure function.


Another solution is given by ZoomWin which makes <c-w>o toggle between the multi-window display and a single window.


Around Wikia's network

Random Wiki