commit e002cdb7cfd4682d0be393d047e86fd6fa214a88
parent d347fad8c9a6aeb9bbfb43b67029cd55a0f75176
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Thu, 15 Aug 2019 20:45:02 +0200
vim: compiler definitions
Former-commit-id: fd7e1affb935992f803daaa12809b68b9826579a
Diffstat:
15 files changed, 98 insertions(+), 19 deletions(-)
diff --git a/vim/after/ftplugin/ada.vim b/vim/after/ftplugin/ada.vim
@@ -1,3 +1,6 @@
-setlocal makeprg=gnatmake\ %
-setlocal errorformat=%f:%l:%c:\ %m,%f:%l:%c:\ %tarning:\ %m,%f:%l:%c:\ (%ttyle)\ %m
-let b:undo_ftplugin .= '|setlocal makeprg< errorformat<'
+compiler ada
+if exists('b:undo_ftplugin')
+ let b:undo_ftplugin .= '|setlocal makeprg< errorformat<'
+else
+ let b:undo_ftplugin = 'setlocal makeprg< errorformat<'
+endif
diff --git a/vim/after/ftplugin/c.vim b/vim/after/ftplugin/c.vim
@@ -3,4 +3,8 @@ nnoremap <buffer> <leader>mc :silent make clean<CR>\|:redraw!<CR>
if v:version >= 800
packadd termdebug
endif
-let b:undo_ftplugin .= ''
+if exists('b:undo_ftplugin')
+ let b:undo_ftplugin .= ''
+else
+ let b:undo_ftplugin = ''
+endif
diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim
@@ -1,3 +1,7 @@
setlocal spell
setlocal spelllang=en
-let b:undo_ftplugin .= '|setlocal spell< spelllang<'
+if exists('b:undo_ftplugin')
+ let b:undo_ftplugin .= '|setlocal spell< spelllang<'
+else
+ let b:undo_ftplugin = 'setlocal spell< spelllang<'
+endif
diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim
@@ -4,7 +4,10 @@ inoremap <buffer> ;3 ###
inoremap <buffer> ;4 ####
inoremap <buffer> ;5 #####
inoremap <buffer> ;6 ######
-setlocal makeprg=pandoc\ %:p:S\ -o\ %:p:r:S.pdf\ \&\&\ open\ -g\ %:p:r:S.pdf
-setlocal conceallevel=2
+compiler markdown
setlocal wrap
-let b:undo_ftplugin .= '|setlocal makeprg< conceallevel< wrap <'
+if exists('b:undo_ftplugin')
+ let b:undo_ftplugin .= '|setlocal makeprg< conceallevel< wrap <'
+else
+ let b:undo_ftplugin = 'setlocal makeprg< conceallevel< wrap <'
+endif
diff --git a/vim/after/ftplugin/netrw.vim b/vim/after/ftplugin/netrw.vim
@@ -1,2 +1,6 @@
setlocal bufhidden=delete
-let b:undo_ftplugin .= '|setlocal bufhidden<'
+if exists('b:undo_ftplugin')
+ let b:undo_ftplugin .= '|setlocal bufhidden<'
+else
+ let b:undo_ftplugin = 'setlocal bufhidden<'
+endif
diff --git a/vim/after/ftplugin/qf.vim b/vim/after/ftplugin/qf.vim
@@ -1,2 +1,6 @@
setlocal nocursorline
-let b:undo_ftplugin .= '|setlocal nocursorline<'
+if exists('b:undo_ftplugin')
+ let b:undo_ftplugin .= '|setlocal nocursorline<'
+else
+ let b:undo_ftplugin = 'setlocal nocursorline<'
+endif
diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim
@@ -1,2 +1,6 @@
-setlocal makeprg=shellcheck\ -f\ gcc\ %
-let b:undo_ftplugin .= '|setlocal makeprg<'
+compiler sh
+if exists('b:undo_ftplugin')
+ let b:undo_ftplugin .= '|setlocal makeprg<'
+else
+ let b:undo_ftplugin = 'setlocal makeprg<'
+endif
diff --git a/vim/after/ftplugin/tagbar.vim b/vim/after/ftplugin/tagbar.vim
@@ -1,2 +1,6 @@
setlocal nocursorline
-let b:undo_ftplugin .= '|setlocal nocursorline<'
+if exists('b:undo_ftplugin')
+ let b:undo_ftplugin .= '|setlocal nocursorline<'
+else
+ let b:undo_ftplugin = 'setlocal nocursorline<'
+endif
diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim
@@ -1,2 +1,6 @@
setlocal keywordprg=:help
-let b:undo_ftplugin .= '|setlocal keywordprg<'
+if exists('b:undo_ftplugin')
+ let b:undo_ftplugin .= '|setlocal keywordprg<'
+else
+ let b:undo_ftplugin = 'setlocal keywordprg<'
+endif
diff --git a/vim/after/ftplugin/vimcolor.vim b/vim/after/ftplugin/vimcolor.vim
@@ -1,4 +1,12 @@
-setlocal makeprg=colgen.rb\ %
-autocmd BufWritePost <buffer> silent make | execute 'colorscheme '.expand('%:p:t:r')
-vmap CH <Plug>Colorizer
-noremap CC :ColorClear<CR>
+compiler vimcolor
+augroup vimcolor_buffer
+ autocmd! * <buffer>
+ autocmd BufWritePost <buffer> silent make | execute 'colorscheme '.expand('%:p:t:r')
+augroup END
+vmap <buffer> CH <Plug>Colorizer
+noremap <buffer> CC :ColorClear<CR>
+if exists('b:undo_ftplugin')
+ let b:undo_ftplugin .= '|setlocal makeprg< | exe "au! vimcolor_buffer * <buffer>"'
+else
+ let b:undo_ftplugin = 'setlocal makeprg< | exe "au! vimcolor_buffer * <buffer>"'
+endif
diff --git a/vim/after/ftplugin/vimwiki.vim b/vim/after/ftplugin/vimwiki.vim
@@ -1,3 +1,7 @@
setlocal wrap shiftwidth=4 tabstop=4 softtabstop=4 breakindent breakindentopt=shift:3
cabbrev <buffer> table VimwikiTable
-let b:undo_ftplugin .= '|setlocal wrap< shiftwidth< tabstop< softtabstop< breakindent< breakindentopt<'
+if exists('b:undo_ftplugin')
+ let b:undo_ftplugin .= '|setlocal wrap< shiftwidth< tabstop< softtabstop< breakindent< breakindentopt<'
+else
+ let b:undo_ftplugin = 'setlocal wrap< shiftwidth< tabstop< softtabstop< breakindent< breakindentopt<'
+endif
diff --git a/vim/compiler/ada.vim b/vim/compiler/ada.vim
@@ -0,0 +1,9 @@
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "ada"
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal <args>
+endif
+CompilerSet makeprg=gnatmake\ %
+CompilerSet errorformat=%f:%l:%c:\ %m,%f:%l:%c:\ %tarning:\ %m,%f:%l:%c:\ (%ttyle)\ %m
diff --git a/vim/compiler/markdown.vim b/vim/compiler/markdown.vim
@@ -0,0 +1,8 @@
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "markdown"
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal <args>
+endif
+CompilerSet makeprg=pandoc\ %:p:S\ -o\ %:p:r:S.pdf\ \&\&\ open\ -g\ %:p:r:S.pdf
diff --git a/vim/compiler/sh.vim b/vim/compiler/sh.vim
@@ -0,0 +1,8 @@
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "sh"
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal <args>
+endif
+CompilerSet makeprg=shellcheck\ -f\ gcc\ %
diff --git a/vim/compiler/vimcolor.vim b/vim/compiler/vimcolor.vim
@@ -0,0 +1,8 @@
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "vimcolor"
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal <args>
+endif
+CompilerSet makeprg=colgen.rb\ %