aboutsummaryrefslogtreecommitdiff
path: root/vim/after/ftplugin
diff options
context:
space:
mode:
Diffstat (limited to 'vim/after/ftplugin')
-rw-r--r--vim/after/ftplugin/awk.vim16
-rw-r--r--vim/after/ftplugin/c.vim16
-rw-r--r--vim/after/ftplugin/cpp.vim16
-rw-r--r--vim/after/ftplugin/diff.vim19
-rw-r--r--vim/after/ftplugin/gitcommit.vim16
-rw-r--r--vim/after/ftplugin/help.vim12
-rw-r--r--vim/after/ftplugin/html.vim38
-rw-r--r--vim/after/ftplugin/mail.vim13
-rw-r--r--vim/after/ftplugin/make.vim21
-rw-r--r--vim/after/ftplugin/markdown.vim15
-rw-r--r--vim/after/ftplugin/perl.vim29
-rw-r--r--vim/after/ftplugin/php.vim27
-rw-r--r--vim/after/ftplugin/sed.vim16
-rw-r--r--vim/after/ftplugin/sh.vim40
-rw-r--r--vim/after/ftplugin/text.vim15
-rw-r--r--vim/after/ftplugin/vim.vim24
-rw-r--r--vim/after/ftplugin/zsh.vim27
17 files changed, 125 insertions, 235 deletions
diff --git a/vim/after/ftplugin/awk.vim b/vim/after/ftplugin/awk.vim
index fae66c3c..42b3e1db 100644
--- a/vim/after/ftplugin/awk.vim
+++ b/vim/after/ftplugin/awk.vim
@@ -1,19 +1,11 @@
-" Extra configuration for 'awk' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for AWK scripts
+if &filetype != 'awk' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'awk'
- finish
-endif
-let b:did_ftplugin_after = 1
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
" Set comment formats
setlocal comments=:#
setlocal formatoptions+=or
let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal comments< formatoptions<'
+ \ . '|setlocal comments<'
+ \ . '|setlocal formatoptions<'
diff --git a/vim/after/ftplugin/c.vim b/vim/after/ftplugin/c.vim
index d98aa130..ff74d386 100644
--- a/vim/after/ftplugin/c.vim
+++ b/vim/after/ftplugin/c.vim
@@ -1,19 +1,11 @@
-" Extra configuration for 'c' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for C files
+if &filetype != 'c' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'c'
- finish
-endif
-let b:did_ftplugin_after = 1
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
" Set comment formats
setlocal include=^\\s*#\\s*include
setlocal path+=/usr/include
let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal include< path<'
+ \ . '|setlocal include<'
+ \ . '|setlocal path<'
diff --git a/vim/after/ftplugin/cpp.vim b/vim/after/ftplugin/cpp.vim
index acecf3e5..9a58cfa5 100644
--- a/vim/after/ftplugin/cpp.vim
+++ b/vim/after/ftplugin/cpp.vim
@@ -1,19 +1,11 @@
-" Extra configuration for 'cpp' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for C++ files
+if &filetype != 'cpp' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'cpp'
- finish
-endif
-let b:did_ftplugin_after = 1
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
" Set comment formats
setlocal include=^\\s*#\\s*include
setlocal path+=/usr/include
let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal include< path<'
+ \ . '|setlocal include<'
+ \ . '|setlocal path<'
diff --git a/vim/after/ftplugin/diff.vim b/vim/after/ftplugin/diff.vim
index 6098ce48..5b0e7b31 100644
--- a/vim/after/ftplugin/diff.vim
+++ b/vim/after/ftplugin/diff.vim
@@ -1,16 +1,7 @@
-" Extra configuration for 'diff' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for diffs
+if &filetype != 'diff' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'diff'
- finish
-endif
-let b:did_ftplugin_after = 1
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_diff_maps')
@@ -18,8 +9,10 @@ if exists('g:no_plugin_maps') || exists('g:no_diff_maps')
endif
" Set mappings
-nmap <buffer> <LocalLeader>p <Plug>DiffPrune
-xmap <buffer> <LocalLeader>p <Plug>DiffPrune
+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'
\ . '|xunmap <buffer> <LocalLeader>p'
+ \ . '|nunmap <buffer> <LocalLeader>pp'
diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim
index d903e84e..e55ebff7 100644
--- a/vim/after/ftplugin/gitcommit.vim
+++ b/vim/after/ftplugin/gitcommit.vim
@@ -1,19 +1,11 @@
-" Extra configuration for 'gitcommit' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for Git commit messages
+if &filetype != 'gitcommit' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'gitcommit'
- finish
-endif
-let b:did_ftplugin_after = 1
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
" Make angle brackets behave like mail quotes
setlocal comments+=n:>
setlocal formatoptions+=coqr
let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal comments< formatoptions<'
+ \ . '|setlocal comments<'
+ \ . '|setlocal formatoptions<'
diff --git a/vim/after/ftplugin/help.vim b/vim/after/ftplugin/help.vim
new file mode 100644
index 00000000..3d9ad072
--- /dev/null
+++ b/vim/after/ftplugin/help.vim
@@ -0,0 +1,12 @@
+" Extra configuration for Vim help files
+if &filetype != 'help' || &compatible || v:version < 700
+ finish
+endif
+
+" If the buffer is modifiable and writable, we're writing documentation, not
+" reading it; don't conceal characters
+if &modifiable && !&readonly
+ setlocal conceallevel=0
+ let b:undo_ftplugin = b:undo_ftplugin
+ \ . '|setlocal conceallevel'
+endif
diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim
index 8a1c22d4..d0625fb7 100644
--- a/vim/after/ftplugin/html.vim
+++ b/vim/after/ftplugin/html.vim
@@ -1,28 +1,26 @@
-" Extra configuration for 'html' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for HTML files
+if &filetype != 'html' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'html'
- finish
-endif
-let b:did_ftplugin_after = 1
+
+" Use tidy(1) for checking and program formatting
+compiler tidy
+setlocal equalprg=tidy\ -quiet
let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
+ \ . '|unlet b:current_compiler'
+ \ . '|setlocal equalprg<'
+ \ . '|setlocal errorformat<'
+ \ . '|setlocal makeprg<'
" Set up hooks for timestamp updating
augroup html_timestamp
- autocmd!
- autocmd BufWritePre *.html
- \ if exists('b:html_timestamp_check')
- \| call html#TimestampUpdate()
- \|endif
+ autocmd BufWritePre <buffer>
+ \ if exists('b:html_timestamp_check')
+ \| call html#TimestampUpdate()
+ \|endif
augroup END
let b:undo_ftplugin = b:undo_ftplugin
- \ . '|augroup html_timestamp|autocmd!|augroup END'
- \ . '|augroup! html_timestamp'
+ \ . '|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,13 +28,7 @@ if exists('g:no_plugin_maps') || exists('g:no_html_maps')
endif
" Set mappings
-nnoremap <buffer> <LocalLeader>l
- \ :<C-U>call compiler#Make('tidy')<CR>
nnoremap <buffer> <LocalLeader>r
\ :<C-U>call html#UrlLink()<CR>
-nnoremap <buffer> <LocalLeader>t
- \ :<C-U>call filter#Stable('tidy -quiet')<CR>
let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>l'
\ . '|nunmap <buffer> <LocalLeader>r'
- \ . '|nunmap <buffer> <LocalLeader>t'
diff --git a/vim/after/ftplugin/mail.vim b/vim/after/ftplugin/mail.vim
index 68e9e17a..200358d8 100644
--- a/vim/after/ftplugin/mail.vim
+++ b/vim/after/ftplugin/mail.vim
@@ -1,16 +1,7 @@
-" Extra configuration for 'mail' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for mail messages
+if &filetype != 'mail' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'mail'
- finish
-endif
-let b:did_ftplugin_after = 1
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
" Add a space to the end of wrapped lines for format-flowed mail
setlocal formatoptions+=w
diff --git a/vim/after/ftplugin/make.vim b/vim/after/ftplugin/make.vim
index 30db753f..b946d547 100644
--- a/vim/after/ftplugin/make.vim
+++ b/vim/after/ftplugin/make.vim
@@ -1,16 +1,7 @@
-" Extra configuration for 'make' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for Makefiles
+if &filetype != 'make' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'make'
- finish
-endif
-let b:did_ftplugin_after = 1
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_make_maps')
@@ -18,6 +9,8 @@ if exists('g:no_plugin_maps') || exists('g:no_make_maps')
endif
" Set mappings
-nmap <buffer> <LocalLeader>m <Plug>MakeTarget
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>m'
+if exists('b:undo_ftplugin')
+ nmap <buffer> <LocalLeader>m <Plug>MakeTarget
+ let b:undo_ftplugin = b:undo_ftplugin
+ \ . '|nunmap <buffer> <LocalLeader>m'
+endif
diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim
index 7ec37c64..3c97dd97 100644
--- a/vim/after/ftplugin/markdown.vim
+++ b/vim/after/ftplugin/markdown.vim
@@ -1,19 +1,10 @@
-" Extra configuration for 'markdown' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for Markdown documents
+if &filetype != 'markdown' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'markdown'
- finish
-endif
-let b:did_ftplugin_after = 1
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
" Spellcheck documents we're actually editing (not just viewing)
-if !&readonly
+if &modifiable && !&readonly
setlocal spell
let b:undo_ftplugin = b:undo_ftplugin
\ . '|setlocal spell<'
diff --git a/vim/after/ftplugin/perl.vim b/vim/after/ftplugin/perl.vim
index 1a7df559..c17ebb56 100644
--- a/vim/after/ftplugin/perl.vim
+++ b/vim/after/ftplugin/perl.vim
@@ -1,33 +1,30 @@
-" Extra configuration for 'perl' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for Perl filetypes
+if &filetype != 'perl' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'perl'
- finish
-endif
-let b:did_ftplugin_after = 1
+
+" Use Perl itself for checking and Perl::Tidy for tidying
+compiler perl
+setlocal equalprg=perltidy
let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
+ \ . '|unlet b:current_compiler'
+ \ . '|setlocal equalprg<'
+ \ . '|setlocal errorformat<'
+ \ . '|setlocal makeprg<'
" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_perl_maps')
finish
endif
-" Set mappings
+" Mappings to choose compiler
nnoremap <buffer> <LocalLeader>c
- \ :<C-U>call compiler#Make('perl')<CR>
+ \ :<C-U>compiler perl<CR>
nnoremap <buffer> <LocalLeader>l
- \ :<C-U>call compiler#Make('perlcritic')<CR>
-nnoremap <buffer> <LocalLeader>t
- \ :<C-U>call filter#Stable('perltidy')<CR>
+ \ :<C-U>compiler perlcritic<CR>
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> <LocalLeader>c'
\ . '|nunmap <buffer> <LocalLeader>l'
- \ . '|nunmap <buffer> <LocalLeader>t'
" Bump version numbers
nmap <buffer> <LocalLeader>v
diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim
index 70e92dfd..765c1fb9 100644
--- a/vim/after/ftplugin/php.vim
+++ b/vim/after/ftplugin/php.vim
@@ -1,34 +1,27 @@
-" Extra configuration for 'php' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for PHP scripts
+if &filetype != 'php' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'php'
- finish
-endif
-let b:did_ftplugin_after = 1
+
+" Use PHP itself for syntax checking
+compiler php
let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
+ \ . '|unlet b:current_compiler'
+ \ . '|setlocal errorformat<'
+ \ . '|setlocal makeprg<'
" Set comment formats
setlocal comments=s1:/*,m:*,ex:*/,://,:#
setlocal formatoptions+=or
let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal comments< formatoptions<'
+ \ . '|setlocal comments<'
+ \ . '|setlocal formatoptions<'
" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_php_maps')
finish
endif
-" Set mappings
-nnoremap <buffer> <LocalLeader>c
- \ :<C-U>call compiler#Make('php')<CR>
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>c'
-
" Get rid of the core ftplugin's square-bracket maps on unload
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> [['
diff --git a/vim/after/ftplugin/sed.vim b/vim/after/ftplugin/sed.vim
index e16ec53d..f4045d93 100644
--- a/vim/after/ftplugin/sed.vim
+++ b/vim/after/ftplugin/sed.vim
@@ -1,19 +1,11 @@
-" Extra configuration for 'sed' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for sed scripts
+if &filetype != 'sed' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'sed'
- finish
-endif
-let b:did_ftplugin_after = 1
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
" Set comment formats
setlocal comments=:#
setlocal formatoptions+=or
let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal comments< formatoptions<'
+ \ . '|setlocal comments<'
+ \ . '|setlocal formatoptions<'
diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim
index 05c3e293..5cafdd70 100644
--- a/vim/after/ftplugin/sh.vim
+++ b/vim/after/ftplugin/sh.vim
@@ -1,22 +1,14 @@
-" Extra configuration for 'sh' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for shell script
+if &filetype != 'sh' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'sh'
- finish
-endif
-let b:did_ftplugin_after = 1
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
" Set comment formats
setlocal comments=:#
setlocal formatoptions+=or
let b:undo_ftplugin = b:undo_ftplugin
- \ . '|setlocal comments< formatoptions<'
+ \ . '|setlocal comments<'
+ \ . '|setlocal formatoptions<'
" If subtype is Bash, set 'keywordprg' to han(1df)
if exists('b:is_bash')
@@ -25,11 +17,6 @@ if exists('b:is_bash')
\ . '|setlocal keywordprg<'
endif
-" Stop here if the user doesn't want ftplugin mappings
-if exists('g:no_plugin_maps') || exists('g:no_sh_maps')
- finish
-endif
-
" Choose check compiler based on file subtype
if exists('b:is_bash')
let b:sh_check_compiler = 'bash'
@@ -38,12 +25,23 @@ elseif exists('b:is_kornshell')
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<'
+
+" Stop here if the user doesn't want ftplugin mappings
+if exists('g:no_plugin_maps') || exists('g:no_sh_maps')
+ finish
+endif
-" Set mappings
-nnoremap <buffer> <LocalLeader>c
- \ :<C-U>call compiler#Make(b:sh_check_compiler)<CR>
+" Mappings to choose compiler
+nnoremap <buffer> <expr> <LocalLeader>c
+ \ ':<C-U>compiler '.b:sh_check_compiler.'<CR>'
nnoremap <buffer> <LocalLeader>l
- \ :<C-U>call compiler#Make('shellcheck')<CR>
+ \ :<C-U>compiler shellcheck<CR>
let b:undo_ftplugin = 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 06ca464a..0ca72122 100644
--- a/vim/after/ftplugin/text.vim
+++ b/vim/after/ftplugin/text.vim
@@ -1,19 +1,10 @@
-" Extra configuration for 'text' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for text files
+if &filetype != 'text' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'text'
- finish
-endif
-let b:did_ftplugin_after = 1
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
" Spellcheck documents we're actually editing (not just viewing)
-if !&readonly
+if &modifiable && !&readonly
setlocal spell
let b:undo_ftplugin = b:undo_ftplugin
\ . '|setlocal spell<'
diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim
index 9710b2d8..2d11b2d6 100644
--- a/vim/after/ftplugin/vim.vim
+++ b/vim/after/ftplugin/vim.vim
@@ -1,28 +1,20 @@
-" Extra configuration for 'vim' filetypes
-if exists('b:did_ftplugin_after') || &compatible
+" Extra configuration for Vim scripts
+if &filetype != 'vim' || &compatible || v:version < 700
finish
endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'vim'
- finish
-endif
-let b:did_ftplugin_after = 1
+
+" Use Vint as a syntax checker
+compiler vint
let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
+ \ . '|unlet b:current_compiler'
+ \ . '|setlocal errorformat<'
+ \ . '|setlocal makeprg<'
" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_vim_maps')
finish
endif
-" Set mappings
-nnoremap <buffer> <LocalLeader>l
- \ :<C-U>call compiler#Make('vint')<CR>
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>l'
-
" Get rid of the core ftplugin's square-bracket maps on unload
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> [['
diff --git a/vim/after/ftplugin/zsh.vim b/vim/after/ftplugin/zsh.vim
index eb5fc035..8a27846b 100644
--- a/vim/after/ftplugin/zsh.vim
+++ b/vim/after/ftplugin/zsh.vim
@@ -1,24 +1,11 @@
-" Extra configuration for 'zsh' filetypes
-if exists('b:did_ftplugin_after') || &compatible
- finish
-endif
-if v:version < 700
- finish
-endif
-if &filetype !=# 'zsh'
- finish
-endif
-let b:did_ftplugin_after = 1
-let b:undo_ftplugin = b:undo_ftplugin
- \ . '|unlet b:did_ftplugin_after'
-
-" Stop here if the user doesn't want ftplugin mappings
-if exists('g:no_plugin_maps') || exists('g:no_zsh_maps')
+" Extra configuration for Z shell scripts
+if &filetype != 'zsh' || &compatible || v:version < 700
finish
endif
-" Set mappings
-nnoremap <buffer> <LocalLeader>c
- \ :<C-U>call compiler#Make('zsh')<CR>
+" Use Z shell itself as a syntax checker
+compiler zsh
let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>c'
+ \ . '|unlet b:current_compiler'
+ \ . '|setlocal errorformat<'
+ \ . '|setlocal makeprg<'