aboutsummaryrefslogtreecommitdiff
path: root/.vim/autocmd.vim
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2019-08-22 18:30:24 +0200
committerMiquel Sabaté Solà <msabate@suse.com>2019-08-22 18:30:24 +0200
commit4ead9be4468d8d58c027bf6e6616e3b4d6e727eb (patch)
tree18ab19fd5213c9d302b165eafa46a6f1f8902e75 /.vim/autocmd.vim
parent04f4a7df197ce327f36b666869a1ca2f09934e58 (diff)
downloaddotfiles-4ead9be4468d8d58c027bf6e6616e3b4d6e727eb.tar.gz
dotfiles-4ead9be4468d8d58c027bf6e6616e3b4d6e727eb.zip
Complete re-structuring so it's easier to install
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to '.vim/autocmd.vim')
-rw-r--r--.vim/autocmd.vim22
1 files changed, 22 insertions, 0 deletions
diff --git a/.vim/autocmd.vim b/.vim/autocmd.vim
new file mode 100644
index 0000000..cbba932
--- /dev/null
+++ b/.vim/autocmd.vim
@@ -0,0 +1,22 @@
+" Indentation rules for different languages.
+
+" Some rules regarding indentation on different languages.
+autocmd FileType sh setlocal shiftwidth=4 tabstop=4
+autocmd FileType perl setlocal shiftwidth=4 tabstop=4
+autocmd FileType c setlocal noexpandtab shiftwidth=4 tabstop=4
+autocmd FileType yacc setlocal shiftwidth=4 tabstop=4
+autocmd FileType go setlocal noexpandtab shiftwidth=4 tabstop=4
+autocmd FileType ruby setlocal shiftwidth=2 tabstop=2
+autocmd FileType cpp setlocal noexpandtab shiftwidth=4 tabstop=4
+autocmd FileType php setlocal noexpandtab shiftwidth=4 tabstop=4
+autocmd FileType javascript setlocal shiftwidth=2 tabstop=2
+
+" Clean up trailing whitespaces on save.
+autocmd BufWritePre * :%s/\s\+$//e
+au BufRead,BufNewFile Vagrantfile set filetype=ruby
+
+" If there is a .lvimrc, source it. Note that this works best by calling vim on
+" the root of your project.
+if filereadable(".lvimrc")
+ so .lvimrc
+endif