Skip to content

Instantly share code, notes, and snippets.

@gaveen
Created December 9, 2011 19:27
Show Gist options
  • Save gaveen/1452922 to your computer and use it in GitHub Desktop.
Save gaveen/1452922 to your computer and use it in GitHub Desktop.
Part of my vimrc which sets indentation (tabs, spaces, etc.)
" I'm using the following config to make my code look the same everywhere.
set bs=indent,eol,start " allow backspacing over everything
set autoindent " enable auto-indentation
set tabstop=2 " no. of spaces for tab in file
set shiftwidth=2 " no. of spaces for step in autoindent
set softtabstop=2 " no. of spaces for tab when editing
set expandtab " expand tabs into spaces
set smarttab " smart tabulation and backspace
" Then I use an additional block to set indentation for exceptions.
if has("autocmd")
augroup styles
autocmd!
" Custom filetypes settings: Python, Shell, Go, JSON, Vagrant
au FileType python,sh set tabstop=4 shiftwidth=4 softtabstop=4
au FileType go set noexpandtab tabstop=8 shiftwidth=8 softtabstop=8
au BufRead,BufNewFile *.json setfiletype javascript
au BufRead,BufNewFile Vagrantfile setfiletype ruby
augroup END
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment