From 4a4341936d2911820abddd67882f9b867496abbb Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 18 Dec 2019 17:05:08 +1300 Subject: Put common indent setting patterns in macros --- vim/after/indent/awk.vim | 8 +------- vim/after/indent/css.vim | 8 +------- vim/after/indent/html.vim | 12 +++--------- vim/after/indent/javascript.vim | 8 +------- vim/after/indent/mail.vim | 8 +------- vim/after/indent/perl.vim | 8 +------- vim/after/indent/php.vim | 8 +------- vim/after/indent/sh.vim | 8 +------- vim/after/indent/vim.vim | 12 +++--------- 9 files changed, 13 insertions(+), 67 deletions(-) (limited to 'vim/after/indent') diff --git a/vim/after/indent/awk.vim b/vim/after/indent/awk.vim index ba6dfdeb..951c830a 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 +runtime macros/indent/spaces/4.vim diff --git a/vim/after/indent/css.vim b/vim/after/indent/css.vim index ba6dfdeb..951c830a 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 +runtime macros/indent/spaces/4.vim diff --git a/vim/after/indent/html.vim b/vim/after/indent/html.vim index 72c92d21..fb7f4127 100644 --- a/vim/after/indent/html.vim +++ b/vim/after/indent/html.vim @@ -1,15 +1,9 @@ +" Use four spaces for indentation +runtime macros/indent/spaces/4.vim + " 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-=<>>, 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..951c830a 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 +runtime macros/indent/spaces/4.vim diff --git a/vim/after/indent/mail.vim b/vim/after/indent/mail.vim index ba6dfdeb..951c830a 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 +runtime macros/indent/spaces/4.vim diff --git a/vim/after/indent/perl.vim b/vim/after/indent/perl.vim index ba6dfdeb..951c830a 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 +runtime macros/indent/spaces/4.vim diff --git a/vim/after/indent/php.vim b/vim/after/indent/php.vim index ba6dfdeb..951c830a 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 +runtime macros/indent/spaces/4.vim diff --git a/vim/after/indent/sh.vim b/vim/after/indent/sh.vim index ba6dfdeb..951c830a 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 +runtime macros/indent/spaces/4.vim diff --git a/vim/after/indent/vim.vim b/vim/after/indent/vim.vim index 320e5d7d..59179225 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 +runtime macros/indent/spaces/2.vim + " 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 -- cgit v1.2.3