Wikia

Vim Tips Wiki

Nice window resizing

Talk0
1,610pages 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
    endif
  endif
endfunction
let s:selectedsize=1
call ResizeWindow()

Comments

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

Advertisement | Your ad here

Around Wikia's network

Random Wiki