Skip to content

Instantly share code, notes, and snippets.

@alloy
Created November 18, 2013 13:39
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alloy/7527832 to your computer and use it in GitHub Desktop.
Save alloy/7527832 to your computer and use it in GitHub Desktop.
VIM config to deal with (MRI) Ruby’s C source code indentation.
" These VIM rules match the MRI C indentation rules.
"
" To enable use of this project specific config, add the following to your
" ~/.vimrc:
"
" " Enable per-directory .vimrc files
" set exrc
" " Disable unsafe commands in local .vimrc files
" set secure
function! MRIIndent()
setlocal cindent
setlocal noexpandtab
setlocal shiftwidth=4
setlocal softtabstop=4
setlocal tabstop=8
setlocal textwidth=80
" Ensure function return types are not indented
setlocal cinoptions=(0,t0
endfunction
autocmd Filetype c,cpp call MRIIndent()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment