aboutsummaryrefslogtreecommitdiff
path: root/vim/after/ftplugin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-10 01:55:15 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-10 01:56:49 +1200
commitf36ef6745c3c96914eb7be228125c1d53bf70287 (patch)
treea42fc40eafc296b522071d60d754eb3c83ffece7 /vim/after/ftplugin
parentAdd explicit group to ftdetect rule (diff)
downloaddotfiles-f36ef6745c3c96914eb7be228125c1d53bf70287.tar.gz
dotfiles-f36ef6745c3c96914eb7be228125c1d53bf70287.zip
Overhaul after/ftplugin
Use .= operator to append to b:undo_ftplugin, as we're requiring Vim 7.0 or later everywhere here anyway. Also remove &compatible where we don't need line breaks.
Diffstat (limited to 'vim/after/ftplugin')
-rw-r--r--vim/after/ftplugin/awk.vim6
-rw-r--r--vim/after/ftplugin/c.vim6
-rw-r--r--vim/after/ftplugin/cpp.vim6
-rw-r--r--vim/after/ftplugin/diff.vim5
-rw-r--r--vim/after/ftplugin/gitcommit.vim6
-rw-r--r--vim/after/ftplugin/help.vim5
-rw-r--r--vim/after/ftplugin/html.vim15
-rw-r--r--vim/after/ftplugin/mail.vim5
-rw-r--r--vim/after/ftplugin/make.vim5
-rw-r--r--vim/after/ftplugin/markdown.vim5
-rw-r--r--vim/after/ftplugin/perl.vim18
-rw-r--r--vim/after/ftplugin/php.vim15
-rw-r--r--vim/after/ftplugin/sed.vim6
-rw-r--r--vim/after/ftplugin/sh.vim19
-rw-r--r--vim/after/ftplugin/text.vim5
-rw-r--r--vim/after/ftplugin/vim.vim11
-rw-r--r--vim/after/ftplugin/zsh.vim8
17 files changed, 51 insertions, 95 deletions
diff --git a/vim/after/ftplugin/awk.vim b/vim/after/ftplugin/awk.vim
index 42b3e1db..6a8ac1ac 100644
--- a/vim/after/ftplugin/awk.vim
+++ b/vim/after/ftplugin/awk.vim
@@ -1,11 +1,9 @@
" Extra configuration for AWK scripts
-if &filetype != 'awk' || &compatible || v:version < 700
+if &filetype !=# 'awk' || v:version < 700
finish
endif
" Set comment formats
setlocal comments=:#
setlocal formatoptions+=or
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal comments<'
- \ . '|setlocal formatoptions<'
+let b:undo_ftplugin .= '|setlocal comments< formatoptions'
diff --git a/vim/after/ftplugin/c.vim b/vim/after/ftplugin/c.vim
index ff74d386..e101b20c 100644
--- a/vim/after/ftplugin/c.vim
+++ b/vim/after/ftplugin/c.vim
@@ -1,11 +1,9 @@
" Extra configuration for C files
-if &filetype != 'c' || &compatible || v:version < 700
+if &filetype !=# 'c' || v:version < 700
finish
endif
" Set comment formats
setlocal include=^\\s*#\\s*include
setlocal path+=/usr/include
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal include<'
- \ . '|setlocal path<'
+let b:undo_ftplugin .= '|setlocal include< path<'
diff --git a/vim/after/ftplugin/cpp.vim b/vim/after/ftplugin/cpp.vim
index 9a58cfa5..a826bf43 100644
--- a/vim/after/ftplugin/cpp.vim
+++ b/vim/after/ftplugin/cpp.vim
@@ -1,11 +1,9 @@
" Extra configuration for C++ files
-if &filetype != 'cpp' || &compatible || v:version < 700
+if &filetype !=# 'cpp' || v:version < 700
finish
endif
" Set comment formats
setlocal include=^\\s*#\\s*include
setlocal path+=/usr/include
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal include<'
- \ . '|setlocal path<'
+let b:undo_ftplugin .= '|setlocal include< path<'
diff --git a/vim/after/ftplugin/diff.vim b/vim/after/ftplugin/diff.vim
index 5b0e7b31..1e2bb2f8 100644
--- a/vim/after/ftplugin/diff.vim
+++ b/vim/after/ftplugin/diff.vim
@@ -1,5 +1,5 @@
" Extra configuration for diffs
-if &filetype != 'diff' || &compatible || v:version < 700
+if &filetype !=# 'diff' || v:version < 700 || &compatible
finish
endif
@@ -12,7 +12,6 @@ endif
nmap <buffer> <LocalLeader>p <Plug>(DiffPrune)
xmap <buffer> <LocalLeader>p <Plug>(DiffPrune)
nmap <buffer> <LocalLeader>pp <Plug>(DiffPrune)_
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>p'
+let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>p'
\ . '|xunmap <buffer> <LocalLeader>p'
\ . '|nunmap <buffer> <LocalLeader>pp'
diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim
index e55ebff7..8e365d98 100644
--- a/vim/after/ftplugin/gitcommit.vim
+++ b/vim/after/ftplugin/gitcommit.vim
@@ -1,11 +1,9 @@
" Extra configuration for Git commit messages
-if &filetype != 'gitcommit' || &compatible || v:version < 700
+if &filetype !=# 'gitcommit' || v:version < 700
finish
endif
" Make angle brackets behave like mail quotes
setlocal comments+=n:>
setlocal formatoptions+=coqr
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal comments<'
- \ . '|setlocal formatoptions<'
+let b:undo_ftplugin .= '|setlocal comments< formatoptions<'
diff --git a/vim/after/ftplugin/help.vim b/vim/after/ftplugin/help.vim
index 3d9ad072..eb5cea64 100644
--- a/vim/after/ftplugin/help.vim
+++ b/vim/after/ftplugin/help.vim
@@ -1,5 +1,5 @@
" Extra configuration for Vim help files
-if &filetype != 'help' || &compatible || v:version < 700
+if &filetype !=# 'help' || v:version < 700
finish
endif
@@ -7,6 +7,5 @@ endif
" reading it; don't conceal characters
if &modifiable && !&readonly
setlocal conceallevel=0
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal conceallevel'
+ let b:undo_ftplugin .= '|setlocal conceallevel<'
endif
diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim
index d0625fb7..2faea4f5 100644
--- a/vim/after/ftplugin/html.vim
+++ b/vim/after/ftplugin/html.vim
@@ -1,16 +1,13 @@
" Extra configuration for HTML files
-if &filetype != 'html' || &compatible || v:version < 700
+if &filetype !=# 'html' || v:version < 700 || &compatible
finish
endif
" Use tidy(1) for checking and program formatting
compiler tidy
setlocal equalprg=tidy\ -quiet
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:current_compiler'
- \ . '|setlocal equalprg<'
- \ . '|setlocal errorformat<'
- \ . '|setlocal makeprg<'
+let b:undo_ftplugin .= '|unlet b:current_compiler'
+ \ . '|setlocal equalprg< errorformat< makeprg<'
" Set up hooks for timestamp updating
augroup html_timestamp
@@ -19,8 +16,7 @@ augroup html_timestamp
\| call html#TimestampUpdate()
\|endif
augroup END
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|autocmd! html_timestamp BufWritePre <buffer>'
+let b:undo_ftplugin .= '|autocmd! html_timestamp BufWritePre <buffer>'
" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_html_maps')
@@ -30,5 +26,4 @@ endif
" Set mappings
nnoremap <buffer> <LocalLeader>r
\ :<C-U>call html#UrlLink()<CR>
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>r'
+let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>r'
diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim
index 200358d8..3ecc0310 100644
--- a/vim/after/ftplugin/mail.vim
+++ b/vim/after/ftplugin/mail.vim
@@ -1,9 +1,8 @@
" Extra configuration for mail messages
-if &filetype != 'mail' || &compatible || v:version < 700
+if &filetype !=# 'mail' || v:version < 700
finish
endif
" Add a space to the end of wrapped lines for format-flowed mail
setlocal formatoptions+=w
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal formatoptions<'
+let b:undo_ftplugin .= '|setlocal formatoptions<'
diff --git a/vim/after/ftplugin/make.vim b/vim/after/ftplugin/make.vim
index b946d547..f4b58f5b 100644
--- a/vim/after/ftplugin/make.vim
+++ b/vim/after/ftplugin/make.vim
@@ -1,5 +1,5 @@
" Extra configuration for Makefiles
-if &filetype != 'make' || &compatible || v:version < 700
+if &filetype !=# 'make' || v:version < 700
finish
endif
@@ -11,6 +11,5 @@ endif
" Set mappings
if exists('b:undo_ftplugin')
nmap <buffer> <LocalLeader>m <Plug>MakeTarget
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>m'
+ let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>m'
endif
diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim
index 3c97dd97..d2cf8918 100644
--- a/vim/after/ftplugin/markdown.vim
+++ b/vim/after/ftplugin/markdown.vim
@@ -1,11 +1,10 @@
" Extra configuration for Markdown documents
-if &filetype != 'markdown' || &compatible || v:version < 700
+if &filetype !=# 'markdown' || v:version < 700
finish
endif
" Spellcheck documents we're actually editing (not just viewing)
if &modifiable && !&readonly
setlocal spell
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal spell<'
+ let b:undo_ftplugin .= '|setlocal spell<'
endif
diff --git a/vim/after/ftplugin/perl.vim b/vim/after/ftplugin/perl.vim
index dd5285e3..065a9512 100644
--- a/vim/after/ftplugin/perl.vim
+++ b/vim/after/ftplugin/perl.vim
@@ -1,21 +1,17 @@
" Extra configuration for Perl filetypes
-if &filetype != 'perl' || &compatible || v:version < 700
+if &filetype !=# 'perl' || v:version < 700 || &compatible
finish
endif
" Use Perl itself for checking and Perl::Tidy for tidying
compiler perl
setlocal equalprg=perltidy
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:current_compiler'
- \ . '|setlocal equalprg<'
- \ . '|setlocal errorformat<'
- \ . '|setlocal makeprg<'
+let b:undo_ftplugin .= '|unlet b:current_compiler'
+ \ . '|setlocal equalprg< errorformat< makeprg<'
" Add angle brackets to pairs of matched characters for q<...>
setlocal matchpairs+=<:>
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal matchpairs<'
+let b:undo_ftplugin .= '|setlocal matchpairs<'
" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_perl_maps')
@@ -27,8 +23,7 @@ nnoremap <buffer> <LocalLeader>c
\ :<C-U>compiler perl<CR>
nnoremap <buffer> <LocalLeader>l
\ :<C-U>compiler perlcritic<CR>
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>c'
+let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>c'
\ . '|nunmap <buffer> <LocalLeader>l'
" Bump version numbers
@@ -36,6 +31,5 @@ nmap <buffer> <LocalLeader>v
\ <Plug>PerlVersionBumpMinor
nmap <buffer> <LocalLeader>V
\ <Plug>PerlVersionBumpMajor
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>v'
+let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>v'
\ . '|nunmap <buffer> <LocalLeader>V'
diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim
index 765c1fb9..c98c1264 100644
--- a/vim/after/ftplugin/php.vim
+++ b/vim/after/ftplugin/php.vim
@@ -1,21 +1,17 @@
" Extra configuration for PHP scripts
-if &filetype != 'php' || &compatible || v:version < 700
+if &filetype !=# 'php' || v:version < 700 || &compatible
finish
endif
" Use PHP itself for syntax checking
compiler php
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:current_compiler'
- \ . '|setlocal errorformat<'
- \ . '|setlocal makeprg<'
+let b:undo_ftplugin .= '|unlet b:current_compiler'
+ \ . '|setlocal errorformat< makeprg<'
" Set comment formats
setlocal comments=s1:/*,m:*,ex:*/,://,:#
setlocal formatoptions+=or
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal comments<'
- \ . '|setlocal formatoptions<'
+let b:undo_ftplugin .= '|setlocal comments< formatoptions<'
" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_php_maps')
@@ -23,8 +19,7 @@ if exists('g:no_plugin_maps') || exists('g:no_php_maps')
endif
" Get rid of the core ftplugin's square-bracket maps on unload
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> [['
+let b:undo_ftplugin .= '|nunmap <buffer> [['
\ . '|ounmap <buffer> [['
\ . '|nunmap <buffer> ]]'
\ . '|ounmap <buffer> ]]'
diff --git a/vim/after/ftplugin/sed.vim b/vim/after/ftplugin/sed.vim
index f4045d93..56447a34 100644
--- a/vim/after/ftplugin/sed.vim
+++ b/vim/after/ftplugin/sed.vim
@@ -1,11 +1,9 @@
" Extra configuration for sed scripts
-if &filetype != 'sed' || &compatible || v:version < 700
+if &filetype !=# 'sed' || v:version < 700
finish
endif
" Set comment formats
setlocal comments=:#
setlocal formatoptions+=or
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal comments<'
- \ . '|setlocal formatoptions<'
+let b:undo_ftplugin .= '|setlocal comments< formatoptions<'
diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim
index 5cafdd70..41b1796f 100644
--- a/vim/after/ftplugin/sh.vim
+++ b/vim/after/ftplugin/sh.vim
@@ -1,20 +1,17 @@
" Extra configuration for shell script
-if &filetype != 'sh' || &compatible || v:version < 700
+if &filetype !=# 'sh' || v:version < 700 || &compatible
finish
endif
" Set comment formats
setlocal comments=:#
setlocal formatoptions+=or
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal comments<'
- \ . '|setlocal formatoptions<'
+let b:undo_ftplugin .= '|setlocal comments< formatoptions<'
" If subtype is Bash, set 'keywordprg' to han(1df)
if exists('b:is_bash')
setlocal keywordprg=han
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal keywordprg<'
+ let b:undo_ftplugin .= '|setlocal keywordprg<'
endif
" Choose check compiler based on file subtype
@@ -26,11 +23,8 @@ else
let b:sh_check_compiler = 'sh'
endif
execute 'compiler '.b:sh_check_compiler
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:current_compiler'
- \ . '|unlet b:sh_check_compiler'
- \ . '|setlocal errorformat<'
- \ . '|setlocal makeprg<'
+let b:undo_ftplugin .= '|unlet b:current_compiler b:sh_check_compiler'
+ \ . '|setlocal errorformat< makeprg<'
" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_sh_maps')
@@ -42,6 +36,5 @@ nnoremap <buffer> <expr> <LocalLeader>c
\ ':<C-U>compiler '.b:sh_check_compiler.'<CR>'
nnoremap <buffer> <LocalLeader>l
\ :<C-U>compiler shellcheck<CR>
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>c'
+let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>c'
\ . '|nunmap <buffer> <LocalLeader>l'
diff --git a/vim/after/ftplugin/text.vim b/vim/after/ftplugin/text.vim
index 0ca72122..67948706 100644
--- a/vim/after/ftplugin/text.vim
+++ b/vim/after/ftplugin/text.vim
@@ -1,11 +1,10 @@
" Extra configuration for text files
-if &filetype != 'text' || &compatible || v:version < 700
+if &filetype !=# 'text' || v:version < 700
finish
endif
" Spellcheck documents we're actually editing (not just viewing)
if &modifiable && !&readonly
setlocal spell
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal spell<'
+ let b:undo_ftplugin .= '|setlocal spell<'
endif
diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim
index 2d11b2d6..2b8ddbb9 100644
--- a/vim/after/ftplugin/vim.vim
+++ b/vim/after/ftplugin/vim.vim
@@ -1,14 +1,12 @@
" Extra configuration for Vim scripts
-if &filetype != 'vim' || &compatible || v:version < 700
+if &filetype !=# 'vim' || v:version < 700 || &compatible
finish
endif
" Use Vint as a syntax checker
compiler vint
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:current_compiler'
- \ . '|setlocal errorformat<'
- \ . '|setlocal makeprg<'
+let b:undo_ftplugin .= '|unlet b:current_compiler'
+ \ . '|setlocal errorformat< makeprg'
" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_vim_maps')
@@ -16,8 +14,7 @@ if exists('g:no_plugin_maps') || exists('g:no_vim_maps')
endif
" Get rid of the core ftplugin's square-bracket maps on unload
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> [['
+let b:undo_ftplugin .= '|nunmap <buffer> [['
\ . '|vunmap <buffer> [['
\ . '|nunmap <buffer> ]]'
\ . '|vunmap <buffer> ]]'
diff --git a/vim/after/ftplugin/zsh.vim b/vim/after/ftplugin/zsh.vim
index 8a27846b..49736401 100644
--- a/vim/after/ftplugin/zsh.vim
+++ b/vim/after/ftplugin/zsh.vim
@@ -1,11 +1,9 @@
" Extra configuration for Z shell scripts
-if &filetype != 'zsh' || &compatible || v:version < 700
+if &filetype !=# 'zsh' || v:version < 700 || &compatible
finish
endif
" Use Z shell itself as a syntax checker
compiler zsh
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:current_compiler'
- \ . '|setlocal errorformat<'
- \ . '|setlocal makeprg<'
+let b:undo_ftplugin .= '|unlet b:current_compiler'
+ \ . '|setlocal errorformat< makeprg<'