diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-17 21:57:54 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-17 21:57:54 +1200 |
commit | e2e6288cf3680469d6f1b3f257876c6ca2f88ac0 (patch) | |
tree | 06ce87523cbe18d960838d1784943a49c226bc97 | |
parent | Merge branch 'release/v0.54.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-0.55.0.tar.gz (sig) dotfiles-0.55.0.zip |
Merge branch 'release/v0.55.0'v0.55.0
* release/v0.55.0:
Bump VERSION
Update auto_cache_dirs.vim
Update markdown_autoformat.vim
Update insert_suspend_hlsearch.vim
Use autoload function for tidy filters
Refine compiler#Make() function
Use autoload function for temp-makeprg :lmake
Add local copy of php.vim compiler
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | VERSION | 4 | ||||
-rw-r--r-- | vim/after/ftplugin/html/lint.vim | 25 | ||||
-rw-r--r-- | vim/after/ftplugin/html/tidy.vim | 19 | ||||
-rw-r--r-- | vim/after/ftplugin/perl/check.vim | 25 | ||||
-rw-r--r-- | vim/after/ftplugin/perl/lint.vim | 25 | ||||
-rw-r--r-- | vim/after/ftplugin/perl/tidy.vim | 19 | ||||
-rw-r--r-- | vim/after/ftplugin/php/check.vim | 34 | ||||
-rw-r--r-- | vim/after/ftplugin/sh/check.vim | 36 | ||||
-rw-r--r-- | vim/after/ftplugin/sh/lint.vim | 25 | ||||
-rw-r--r-- | vim/after/ftplugin/vim/lint.vim | 25 | ||||
-rw-r--r-- | vim/after/ftplugin/zsh/check.vim | 25 | ||||
-rw-r--r-- | vim/autoload/compiler.vim | 33 | ||||
-rw-r--r-- | vim/autoload/filter.vim | 7 | ||||
m--------- | vim/bundle/auto_cache_dirs | 0 | ||||
m--------- | vim/bundle/insert_suspend_hlsearch | 0 | ||||
m--------- | vim/bundle/markdown_autoformat | 0 | ||||
-rw-r--r-- | vim/compiler/php.vim | 23 |
18 files changed, 137 insertions, 193 deletions
@@ -495,6 +495,7 @@ VIMDIR = $(HOME)/.vim VIMRC = $(HOME)/.vimrc install-vim: install-vim-after \ + install-vim-autoload \ install-vim-bundle \ install-vim-compiler \ install-vim-config \ @@ -526,6 +527,10 @@ install-vim-after-syntax: mkdir -p $(VIMDIR)/after/syntax cp -p -- vim/after/syntax/*.vim $(VIMDIR)/after/syntax +install-vim-autoload: + mkdir -p -- $(VIMDIR)/autoload + cp -p -- vim/autoload/*.vim $(VIMDIR)/autoload + install-vim-bundle: install-vim-config find vim/bundle/*/* \ -type d -exec sh -c \ @@ -1,2 +1,2 @@ -tejr dotfiles v0.54.0 -Sat Jun 16 12:59:27 UTC 2018 +tejr dotfiles v0.55.0 +Sun Jun 17 09:57:37 UTC 2018 diff --git a/vim/after/ftplugin/html/lint.vim b/vim/after/ftplugin/html/lint.vim index a3776d60..0b56e73c 100644 --- a/vim/after/ftplugin/html/lint.vim +++ b/vim/after/ftplugin/html/lint.vim @@ -15,33 +15,20 @@ if &filetype !=# 'html' finish endif +" Don't load if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_html_maps') + finish +endif + " Flag as loaded let b:did_ftplugin_html_lint = 1 let b:undo_ftplugin = b:undo_ftplugin \ . '|unlet b:did_ftplugin_html_lint' -" Build function for linter -function! s:HtmlLint() - if exists('b:current_compiler') - let l:save_compiler = b:current_compiler - endif - compiler tidy - lmake! - lwindow - if exists('l:save_compiler') - execute 'compiler ' . l:save_compiler - endif -endfunction - -" Stop here if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_html_maps') - finish -endif - " Define a mapping target nnoremap <buffer> <silent> <unique> \ <Plug>HtmlLint - \ :<C-U>call <SID>HtmlLint()<CR> + \ :<C-U>call compiler#Make('tidy')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>HtmlLint' diff --git a/vim/after/ftplugin/html/tidy.vim b/vim/after/ftplugin/html/tidy.vim index 5a8ded7e..3faefcb7 100644 --- a/vim/after/ftplugin/html/tidy.vim +++ b/vim/after/ftplugin/html/tidy.vim @@ -15,27 +15,20 @@ if &filetype !=# 'html' finish endif +" Don't load if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_html_maps') + finish +endif + " Flag as loaded let b:did_ftplugin_html_tidy = 1 let b:undo_ftplugin = b:undo_ftplugin \ . '|unlet b:did_ftplugin_html_tidy' -" Plugin function -function s:HtmlTidy() - let l:view = winsaveview() - %!tidy -quiet - call winrestview(l:view) -endfunction - -" Stop here if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_html_maps') - finish -endif - " Define a mapping target nnoremap <buffer> <silent> <unique> \ <Plug>HtmlTidy - \ :<C-U>call <SID>HtmlTidy()<CR> + \ :<C-U>call filter#Stable('tidy -quiet')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>HtmlTidy' diff --git a/vim/after/ftplugin/perl/check.vim b/vim/after/ftplugin/perl/check.vim index e115b37f..f6f99f08 100644 --- a/vim/after/ftplugin/perl/check.vim +++ b/vim/after/ftplugin/perl/check.vim @@ -10,33 +10,20 @@ if exists('b:did_ftplugin_perl_check') finish endif +" Don't load if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_perl_maps') + finish +endif + " Flag as loaded let b:did_ftplugin_perl_check = 1 let b:undo_ftplugin = b:undo_ftplugin \ . '|unlet b:did_ftplugin_perl_check' -" Build function for checker -function! s:PerlCheck() - if exists('b:current_compiler') - let l:save_compiler = b:current_compiler - endif - compiler perl - lmake! - lwindow - if exists('l:save_compiler') - execute 'compiler ' . l:save_compiler - endif -endfunction - -" Stop here if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_perl_maps') - finish -endif - " Define a mapping target nnoremap <buffer> <silent> <unique> \ <Plug>PerlCheck - \ :<C-U>call <SID>PerlCheck()<CR> + \ :<C-U>call compiler#Make('perl')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>PerlCheck' diff --git a/vim/after/ftplugin/perl/lint.vim b/vim/after/ftplugin/perl/lint.vim index 3e73ac9a..eaa6684c 100644 --- a/vim/after/ftplugin/perl/lint.vim +++ b/vim/after/ftplugin/perl/lint.vim @@ -10,33 +10,20 @@ if exists('b:did_ftplugin_perl_lint') finish endif +" Don't load if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_html_maps') + finish +endif + " Flag as loaded let b:did_ftplugin_perl_lint = 1 let b:undo_ftplugin = b:undo_ftplugin \ . '|unlet b:did_ftplugin_perl_lint' -" Build function for linter -function! s:PerlLint() - if exists('b:current_compiler') - let l:save_compiler = b:current_compiler - endif - compiler perlcritic - lmake! - lwindow - if exists('l:save_compiler') - execute 'compiler ' . l:save_compiler - endif -endfunction - -" Stop here if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_perl_maps') - finish -endif - " Define a mapping target nnoremap <buffer> <silent> <unique> \ <Plug>PerlLint - \ :<C-U>call <SID>PerlLint()<CR> + \ :<C-U>call compiler#Make('perlcritic')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>PerlLint' diff --git a/vim/after/ftplugin/perl/tidy.vim b/vim/after/ftplugin/perl/tidy.vim index f6744f3a..64f0eda2 100644 --- a/vim/after/ftplugin/perl/tidy.vim +++ b/vim/after/ftplugin/perl/tidy.vim @@ -10,27 +10,20 @@ if exists('b:did_ftplugin_perl_tidy') finish endif +" Don't load if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_perl_maps') + finish +endif + " Flag as loaded let b:did_ftplugin_perl_tidy = 1 let b:undo_ftplugin = b:undo_ftplugin \ . '|unlet b:did_ftplugin_perl_tidy' -" Plugin function -function s:PerlTidy() - let l:view = winsaveview() - %!perltidy - call winrestview(l:view) -endfunction - -" Stop here if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_perl_maps') - finish -endif - " Define a mapping target nnoremap <buffer> <silent> <unique> \ <Plug>PerlTidy - \ :<C-U>call <SID>PerlTidy()<CR> + \ :<C-U>call filter#Stable('perltidy')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>PerlTidy' diff --git a/vim/after/ftplugin/php/check.vim b/vim/after/ftplugin/php/check.vim index f211a642..9dc4c6a8 100644 --- a/vim/after/ftplugin/php/check.vim +++ b/vim/after/ftplugin/php/check.vim @@ -10,42 +10,20 @@ if exists('b:did_ftplugin_php_check') finish endif +" Don't load if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_php_maps') + finish +endif + " Flag as loaded let b:did_ftplugin_php_check = 1 let b:undo_ftplugin = b:undo_ftplugin \ . '|unlet b:did_ftplugin_php_check' -" Build function for checker -function! s:PhpCheck() - if exists('b:current_compiler') - let l:save_compiler = b:current_compiler - endif - compiler php - - " The PHP compiler is unusual: it gets us to provide the filename argument - " ourselves. 7.4.191 is the earliest version with the :S file name modifier, - " which we really should use if we can - if v:version >= 704 || v:version == 704 && has('patch191') - lmake! %:S - else - lmake! % - endif - lwindow - - if exists('l:save_compiler') - execute 'compiler ' . l:save_compiler - endif -endfunction - -" Stop here if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_php_maps') - finish -endif - " Define a mapping target nnoremap <buffer> <silent> <unique> \ <Plug>PhpCheck - \ :<C-U>call <SID>PhpCheck()<CR> + \ :<C-U>call compiler#Make('php')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>PhpCheck' diff --git a/vim/after/ftplugin/sh/check.vim b/vim/after/ftplugin/sh/check.vim index e92409cf..499926f3 100644 --- a/vim/after/ftplugin/sh/check.vim +++ b/vim/after/ftplugin/sh/check.vim @@ -10,39 +10,29 @@ if exists('b:did_ftplugin_sh_check') finish endif +" Stop here if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_sh_maps') + finish +endif + " Flag as loaded let b:did_ftplugin_sh_check = 1 let b:undo_ftplugin = b:undo_ftplugin \ . '|unlet b:did_ftplugin_sh_check' -" Build function for checker -function! s:ShCheck() - if exists('b:current_compiler') - let l:save_compiler = b:current_compiler - endif - if exists('b:is_bash') - compiler bash - elseif exists('b:is_kornshell') - compiler ksh - else - compiler sh - endif - lmake! - lwindow - if exists('l:save_compiler') - execute 'compiler ' . l:save_compiler - endif -endfunction - -" Stop here if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_sh_maps') - finish +" Choose compiler based on file subtype +if exists('b:is_bash') + let b:sh_check_compiler = 'bash' +elseif exists('b:is_kornshell') + let b:sh_check_compiler = 'ksh' +else + let b:sh_check_compiler = 'sh' endif " Define a mapping target nnoremap <buffer> <silent> <unique> \ <Plug>ShCheck - \ :<C-U>call <SID>ShCheck()<CR> + \ :<C-U>call compiler#Make(b:sh_check_compiler)<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>ShCheck' diff --git a/vim/after/ftplugin/sh/lint.vim b/vim/after/ftplugin/sh/lint.vim index 87f1c07e..65fe003d 100644 --- a/vim/after/ftplugin/sh/lint.vim +++ b/vim/after/ftplugin/sh/lint.vim @@ -10,33 +10,20 @@ if exists('b:did_ftplugin_sh_lint') finish endif +" Don't load if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_sh_maps') + finish +endif + " Flag as loaded let b:did_ftplugin_sh_lint = 1 let b:undo_ftplugin = b:undo_ftplugin \ . '|unlet b:did_ftplugin_sh_lint' -" Build function for linter -function! s:ShLint() - if exists('b:current_compiler') - let l:save_compiler = b:current_compiler - endif - compiler shellcheck - lmake! - lwindow - if exists('l:save_compiler') - execute 'compiler ' . l:save_compiler - endif -endfunction - -" Stop here if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_sh_maps') - finish -endif - " Define a mapping target nnoremap <buffer> <silent> <unique> \ <Plug>ShLint - \ :<C-U>call <SID>ShLint()<CR> + \ :<C-U>call compiler#Make('shellcheck')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>ShLint' diff --git a/vim/after/ftplugin/vim/lint.vim b/vim/after/ftplugin/vim/lint.vim index 1e4f7d39..bd8c1da4 100644 --- a/vim/after/ftplugin/vim/lint.vim +++ b/vim/after/ftplugin/vim/lint.vim @@ -10,33 +10,20 @@ if exists('b:did_ftplugin_vim_lint') finish endif +" Don't load if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_vim_maps') + finish +endif + " Flag as loaded let b:did_ftplugin_vim_lint = 1 let b:undo_ftplugin = b:undo_ftplugin \ . '|unlet b:did_ftplugin_vim_lint' -" Build function for linter -function! s:VimLint() - if exists('b:current_compiler') - let l:save_compiler = b:current_compiler - endif - compiler vint - lmake! - lwindow - if exists('l:save_compiler') - execute 'compiler ' . l:save_compiler - endif -endfunction - -" Stop here if the user doesn't want ftplugin mappings -if exists('g:no_plugin_maps') || exists('g:no_vim_maps') - finish -endif - " Define a mapping target nnoremap <buffer> <silent> <unique> \ <Plug>VimLint - \ :<C-U>call <SID>VimLint()<CR> + \ :<C-U>call compiler#Make('vint')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>VimLint' diff --git a/vim/after/ftplugin/zsh/check.vim b/vim/after/ftplugin/zsh/check.vim index 1d327a62..3e5ad7c6 100644 --- a/vim/after/ftplugin/zsh/check.vim +++ b/vim/after/ftplugin/zsh/check.vim @@ -10,33 +10,20 @@ if exists('b:did_ftplugin_zsh_check') finish endif +" Don't load if the user doesn't want ftplugin mappings +if exists('g:no_plugin_maps') || exists('g:no_zsh_maps') + finish +endif + " Flag as loaded let b:did_ftplugin_zsh_check = 1 let b:undo_ftplugin = b:undo_ftplugin \ . '|unlet b:did_ftplugin_zsh_check' -" Build function for checker -function! s:ZshCheck() - if exists('b:current_compiler') - let l:save_compiler = b:current_compiler - endif - compiler zsh - lmake! - lwindow - if exists('l:save_compiler') - execute 'compiler ' . l:save_compiler - endif -endfunction - -" Set up a mapping for the checker, if we're allowed -if exists('g:no_plugin_maps') || exists('g:no_zsh_maps') - finish -endif - " Define a mapping target nnoremap <buffer> <silent> <unique> \ <Plug>ZshCheck - \ :<C-U>call <SID>ZshCheck()<CR> + \ :<C-U>call compiler#Make('zsh')<CR> let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap <buffer> <Plug>ZshCheck' diff --git a/vim/autoload/compiler.vim b/vim/autoload/compiler.vim new file mode 100644 index 00000000..b4bf66b6 --- /dev/null +++ b/vim/autoload/compiler.vim @@ -0,0 +1,33 @@ +" Run a compiler check (:lmake, :lwindow) without trampling over previous +" settings, by temporarily loading the compiler with the given name +function! compiler#Make(compiler) abort + + " Save the given compiler or failing that the current 'makeprg' and + " 'errorformat' values + if exists('b:current_compiler') + let l:save_compiler = b:current_compiler + else + let l:save_makeprg = &makeprg + let l:save_errorformat = &errorformat + endif + + " Choose the compiler + execute 'compiler ' . a:compiler + + " Run the 'makeprg' with results in location list + lmake! + + " If we saved a compiler, switch back to it, otherwise restore the previous + " values for 'makeprg' and 'errorformat' + if exists('l:save_compiler') + execute 'compiler ' . l:save_compiler + else + unlet! b:current_compiler + let &l:makeprg = l:save_makeprg + let &l:errorformat = l:save_errorformat + endif + + " Show location list + lwindow + +endfunction diff --git a/vim/autoload/filter.vim b/vim/autoload/filter.vim new file mode 100644 index 00000000..f499f432 --- /dev/null +++ b/vim/autoload/filter.vim @@ -0,0 +1,7 @@ +" Run a filter over the entire buffer, but save the window position and +" restore it after doing so +function! filter#Stable(command) abort + let l:view = winsaveview() + execute '%' . a:command + call winrestview(l:view) +endfunction diff --git a/vim/bundle/auto_cache_dirs b/vim/bundle/auto_cache_dirs -Subproject b51aebde5bec9d58dba96377e0348fa82274bb8 +Subproject fc1853e7cdda432e9e91b1352038e3cfe591e9d diff --git a/vim/bundle/insert_suspend_hlsearch b/vim/bundle/insert_suspend_hlsearch -Subproject 7dc6de6d44575d238d82461d46def0b51d90af8 +Subproject 6f11733166454e1502a5832f8504826d7f411a8 diff --git a/vim/bundle/markdown_autoformat b/vim/bundle/markdown_autoformat -Subproject aedaec551e8f172a3a30cd893c8374d3e7e2700 +Subproject a109355774c8b1eccfa865156e557ee1734b3f0 diff --git a/vim/compiler/php.vim b/vim/compiler/php.vim new file mode 100644 index 00000000..aeb171c5 --- /dev/null +++ b/vim/compiler/php.vim @@ -0,0 +1,23 @@ +if exists('g:current_compiler') || &compatible + finish +endif +let g:current_compiler = 'php' + +if exists(':CompilerSet') != 2 + command -nargs=* CompilerSet setlocal <args> +endif + +" 7.4.191 is the earliest version with the :S file name modifier, which we +" really should use if we can +if v:version >= 704 || v:version == 704 && has('patch191') + CompilerSet makeprg=php\ -lq\ %:S +else + CompilerSet makeprg=php\ -lq\ % +endif + +" Here be copy-pasted dragons +CompilerSet errorformat=%E<b>%.%#Parse\ error</b>:\ %m\ in\ <b>%f</b>\ on\ line\ <b>%l</b><br\ />, + \%W<b>%.%#Notice</b>:\ %m\ in\ <b>%f</b>\ on\ line\ <b>%l</b><br\ />, + \%E%.%#Parse\ error:\ %m\ in\ %f\ on\ line\ %l, + \%W%.%#Notice:\ %m\ in\ %f\ on\ line\ %l, + \%-G%.%# |