aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-11-19 22:46:14 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-19 22:46:14 +1300
commit83ab42988ea599fdda31df9460b8c13f3a7aa1f1 (patch)
tree4bdf5c3d8d8349220a65a634079ef9045995e239
parentAdd :lwindow support to Perl check/lint (diff)
downloaddotfiles-83ab42988ea599fdda31df9460b8c13f3a7aa1f1.tar.gz
dotfiles-83ab42988ea599fdda31df9460b8c13f3a7aa1f1.zip
Use :compiler scripts for makeprg setup
I didn't know about :compiler until now. From :help write-compiler-plugin: > A compiler plugin sets options for use with a specific compiler. The > user can load it with the |:compiler| command. The main use is to set > the 'errorformat' and 'makeprg' options. Vim even has "perl" and "tidy" compilers already that seem to work really well. I'll just add in my own and install them.
-rw-r--r--Makefile6
-rw-r--r--vim/after/ftplugin/perl/check.vim3
-rw-r--r--vim/after/ftplugin/perl/lint.vim3
-rw-r--r--vim/compiler/perlcritic.vim11
-rw-r--r--vim/compiler/vint.vim11
5 files changed, 30 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 4d292b46..a899a367 100644
--- a/Makefile
+++ b/Makefile
@@ -44,6 +44,7 @@
install-vim-after-syntax \
install-vim-autoload \
install-vim-bundle \
+ install-vim-compiler \
install-vim-config \
install-vim-ftdetect \
install-vim-gui \
@@ -495,6 +496,7 @@ install-urxvt: urxvt/ext/select
install-vim: install-vim-after \
install-vim-autoload \
install-vim-bundle \
+ install-vim-compiler \
install-vim-config \
install-vim-doc \
install-vim-ftdetect \
@@ -529,6 +531,10 @@ install-vim-bundle: install-vim-config
-type d -exec sh -c 'mkdir -p -- $(HOME)/."$$1"' _ {} \; -o \
-type f -exec sh -c 'cp -p -- "$$1" $(HOME)/."$$1"' _ {} \;
+install-vim-compiler:
+ mkdir -p -- $(HOME)/.vim/compiler
+ cp -p -- vim/compiler/*.vim $(HOME)/.vim/compiler
+
install-vim-config:
mkdir -p -- $(HOME)/.vim/config
cp -p -- vim/vimrc $(HOME)/.vimrc
diff --git a/vim/after/ftplugin/perl/check.vim b/vim/after/ftplugin/perl/check.vim
index ebfbcea6..1a3a6dc8 100644
--- a/vim/after/ftplugin/perl/check.vim
+++ b/vim/after/ftplugin/perl/check.vim
@@ -14,8 +14,7 @@ if !exists('*s:PerlCheck')
function s:PerlCheck()
let l:save_makeprg = &l:makeprg
let l:save_errorformat = &l:errorformat
- let &l:makeprg = 'perl -c %:S'
- let &l:errorformat = '%m at %f line %l.'
+ compiler perl
lmake!
let &l:makeprg = l:save_makeprg
let &l:errorformat = l:save_errorformat
diff --git a/vim/after/ftplugin/perl/lint.vim b/vim/after/ftplugin/perl/lint.vim
index 61856825..8dc4aafe 100644
--- a/vim/after/ftplugin/perl/lint.vim
+++ b/vim/after/ftplugin/perl/lint.vim
@@ -14,8 +14,7 @@ if !exists('*s:PerlLint')
function s:PerlLint()
let l:save_makeprg = &l:makeprg
let l:save_errorformat = &l:errorformat
- let &l:makeprg = 'perlcritic --quiet --verbose 1 %:S'
- let &l:errorformat = '%f:%l:%c:%m'
+ compiler perlcritic
lmake!
let &l:makeprg = l:save_makeprg
let &l:errorformat = l:save_errorformat
diff --git a/vim/compiler/perlcritic.vim b/vim/compiler/perlcritic.vim
new file mode 100644
index 00000000..381e0df3
--- /dev/null
+++ b/vim/compiler/perlcritic.vim
@@ -0,0 +1,11 @@
+if exists('current_compiler')
+ finish
+endif
+let g:current_compiler = 'tidy'
+
+if exists(':CompilerSet') != 2
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+CompilerSet makeprg=perlcritic\ --verbose\ 1\ %:S
+CompilerSet errorformat=%f:%l:%c:%m
diff --git a/vim/compiler/vint.vim b/vim/compiler/vint.vim
new file mode 100644
index 00000000..35a4372e
--- /dev/null
+++ b/vim/compiler/vint.vim
@@ -0,0 +1,11 @@
+if exists('current_compiler')
+ finish
+endif
+let g:current_compiler = 'vimlint'
+
+if exists(':CompilerSet') != 2
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+CompilerSet makeprg=vint\ %:S
+CompilerSet errorformat=%f:%l:%c:\ %m