aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-06-25 09:00:52 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-06-25 09:00:52 +1200
commit669b695d8f8663f4c1bc8514e0738e2963b66167 (patch)
tree15b1f7119bd198d810b312bc6f194ab12d489e19 /vim
parentCorrect .vimrc comment (diff)
downloaddotfiles-669b695d8f8663f4c1bc8514e0738e2963b66167.tar.gz
dotfiles-669b695d8f8663f4c1bc8514e0738e2963b66167.zip
Move all local bindings out into .vimrc
This is the natural way of things, I think.
Diffstat (limited to 'vim')
-rw-r--r--vim/after/ftplugin/html/lint.vim9
-rw-r--r--vim/after/ftplugin/html/tidy.vim9
-rw-r--r--vim/after/ftplugin/perl/check.vim9
-rw-r--r--vim/after/ftplugin/perl/lint.vim9
-rw-r--r--vim/after/ftplugin/perl/tidy.vim9
-rw-r--r--vim/after/ftplugin/php/check.vim9
-rw-r--r--vim/after/ftplugin/sh/check.vim9
-rw-r--r--vim/after/ftplugin/sh/lint.vim9
-rw-r--r--vim/after/ftplugin/vim/lint.vim9
-rw-r--r--vim/after/ftplugin/zsh/check.vim9
-rw-r--r--vim/vimrc45
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 <buffer> <silent> <unique>
\ :<C-U>call compiler#Make('tidy')<CR>
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> <Plug>HtmlLint'
-
-" If there isn't a key mapping already, use a default one
-if !hasmapto('<Plug>HtmlLint')
- nmap <buffer> <unique>
- \ <LocalLeader>l
- \ <Plug>HtmlLint
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>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 <buffer> <silent> <unique>
\ :<C-U>call filter#Stable('tidy -quiet')<CR>
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> <Plug>HtmlTidy'
-
-" If there isn't a key mapping already, use a default one
-if !hasmapto('<Plug>HtmlTidy')
- nmap <buffer> <unique>
- \ <LocalLeader>t
- \ <Plug>HtmlTidy
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>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 <buffer> <silent> <unique>
\ :<C-U>call compiler#Make('perl')<CR>
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> <Plug>PerlCheck'
-
-" If there isn't a key mapping already, use a default one
-if !hasmapto('<Plug>PerlCheck')
- nmap <buffer> <unique>
- \ <LocalLeader>c
- \ <Plug>PerlCheck
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>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 <buffer> <silent> <unique>
\ :<C-U>call compiler#Make('perlcritic')<CR>
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> <Plug>PerlLint'
-
-" If there isn't a key mapping already, use a default one
-if !hasmapto('<Plug>PerlLint')
- nmap <buffer> <unique>
- \ <LocalLeader>l
- \ <Plug>PerlLint
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>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 <buffer> <silent> <unique>
\ :<C-U>call filter#Stable('perltidy')<CR>
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> <Plug>PerlTidy'
-
-" If there isn't a key mapping already, use a default one
-if !hasmapto('<Plug>PerlTidy')
- nmap <buffer> <unique>
- \ <LocalLeader>t
- \ <Plug>PerlTidy
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>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 <buffer> <silent> <unique>
\ :<C-U>call compiler#Make('php')<CR>
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> <Plug>PhpCheck'
-
-" If there isn't a key mapping already, use a default one
-if !hasmapto('<Plug>PhpCheck')
- nmap <buffer> <unique>
- \ <LocalLeader>c
- \ <Plug>PhpCheck
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>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 <buffer> <silent> <unique>
\ :<C-U>call compiler#Make(b:sh_check_compiler)<CR>
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> <Plug>ShCheck'
-
-" If there isn't a key mapping already, use a default one
-if !hasmapto('<Plug>ShCheck')
- nmap <buffer> <unique>
- \ <LocalLeader>c
- \ <Plug>ShCheck
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>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 <buffer> <silent> <unique>
\ :<C-U>call compiler#Make('shellcheck')<CR>
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> <Plug>ShLint'
-
-" If there isn't a key mapping already, use a default one
-if !hasmapto('<Plug>ShLint')
- nmap <buffer> <unique>
- \ <LocalLeader>l
- \ <Plug>ShLint
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>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 <buffer> <silent> <unique>
\ :<C-U>call compiler#Make('vint')<CR>
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> <Plug>VimLint'
-
-" If there isn't a key mapping already, use a default one
-if !hasmapto('<Plug>VimLint')
- nmap <buffer> <unique>
- \ <LocalLeader>l
- \ <Plug>VimLint
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>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 <buffer> <silent> <unique>
\ :<C-U>call compiler#Make('zsh')<CR>
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> <Plug>ZshCheck'
-
-" If there isn't a key mapping already, use a default one
-if !hasmapto('<Plug>ZshCheck')
- nmap <buffer> <unique>
- \ <LocalLeader>c
- \ <Plug>ZshCheck
- let b:undo_ftplugin = b:undo_ftplugin
- \ . '|nunmap <buffer> <LocalLeader>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
" <Leader> so that the non-plugin mappings work on vim-tiny
@@ -272,14 +266,43 @@ nmap \x <Plug>StripTrailingWhitespace
" \z sets NZ English spelling (compare \u)
nnoremap \z :<C-U>setlocal spelllang=en_nz spelllang?<CR>
-" 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
+" <LocalLeader> to keep the commands short
if has('autocmd') && v:version >= 700
augroup vimrc
autocmd!
- autocmd FileType diff
- \ nmap <buffer> <LocalLeader>p <Plug>DiffPrune
- autocmd FileType diff
- \ xmap <buffer> <LocalLeader>p <Plug>DiffPrune
+
+ " Diff: prune sections
+ autocmd FileType diff nmap <buffer> _p <Plug>DiffPrune
+ autocmd FileType diff xmap <buffer> _p <Plug>DiffPrune
+
+ " HTML: lint and tidy
+ autocmd FileType html nmap <buffer> _l <Plug>HtmlLint
+ autocmd FileType html nmap <buffer> _t <Plug>HtmlTidy
+
+ " Perl: check, lint, and tidy
+ autocmd FileType perl nmap <buffer> _c <Plug>PerlCheck
+ autocmd FileType perl nmap <buffer> _l <Plug>PerlLint
+ autocmd FileType perl nmap <buffer> _t <Plug>PerlTidy
+
+ " PHP: check
+ autocmd FileType php nmap <buffer> _c <Plug>PhpCheck
+
+ " Shell: check and lint
+ autocmd FileType sh nmap <buffer> _c <Plug>ShCheck
+ autocmd FileType sh nmap <buffer> _l <Plug>ShLint
+
+ " VimL: lint
+ autocmd FileType vim nmap <buffer> _l <Plug>VimLint
+
+ " Zsh: check
+ autocmd FileType zsh nmap <buffer> _c <Plug>ZshCheck
+
augroup END
endif