From 669b695d8f8663f4c1bc8514e0738e2963b66167 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 09:00:52 +1200 Subject: Move all local bindings out into .vimrc This is the natural way of things, I think. --- vim/after/ftplugin/html/lint.vim | 9 -------- vim/after/ftplugin/html/tidy.vim | 9 -------- vim/after/ftplugin/perl/check.vim | 9 -------- vim/after/ftplugin/perl/lint.vim | 9 -------- vim/after/ftplugin/perl/tidy.vim | 9 -------- vim/after/ftplugin/php/check.vim | 9 -------- vim/after/ftplugin/sh/check.vim | 9 -------- vim/after/ftplugin/sh/lint.vim | 9 -------- vim/after/ftplugin/vim/lint.vim | 9 -------- vim/after/ftplugin/zsh/check.vim | 9 -------- vim/vimrc | 45 +++++++++++++++++++++++++++++---------- 11 files changed, 34 insertions(+), 101 deletions(-) diff --git a/vim/after/ftplugin/html/lint.vim b/vim/after/ftplugin/html/lint.vim index 0b56e73c..9ab479c0 100644 --- a/vim/after/ftplugin/html/lint.vim +++ b/vim/after/ftplugin/html/lint.vim @@ -31,12 +31,3 @@ nnoremap \ :call compiler#Make('tidy') let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap HtmlLint' - -" If there isn't a key mapping already, use a default one -if !hasmapto('HtmlLint') - nmap - \ l - \ HtmlLint - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap l' -endif diff --git a/vim/after/ftplugin/html/tidy.vim b/vim/after/ftplugin/html/tidy.vim index 3faefcb7..9331486b 100644 --- a/vim/after/ftplugin/html/tidy.vim +++ b/vim/after/ftplugin/html/tidy.vim @@ -31,12 +31,3 @@ nnoremap \ :call filter#Stable('tidy -quiet') let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap HtmlTidy' - -" If there isn't a key mapping already, use a default one -if !hasmapto('HtmlTidy') - nmap - \ t - \ HtmlTidy - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap t' -endif diff --git a/vim/after/ftplugin/perl/check.vim b/vim/after/ftplugin/perl/check.vim index f6f99f08..c810c91f 100644 --- a/vim/after/ftplugin/perl/check.vim +++ b/vim/after/ftplugin/perl/check.vim @@ -26,12 +26,3 @@ nnoremap \ :call compiler#Make('perl') let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap PerlCheck' - -" If there isn't a key mapping already, use a default one -if !hasmapto('PerlCheck') - nmap - \ c - \ PerlCheck - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap c' -endif diff --git a/vim/after/ftplugin/perl/lint.vim b/vim/after/ftplugin/perl/lint.vim index eaa6684c..86741f79 100644 --- a/vim/after/ftplugin/perl/lint.vim +++ b/vim/after/ftplugin/perl/lint.vim @@ -26,12 +26,3 @@ nnoremap \ :call compiler#Make('perlcritic') let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap PerlLint' - -" If there isn't a key mapping already, use a default one -if !hasmapto('PerlLint') - nmap - \ l - \ PerlLint - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap l' -endif diff --git a/vim/after/ftplugin/perl/tidy.vim b/vim/after/ftplugin/perl/tidy.vim index 64f0eda2..c815aba9 100644 --- a/vim/after/ftplugin/perl/tidy.vim +++ b/vim/after/ftplugin/perl/tidy.vim @@ -26,12 +26,3 @@ nnoremap \ :call filter#Stable('perltidy') let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap PerlTidy' - -" If there isn't a key mapping already, use a default one -if !hasmapto('PerlTidy') - nmap - \ t - \ PerlTidy - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap t' -endif diff --git a/vim/after/ftplugin/php/check.vim b/vim/after/ftplugin/php/check.vim index 9dc4c6a8..ea88d39b 100644 --- a/vim/after/ftplugin/php/check.vim +++ b/vim/after/ftplugin/php/check.vim @@ -26,12 +26,3 @@ nnoremap \ :call compiler#Make('php') let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap PhpCheck' - -" If there isn't a key mapping already, use a default one -if !hasmapto('PhpCheck') - nmap - \ c - \ PhpCheck - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap c' -endif diff --git a/vim/after/ftplugin/sh/check.vim b/vim/after/ftplugin/sh/check.vim index 499926f3..48bb72d0 100644 --- a/vim/after/ftplugin/sh/check.vim +++ b/vim/after/ftplugin/sh/check.vim @@ -35,12 +35,3 @@ nnoremap \ :call compiler#Make(b:sh_check_compiler) let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap ShCheck' - -" If there isn't a key mapping already, use a default one -if !hasmapto('ShCheck') - nmap - \ c - \ ShCheck - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap c' -endif diff --git a/vim/after/ftplugin/sh/lint.vim b/vim/after/ftplugin/sh/lint.vim index 65fe003d..a24ba369 100644 --- a/vim/after/ftplugin/sh/lint.vim +++ b/vim/after/ftplugin/sh/lint.vim @@ -26,12 +26,3 @@ nnoremap \ :call compiler#Make('shellcheck') let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap ShLint' - -" If there isn't a key mapping already, use a default one -if !hasmapto('ShLint') - nmap - \ l - \ ShLint - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap l' -endif diff --git a/vim/after/ftplugin/vim/lint.vim b/vim/after/ftplugin/vim/lint.vim index bd8c1da4..b71a7275 100644 --- a/vim/after/ftplugin/vim/lint.vim +++ b/vim/after/ftplugin/vim/lint.vim @@ -26,12 +26,3 @@ nnoremap \ :call compiler#Make('vint') let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap VimLint' - -" If there isn't a key mapping already, use a default one -if !hasmapto('VimLint') - nmap - \ l - \ VimLint - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap l' -endif diff --git a/vim/after/ftplugin/zsh/check.vim b/vim/after/ftplugin/zsh/check.vim index 3e5ad7c6..a439ef8d 100644 --- a/vim/after/ftplugin/zsh/check.vim +++ b/vim/after/ftplugin/zsh/check.vim @@ -26,12 +26,3 @@ nnoremap \ :call compiler#Make('zsh') let b:undo_ftplugin = b:undo_ftplugin \ . '|nunmap ZshCheck' - -" If there isn't a key mapping already, use a default one -if !hasmapto('ZshCheck') - nmap - \ c - \ ZshCheck - let b:undo_ftplugin = b:undo_ftplugin - \ . '|nunmap c' -endif diff --git a/vim/vimrc b/vim/vimrc index e32b14a8..f8a5fb78 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -215,12 +215,6 @@ if has('digraphs') digraph 8: 9731 " SNOWMAN U+2603 endif -" Use different keys for global and local leaders -if 1 - let g:mapleader = '\' - let g:maplocalleader = '_' -endif - " Normal mode leader mappings below; use a literal backslash rather than " so that the non-plugin mappings work on vim-tiny @@ -272,14 +266,43 @@ nmap \x StripTrailingWhitespace " \z sets NZ English spelling (compare \u) nnoremap \z :setlocal spelllang=en_nz spelllang? -" Filetype-specific bindings +" Use underscore for a local leader, for any plugins that use the variable +if 1 + let g:maplocalleader = '_' +endif + +" Filetype-specific mappings below; use a literal underscore rather than +" to keep the commands short if has('autocmd') && v:version >= 700 augroup vimrc autocmd! - autocmd FileType diff - \ nmap p DiffPrune - autocmd FileType diff - \ xmap p DiffPrune + + " Diff: prune sections + autocmd FileType diff nmap _p DiffPrune + autocmd FileType diff xmap _p DiffPrune + + " HTML: lint and tidy + autocmd FileType html nmap _l HtmlLint + autocmd FileType html nmap _t HtmlTidy + + " Perl: check, lint, and tidy + autocmd FileType perl nmap _c PerlCheck + autocmd FileType perl nmap _l PerlLint + autocmd FileType perl nmap _t PerlTidy + + " PHP: check + autocmd FileType php nmap _c PhpCheck + + " Shell: check and lint + autocmd FileType sh nmap _c ShCheck + autocmd FileType sh nmap _l ShLint + + " VimL: lint + autocmd FileType vim nmap _l VimLint + + " Zsh: check + autocmd FileType zsh nmap _c ZshCheck + augroup END endif -- cgit v1.2.3