Skip to content

Instantly share code, notes, and snippets.

@j-v
Created September 16, 2012 16:11
Show Gist options
  • Save j-v/3733013 to your computer and use it in GitHub Desktop.
Save j-v/3733013 to your computer and use it in GitHub Desktop.
Fix my screwed up Python indentation in vim
" initially i was using 3-space (shiftwidth=3) indentation with noexpandtab, and tabstop=8, the default
" this switches it to proper 4-space indentation with expandtab
" convert tabs to spaces
set tabstop=8
set shiftwidth=3
set expandtab
retab
" convert spaces to tabs
set tabstop=3
set noexpandtab
%retab!
" final convert tabs back to spaces
set tabstop=4
set shiftwidth=4
set expandtab
retab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment