commit 790552934668c7a1fac7d2da6e9601f304ede660
parent ebd4a0b556ff563efbbde4412bd241575d5c4bf3
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Mon, 22 Jun 2020 12:06:11 +0200
vim: change the way undo_ftplugin is done
Former-commit-id: 1c46d08993f8632ee94f513fddcabb7b1d2eab0c
Diffstat:
16 files changed, 41 insertions(+), 66 deletions(-)
diff --git a/vim/after/ftplugin/ada.vim b/vim/after/ftplugin/ada.vim
@@ -1,4 +1,9 @@
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-end
-let b:undo_ftplugin .= '|setlocal makeprg< errorformat<'
+" These two mappings come from the default ada ftplugin
+iunmap <buffer> <leader>aj
+iunmap <buffer> <leader>al
+
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+setlocal suffixesadd+=.adb,.ads
+let &l:include='^\s*with'
+let &l:define='^\s*\(function\|type\|subtype\|procedure\)'
+let b:undo_ftplugin .= 'setlocal makeprg< errorformat< suffixesadd< include< define<'
diff --git a/vim/after/ftplugin/c.vim b/vim/after/ftplugin/c.vim
@@ -1,7 +1,5 @@
if v:version >= 800
packadd termdebug
endif
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-end
-let b:undo_ftplugin .= '| nmapc <buffer>'
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= 'nmapc <buffer>'
diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim
@@ -1,7 +1,5 @@
setlocal spell
setlocal spelllang=en
setlocal formatoptions+=cat
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-end
-let b:undo_ftplugin .= '|setlocal spell< spelllang< formatoptions<'
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= 'setlocal spell< spelllang< formatoptions<'
diff --git a/vim/after/ftplugin/haskell.vim b/vim/after/ftplugin/haskell.vim
@@ -1,5 +1,3 @@
set suffixesadd=.hs
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-end
-let b:undo_ftplugin .= '| set suffixesadd<'
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= 'set suffixesadd<'
diff --git a/vim/after/ftplugin/javascript.vim b/vim/after/ftplugin/javascript.vim
@@ -1,6 +1,4 @@
runtime! ftplugin/html/sparkup.vim
setlocal suffixesadd =.js,.ts
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-end
-let b:undo_ftplugin .= '| setlocal suffixesadd<'
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= 'setlocal suffixesadd<'
diff --git a/vim/after/ftplugin/man.vim b/vim/after/ftplugin/man.vim
@@ -1,6 +1,4 @@
" Make searching for keywords/options easier
nnoremap <buffer> <leader>/ /^ \+
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-end
-let b:undo_ftplugin .= '| nmapc <buffer>'
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= 'nmapc <buffer>'
diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim
@@ -42,10 +42,8 @@ compiler markdown
setlocal wrap textwidth=0 wrapmargin=0 linebreak conceallevel=2 shiftwidth=4 spell
" Undo_ftplugin
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-endif
-let b:undo_ftplugin .= '| imapc <buffer>'
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= 'imapc <buffer>'
let b:undo_ftplugin .= '| nmapc <buffer>'
" let b:undo_ftplugin .= '| execute "au! markdown_autocmds * <buffer>"'
let b:undo_ftplugin .= '| setlocal makeprg< wrap< textwidth< wrapmargin< linebreak< conceallevel< shiftwidth< spell<'
diff --git a/vim/after/ftplugin/plantuml.vim b/vim/after/ftplugin/plantuml.vim
@@ -1,7 +1,5 @@
compiler plantuml
nnoremap <buffer> <leader><CR> :silent !open "%<.png"<CR>:redraw!<CR>
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-end
-let b:undo_ftplugin .= '| nmapc <buffer>'
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= 'nmapc <buffer>'
let b:undo_ftplugin .= '| setlocal makeprg<'
diff --git a/vim/after/ftplugin/qf.vim b/vim/after/ftplugin/qf.vim
@@ -1,5 +1,3 @@
setlocal nocursorline
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-end
-let b:undo_ftplugin .= '|setlocal nocursorline<'
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= 'setlocal nocursorline<'
diff --git a/vim/after/ftplugin/schemer.vim b/vim/after/ftplugin/schemer.vim
@@ -2,8 +2,6 @@ nnoremap <buffer> <leader>CH :ColorHighlight<CR>
vnoremap <buffer> <leader>CH :ColorHighlight<CR>
nnoremap <buffer> <leader>CC :ColorClear<CR>
vnoremap <buffer> <leader>CC :<C-u>ColorClear<CR>
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-end
-let b:undo_ftplugin .= '|mapc <buffer>'
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= 'mapc <buffer>'
let b:undo_ftplugin .= '|nmapc <buffer>'
diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim
@@ -1,5 +1,3 @@
compiler sh
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-end
-let b:undo_ftplugin .= '|setlocal makeprg<'
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= 'setlocal makeprg<'
diff --git a/vim/after/ftplugin/tagbar.vim b/vim/after/ftplugin/tagbar.vim
@@ -1,5 +1,3 @@
setlocal nocursorline
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-end
-let b:undo_ftplugin .= '|setlocal nocursorline<'
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= 'setlocal nocursorline<'
diff --git a/vim/after/ftplugin/tex.vim b/vim/after/ftplugin/tex.vim
@@ -1,4 +1,5 @@
-nnoremap <buffer> <leader>tt :VimtexTocToggle
+nnoremap <buffer> <leader>tt :VimtexTocToggle<CR>
+nnoremap <buffer> <leader>to :VimtexTocOpen<CR>
inoremap <buffer> . .<c-g>u
inoremap <buffer> ? ?<c-g>u
inoremap <buffer> ! !<c-g>u
@@ -7,9 +8,7 @@ inoremap <buffer> : :<c-g>u
inoremap <buffer> ; ;<c-g>u
inoremap <buffer> - -<c-g>u
setlocal formatoptions-=cat wrap
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-end
-let b:undo_ftplugin .= '|nmapc <buffer>'
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= 'nmapc <buffer>'
let b:undo_ftplugin .= '|imapc <buffer>'
let b:undo_ftplugin .= '|setlocal formatoptions< wrap<'
diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim
@@ -1,5 +1,3 @@
setlocal keywordprg=:help
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-end
-let b:undo_ftplugin .= '|setlocal keywordprg<'
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= 'setlocal keywordprg<'
diff --git a/vim/after/ftplugin/vimwiki.vim b/vim/after/ftplugin/vimwiki.vim
@@ -3,9 +3,7 @@ setlocal wrap shiftwidth=4 tabstop=4 softtabstop=4 breakindent breakindentopt=sh
cabbrev <buffer> table VimwikiTable
nmap <buffer> <leader><CR> <Plug>VimwikiSplitLink
-if !exists('b:undo_ftplugin')
- let b:undo_ftplugin = ''
-end
-let b:undo_ftplugin .= '|setlocal wrap< shiftwidth< tabstop< softtabstop< breakindent< breakindentopt<'
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= 'setlocal wrap< shiftwidth< tabstop< softtabstop< breakindent< breakindentopt<'
let b:undo_ftplugin .= '| cabc <buffer>'
let b:undo_ftplugin .= '| nmapc <buffer>'
diff --git a/vim/ultisnips/vim.snippets b/vim/ultisnips/vim.snippets
@@ -1,9 +1,6 @@
snippet undo_ftplugin "Undo an ftplugin config" b
-if exists('b:undo_ftplugin')
- let b:undo_ftplugin .= '| ${1:{changes to make}}'
-else
- let b:undo_ftplugin = '| $1'
-endif
+let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
+let b:undo_ftplugin .= '${1:{changes to make}}'
endsnippet
snippet compiler "Compiler boilerplate" b
if exists("current_compiler")