Skip to content

Instantly share code, notes, and snippets.

@iancoffey
Created September 11, 2014 22:26
Show Gist options
  • Save iancoffey/bb557167229fa81a0964 to your computer and use it in GitHub Desktop.
Save iancoffey/bb557167229fa81a0964 to your computer and use it in GitHub Desktop.
Toggle between tabs and spaces
function! ToggleTab()
if &expandtab
set shiftwidth=8
set softtabstop=0
set noexpandtab
else
execute "set shiftwidth=".g:my_tab
execute "set softtabstop=".g:my_tab
set expandtab
endif
endfunction
nmap <F9> mz:execute ToggleTab()<CR>'z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment