Skip to content

Instantly share code, notes, and snippets.

@kwstannard
Last active December 14, 2015 04:49
Show Gist options
  • Save kwstannard/5030824 to your computer and use it in GitHub Desktop.
Save kwstannard/5030824 to your computer and use it in GitHub Desktop.
vimrc relative numbering. Leaves relative numbering on loss of focus and on entering insert mode. Re-enters when appropriate.
set relativenumber
au InsertEnter * :set number
au InsertLeave * :set relativenumber
function! FocusGainNumbering()
if(mode() == 'i')
:set number
else
:set relativenumber
endif
endfunc
au FocusLost * :set number
au FocusGained * :call FocusGainNumbering()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment