From 7d1268f31b50060d99dc450bb564a1392d4d74f9 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Date: Fri, 29 Aug 2014 14:52:05 +0200 Subject: vim: all the calls to autocmd are now in a separate file. --- vim/autocmd.vim | 19 +++++++++++++++++++ vimrc | 15 +++------------ 2 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 vim/autocmd.vim diff --git a/vim/autocmd.vim b/vim/autocmd.vim new file mode 100644 index 0000000..5cebac3 --- /dev/null +++ b/vim/autocmd.vim @@ -0,0 +1,19 @@ + +" Indentation rules for different languages. + +" Some rules regarding indentation on different languages. +autocmd FileType perl set shiftwidth=4 tabstop=4 +autocmd FileType c set shiftwidth=4 tabstop=4 +autocmd FileType yacc set shiftwidth=4 tabstop=4 +autocmd FileType go set shiftwidth=4 tabstop=4 +autocmd FileType ruby set shiftwidth=2 tabstop=2 +autocmd FileType cpp set shiftwidth=4 tabstop=4 +autocmd FileType php set shiftwidth=2 tabstop=2 +autocmd FileType javascript set shiftwidth=2 tabstop=2 + +" Call gofmt on save. +autocmd FileType go autocmd BufWritePre Fmt + +" Clean up trailing whitespaces on save. +autocmd BufWritePre * :%s/\s\+$//e + diff --git a/vimrc b/vimrc index dbac504..0c4099e 100644 --- a/vimrc +++ b/vimrc @@ -119,18 +119,9 @@ source ~/.vim/bundles.vim filetype plugin indent on "" -" Filetypes - -" Some rules regarding indentation on different languages. -autocmd FileType ruby set shiftwidth=2 -autocmd FileType perl set shiftwidth=4 tabstop=4 -autocmd FileType c set shiftwidth=4 tabstop=4 -autocmd FileType yacc set shiftwidth=4 tabstop=4 -autocmd FileType go set shiftwidth=4 tabstop=4 -autocmd FileType go autocmd BufWritePre Fmt - -" Clean up trailing whitespaces on save. -autocmd BufWritePre * :%s/\s\+$//e +" Everything regarding filetypes: indentation rules, gofmt & friends. + +source ~/.vim/autocmd.vim "" " Re-mappings -- cgit v1.2.3