Skip to content

Instantly share code, notes, and snippets.

@nijotz
Last active September 21, 2015 18:55
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 nijotz/18664b3c3727ccdc21e6 to your computer and use it in GitHub Desktop.
Save nijotz/18664b3c3727ccdc21e6 to your computer and use it in GitHub Desktop.
Vim tab preference cycle
" Cycle tabbing options
map <leader><tab> :call CycleTabs()<CR>
fun! CycleTabs()
if !&expandtab
echo "4 space tabs"
set shiftwidth=4
set softtabstop=4
set tabstop=4
set expandtab
elseif &expandtab && &shiftwidth == 4
echo "2 space tabs"
set shiftwidth=2
set softtabstop=2
set tabstop=2
set expandtab
else
echo "Tab characters"
set shiftwidth=4
set softtabstop=4
set tabstop=4
set noexpandtab
endif
endfun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment