aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim')
-rw-r--r--vim/after/indent/c.vim15
-rw-r--r--vim/after/indent/gitconfig.vim15
-rw-r--r--vim/after/indent/html.vim9
-rw-r--r--vim/after/indent/make.vim14
-rw-r--r--vim/after/indent/perl.vim8
-rw-r--r--vim/after/indent/php.vim8
-rw-r--r--vim/after/indent/sh.vim8
-rw-r--r--vim/after/indent/vim.vim3
-rw-r--r--vim/indent/csv.vim24
-rw-r--r--vim/indent/help.vim20
-rw-r--r--vim/indent/tsv.vim2
-rw-r--r--vim/vimrc38
12 files changed, 40 insertions, 124 deletions
diff --git a/vim/after/indent/c.vim b/vim/after/indent/c.vim
index 9cea0a2d..45db2ebc 100644
--- a/vim/after/indent/c.vim
+++ b/vim/after/indent/c.vim
@@ -1,18 +1,3 @@
-" Use plain old tabs for indent in C files
-setlocal noexpandtab
-let b:undo_indent .= '|setlocal expandtab<'
-if v:version > 703
- \ || v:version == 703 && has('patch629')
- setlocal shiftwidth=0
-else
- let &l:shiftwidth = &l:tabstop
-endif
-let b:undo_indent .= '|setlocal shiftwidth<'
-if &softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_indent .= '|setlocal softtabstop<'
-endif
-
" If the path to the file looks like the Vim sources, set 'shiftwidth' to 4
if expand('%:p') =~# '/vim.*src/'
setlocal shiftwidth=4
diff --git a/vim/after/indent/gitconfig.vim b/vim/after/indent/gitconfig.vim
deleted file mode 100644
index 943e78ea..00000000
--- a/vim/after/indent/gitconfig.vim
+++ /dev/null
@@ -1,15 +0,0 @@
-" Use tabs for indent in Git config files, rather than fighting with the
-" frontend tool
-setlocal noexpandtab
-let b:undo_indent .= '|setlocal expandtab<'
-if v:version > 703
- \ || v:version == 703 && has('patch629')
- setlocal shiftwidth=0
-else
- let &l:shiftwidth = &l:tabstop
-endif
-let b:undo_indent .= '|setlocal shiftwidth<'
-if &softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_indent .= '|setlocal softtabstop<'
-endif
diff --git a/vim/after/indent/html.vim b/vim/after/indent/html.vim
index a7a085fe..72c92d21 100644
--- a/vim/after/indent/html.vim
+++ b/vim/after/indent/html.vim
@@ -4,3 +4,12 @@ unlet html_indent_inctags
" Don't re-indent lines on right-angle-bracket or enter
setlocal indentkeys-=<>>,<Return>
let b:undo_ftplugin .= '|setlocal indentkeys<'
+
+" Use four spaces for indentation
+setlocal expandtab
+setlocal shiftwidth=4
+let b:undo_ftplugin .= '|setlocal expandtab< shiftwidth<'
+if &l:softtabstop != -1
+ let &l:softtabstop = &l:shiftwidth
+ let b:undo_ftplugin .= '|setlocal softtabstop<'
+endif
diff --git a/vim/after/indent/make.vim b/vim/after/indent/make.vim
deleted file mode 100644
index 116ea25c..00000000
--- a/vim/after/indent/make.vim
+++ /dev/null
@@ -1,14 +0,0 @@
-" Use plain old tabs for Makefiles (of course)
-setlocal noexpandtab
-let b:undo_indent = 'setlocal expandtab<'
-if v:version > 703
- \ || v:version == 703 && has('patch629')
- setlocal shiftwidth=0
-else
- let &l:shiftwidth = &l:tabstop
-endif
-let b:undo_indent .= '|setlocal shiftwidth<'
-if &softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_indent .= '|setlocal softtabstop<'
-endif
diff --git a/vim/after/indent/perl.vim b/vim/after/indent/perl.vim
new file mode 100644
index 00000000..ba6dfdeb
--- /dev/null
+++ b/vim/after/indent/perl.vim
@@ -0,0 +1,8 @@
+" Use four spaces for indentation
+setlocal expandtab
+setlocal shiftwidth=4
+let b:undo_ftplugin .= '|setlocal expandtab< shiftwidth<'
+if &l:softtabstop != -1
+ let &l:softtabstop = &l:shiftwidth
+ let b:undo_ftplugin .= '|setlocal softtabstop<'
+endif
diff --git a/vim/after/indent/php.vim b/vim/after/indent/php.vim
new file mode 100644
index 00000000..ba6dfdeb
--- /dev/null
+++ b/vim/after/indent/php.vim
@@ -0,0 +1,8 @@
+" Use four spaces for indentation
+setlocal expandtab
+setlocal shiftwidth=4
+let b:undo_ftplugin .= '|setlocal expandtab< shiftwidth<'
+if &l:softtabstop != -1
+ let &l:softtabstop = &l:shiftwidth
+ let b:undo_ftplugin .= '|setlocal softtabstop<'
+endif
diff --git a/vim/after/indent/sh.vim b/vim/after/indent/sh.vim
new file mode 100644
index 00000000..ba6dfdeb
--- /dev/null
+++ b/vim/after/indent/sh.vim
@@ -0,0 +1,8 @@
+" Use four spaces for indentation
+setlocal expandtab
+setlocal shiftwidth=4
+let b:undo_ftplugin .= '|setlocal expandtab< shiftwidth<'
+if &l:softtabstop != -1
+ let &l:softtabstop = &l:shiftwidth
+ let b:undo_ftplugin .= '|setlocal softtabstop<'
+endif
diff --git a/vim/after/indent/vim.vim b/vim/after/indent/vim.vim
index 0767bca0..320e5d7d 100644
--- a/vim/after/indent/vim.vim
+++ b/vim/after/indent/vim.vim
@@ -6,8 +6,9 @@ if !exists('b:undo_indent')
endif
" Observe VimL conventions for two-space indents
+setlocal expandtab
setlocal shiftwidth=2
-let b:undo_indent .= '|setlocal shiftwidth<'
+let b:undo_indent .= '|setlocal expandtab< shiftwidth<'
if &softtabstop != -1
let &l:softtabstop = &l:shiftwidth
let b:undo_indent .= '|setlocal softtabstop<'
diff --git a/vim/indent/csv.vim b/vim/indent/csv.vim
deleted file mode 100644
index e97ab29e..00000000
--- a/vim/indent/csv.vim
+++ /dev/null
@@ -1,24 +0,0 @@
-" Only do this when not done yet for this buffer
-if exists('b:did_indent')
- finish
-endif
-let b:did_indent = 1
-
-" Manual indenting
-setlocal noautoindent
-let b:undo_indent = 'setlocal autoindent<'
-
-" Literal tabs
-setlocal noexpandtab
-let b:undo_indent .= '|setlocal expandtab<'
-if v:version > 703
- \ || v:version == 703 && has('patch629')
- setlocal shiftwidth=0
-else
- let &l:shiftwidth = &l:tabstop
-endif
-let b:undo_indent .= '|setlocal shiftwidth<'
-if &softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_indent .= '|setlocal softtabstop<'
-endif
diff --git a/vim/indent/help.vim b/vim/indent/help.vim
deleted file mode 100644
index 78de85d0..00000000
--- a/vim/indent/help.vim
+++ /dev/null
@@ -1,20 +0,0 @@
-" Only do this when not done yet for this buffer
-if exists('b:did_indent')
- finish
-endif
-let b:did_indent = 1
-
-" Literal tabs
-setlocal noexpandtab
-let b:undo_indent = 'setlocal expandtab<'
-if v:version > 703
- \ || v:version == 703 && has('patch629')
- setlocal shiftwidth=0
-else
- let &l:shiftwidth = &l:tabstop
-endif
-let b:undo_indent .= '|setlocal shiftwidth<'
-if &softtabstop != -1
- let &l:softtabstop = &l:shiftwidth
- let b:undo_indent .= '|setlocal softtabstop<'
-endif
diff --git a/vim/indent/tsv.vim b/vim/indent/tsv.vim
deleted file mode 100644
index ae72397c..00000000
--- a/vim/indent/tsv.vim
+++ /dev/null
@@ -1,2 +0,0 @@
-" TSVs have the same indent options as CSVs
-runtime! indent/csv.vim
diff --git a/vim/vimrc b/vim/vimrc
index 9e24e8bd..3eb1dbbe 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -257,12 +257,11 @@ command! -bar ReloadFileType
" first. Surely just `:source $MYVIMRC` would be good enough?
"
" The problem is there are potential side effects to the current buffer when
-" the vimrc is reloaded. The :set commands for options like 'expandtab' and
-" 'shiftwidth' may trample over different buffer-local settings that were
-" specified by filetype and indent plugins. To ensure these local values are
-" reinstated, we'll define the new command wrapper around an autoloaded
-" function that itself issues a :ReloadFileType command after the vimrc file
-" is sourced.
+" the vimrc is reloaded. The global :set commands for some options may
+" trample over different buffer-local settings that were specified by filetype
+" and indent plugins. To ensure these local values are reinstated, we'll
+" define the new command wrapper around an autoloaded function that itself
+" issues a :ReloadFileType command after the vimrc file is sourced.
"
" We can't put the actual :source command into the script-local function we
" define here, because Vim would get upset that we're trying to redefine
@@ -415,33 +414,6 @@ endtry
set comments= commentstring= define= include=
set path-=/usr/include
-" Next, we’ll adjust the global indentation settings. In general and as
-" a default, I prefer spaces to tabs, and I like to use four of them, for
-" a more distinct visual structure. Should you happen to disagree with this,
-" I cordially invite you to fite me irl.
-"
-" <https://sanctum.geek.nz/blinkenlights/spaces.webm>
-"
-" Filetype indent plugins will often refine these settings for individual
-" buffers. For example, 'expandtab' is not appropriate for Makefiles, nor for
-" the Go programming language. For another, two-space indents are more
-" traditional for Vim script.
-"
-set autoindent
-set expandtab
-set shiftwidth=4
-set smarttab
-
-" Apply 'softtabstop' option to make a tab key press in insert mode insert the
-" same number of spaces as defined by the indent depth in 'shiftwidth'. If
-" Vim is new enough to support it (v7.3.693), apply a negative value to do
-" this dynamically if 'shiftwidth' changes.
-"
-" <https://github.com/vim/vim/releases/tag/v7.3.693>
-"
-execute 'set softtabstop='
- \ . escape#Arg(has#('patch-7.3.693') ? -1 : &shiftwidth)
-
" Relax traditional vi’s harsh standards over what regions of the buffer can
" be removed with backspace in insert mode. While this admittedly allows bad
" habits to continue, since insert mode by definition is not really intended