Vim Tips Wiki

Nice window resizing

1,613pages on
this wiki
Revision as of 16:11, August 7, 2009 by Fritzophrenic (Talk | contribs)

Tip 669 Printable Monobook Previous Next

created March 2, 2004 · complexity basic · author Yada · version 5.7

" Map F1 for gvim window resizing.
" Put this snippet of code in your vimrc for nice window resizing.
" Press F1 key to toggle between the three settings.
nmap <F1> :call ResizeWindow()<CR>
imap <F1> <Esc><F1>a " for insert mode
function! ResizeWindow()
  if (has("gui"))
    if s:selectedsize == 1
      let s:selectedsize = 2
      set number
      set columns=88 " 88 is exactly 80 with :set number
      set lines=35
    elseif s:selectedsize == 2
      set number
      let s:selectedsize = 3
      set columns=98
      set lines=45
    else " old school console goodness
      let s:selectedsize = 1
      set nonumber
      set columns=80
      set lines=25
let s:selectedsize=1
call ResizeWindow()


"use own map, this is mine
map <M-right> <Esc>:resize +2 <CR>
map <M-left> <Esc>:resize -2 <CR>

Around Wikia's network

Random Wiki