State variables in VIM
- by dotancohen
Is there any way to have a state variable in VIM? Consider:
" Relative line numbers in Normal mode, absolute in Insert mode. Ctrl-N to toggle
set relativenumber
autocmd InsertEnter * :set number
autocmd InsertLeave * :set relativenumber
inoremap <C-n> <C-o>:call NumberToggle()<cr>
nnoremap <C-n> :call…