diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-12-18 17:32:18 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-12-18 17:32:18 +1300 |
commit | c978da17884ef456cb41d28133790550f98b6ae8 (patch) | |
tree | cc8580f3d91f32367b08b5f6d194d705961de71a | |
parent | Merge branch 'release/v8.5.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-c978da17884ef456cb41d28133790550f98b6ae8.tar.gz dotfiles-c978da17884ef456cb41d28133790550f98b6ae8.zip |
Merge branch 'release/v8.6.0'v8.6.0
* release/v8.6.0:
Refactor indent macros into autoload function
Fix indentation of a Makefile line
Put common indent setting patterns in macros
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | vim/after/indent/awk.vim | 8 | ||||
-rw-r--r-- | vim/after/indent/css.vim | 8 | ||||
-rw-r--r-- | vim/after/indent/html.vim | 12 | ||||
-rw-r--r-- | vim/after/indent/javascript.vim | 8 | ||||
-rw-r--r-- | vim/after/indent/mail.vim | 8 | ||||
-rw-r--r-- | vim/after/indent/perl.vim | 8 | ||||
-rw-r--r-- | vim/after/indent/php.vim | 8 | ||||
-rw-r--r-- | vim/after/indent/sh.vim | 8 | ||||
-rw-r--r-- | vim/after/indent/vim.vim | 12 | ||||
-rw-r--r-- | vim/autoload/indent.vim | 32 |
12 files changed, 49 insertions, 71 deletions
@@ -558,7 +558,7 @@ install-vim-after-ftplugin: install-vim-compiler mkdir -p $(VIMDIR)/after/ftplugin cp -p -- vim/after/ftplugin/*.vim $(VIMDIR)/after/ftplugin -install-vim-after-indent: +install-vim-after-indent: install-vim-autoload mkdir -p $(VIMDIR)/after/indent cp -p -- vim/after/indent/*.vim $(VIMDIR)/after/indent @@ -576,7 +576,7 @@ install-vim-autoload: install-vim-bundle: install-vim-config find vim/bundle/*/* \ - -type d -exec sh -c \ + -type d -exec sh -c \ 'mkdir -p -- $(VIMDIR)/"$${1#vim/bundle/*/}"' _ {} \; find vim/bundle/*/*/* \ -type f -exec sh -c \ @@ -1,2 +1,2 @@ -tejr dotfiles v8.5.0 -Wed, 18 Dec 2019 03:02:49 +0000 +tejr dotfiles v8.6.0 +Wed, 18 Dec 2019 04:32:16 +0000 diff --git a/vim/after/indent/awk.vim b/vim/after/indent/awk.vim index ba6dfdeb..61f09a1e 100644 --- a/vim/after/indent/awk.vim +++ b/vim/after/indent/awk.vim @@ -1,8 +1,2 @@ " 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 +call indent#spaces(4) diff --git a/vim/after/indent/css.vim b/vim/after/indent/css.vim index ba6dfdeb..61f09a1e 100644 --- a/vim/after/indent/css.vim +++ b/vim/after/indent/css.vim @@ -1,8 +1,2 @@ " 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 +call indent#spaces(4) diff --git a/vim/after/indent/html.vim b/vim/after/indent/html.vim index 72c92d21..c043f620 100644 --- a/vim/after/indent/html.vim +++ b/vim/after/indent/html.vim @@ -1,15 +1,9 @@ +" Use four spaces for indentation +call indent#spaces(4) + " Clear away the flag we set to indent after paragraphs 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/javascript.vim b/vim/after/indent/javascript.vim index ba6dfdeb..61f09a1e 100644 --- a/vim/after/indent/javascript.vim +++ b/vim/after/indent/javascript.vim @@ -1,8 +1,2 @@ " 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 +call indent#spaces(4) diff --git a/vim/after/indent/mail.vim b/vim/after/indent/mail.vim index ba6dfdeb..61f09a1e 100644 --- a/vim/after/indent/mail.vim +++ b/vim/after/indent/mail.vim @@ -1,8 +1,2 @@ " 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 +call indent#spaces(4) diff --git a/vim/after/indent/perl.vim b/vim/after/indent/perl.vim index ba6dfdeb..61f09a1e 100644 --- a/vim/after/indent/perl.vim +++ b/vim/after/indent/perl.vim @@ -1,8 +1,2 @@ " 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 +call indent#spaces(4) diff --git a/vim/after/indent/php.vim b/vim/after/indent/php.vim index ba6dfdeb..61f09a1e 100644 --- a/vim/after/indent/php.vim +++ b/vim/after/indent/php.vim @@ -1,8 +1,2 @@ " 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 +call indent#spaces(4) diff --git a/vim/after/indent/sh.vim b/vim/after/indent/sh.vim index ba6dfdeb..61f09a1e 100644 --- a/vim/after/indent/sh.vim +++ b/vim/after/indent/sh.vim @@ -1,8 +1,2 @@ " 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 +call indent#spaces(4) diff --git a/vim/after/indent/vim.vim b/vim/after/indent/vim.vim index 320e5d7d..ce99f713 100644 --- a/vim/after/indent/vim.vim +++ b/vim/after/indent/vim.vim @@ -1,15 +1,9 @@ +" Use two (not four!) spaces for indentation, per convention +call indent#spaces(2) + " Remove inapplicable defaults from 'indentkeys'; we should only need to undo " this if the stock plugin didn't already arrange that (before v7.3.539) setlocal indentkeys-=0#,0{,0},0),: if !exists('b:undo_indent') let b:undo_indent = 'setlocal indentkeys<' endif - -" Observe VimL conventions for two-space indents -setlocal expandtab -setlocal shiftwidth=2 -let b:undo_indent .= '|setlocal expandtab< shiftwidth<' -if &softtabstop != -1 - let &l:softtabstop = &l:shiftwidth - let b:undo_indent .= '|setlocal softtabstop<' -endif diff --git a/vim/autoload/indent.vim b/vim/autoload/indent.vim new file mode 100644 index 00000000..3e850c63 --- /dev/null +++ b/vim/autoload/indent.vim @@ -0,0 +1,32 @@ +function! indent#spaces(...) abort + setlocal expandtab + let &l:shiftwidth = a:0 + \ ? a:1 + \ : 0 + let &l:softtabstop = has#('patch-7.3.693') + \ ? -1 + \ : &l:shiftwidth + call indent#undo() +endfunction + +function! indent#tabs() abort + setlocal noexpandtab shiftwidth< softtabstop< + call indent#undo() +endfunction + +function! indent#undo() abort + if exists('b:undo_indent_set') + return + endif + let l:undo = 'call indent#reset()' + if exists('b:undo_indent') + let b:undo_indent .= '|'.l:undo + else + let b:undo_indent = l:undo + endif + let b:undo_indent_set = 1 +endfunction + +function! indent#reset() abort + setlocal expandtab< shiftwidth< softtabstop< tabstop< +endfunction |