Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mattoc
Created October 11, 2012 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattoc/3869485 to your computer and use it in GitHub Desktop.
Save mattoc/3869485 to your computer and use it in GitHub Desktop.
Show line numbers in vim based on terminal size
" I like having line numbers on, but don't want to wrap lines in a
" standard-sized terminal window.
fun! WinSizeAutoNumber()
if winwidth(0) > 84
set number
else
set nonumber
endif
endfunction
" Run once on startup
call WinSizeAutoNumber()
" Run when window is resized
au VimResized * call WinSizeAutoNumber()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment