aboutsummaryrefslogtreecommitdiff
path: root/vim/config/indent.vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim/config/indent.vim')
-rw-r--r--vim/config/indent.vim31
1 files changed, 11 insertions, 20 deletions
diff --git a/vim/config/indent.vim b/vim/config/indent.vim
index 1ae8a909..f6dfd416 100644
--- a/vim/config/indent.vim
+++ b/vim/config/indent.vim
@@ -1,7 +1,14 @@
-" Indent with four literal spaces when 'expandtab' is on
+" Adopt the indent of the last line on new lines; interestingly, plugins that
+" do clever things with indenting will often assume this is set
+set autoindent
+
+" Use spaces instead of tabs
+set expandtab
+
+" Indent with four spaces when an indent operation is used
set shiftwidth=4
-" Insert four spaces when Tab is pressed and 'expandtab' is on
+" Insert four spaces when Tab is pressed
set softtabstop=4
" How many spaces to show for a literal tab when 'list' is unset
@@ -12,22 +19,6 @@ set tabstop=4
set smarttab
" When indenting lines with < or >, round the indent to a multiple of
-" 'shiftwidth', so even if the line is indented by one space it will indent up
-" to 4 and down to 0, for example; all this when 'expandtab' is on
+" 'shiftwidth', so even if the line is indented by one space it will indent
+" up to 4 and down to 0, for example
set shiftround
-
-" Tabs vs spaces and automatic indentation behaviour depends on there being an
-" actual filetype that's more than just plain text (or a Vim help buffer).
-function! FileTypeIndentConfig(ft)
- if a:ft == '' || a:ft == 'csv' || a:ft == 'help' || a:ft == 'text'
- setlocal noautoindent noexpandtab
- else
- setlocal autoindent expandtab
- endif
-endfunction
-
-" Call the function that we just declared each time the filetype is set
-augroup dfindent
- autocmd!
- autocmd FileType * call FileTypeIndentConfig(&filetype)
-augroup END