diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-29 23:24:06 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-29 23:24:06 +1200 |
commit | ad69b8aca286a9aa5f95f920199370e5512abcf7 (patch) | |
tree | cae556b33a548283a82dfadb2e38bbf2cd1652d7 /vim/after | |
parent | Refine 'comments' ftplugins further (diff) | |
download | dotfiles-ad69b8aca286a9aa5f95f920199370e5512abcf7.tar.gz dotfiles-ad69b8aca286a9aa5f95f920199370e5512abcf7.zip |
Use ftplugins for filetype mappings instead
Diffstat (limited to 'vim/after')
-rw-r--r-- | vim/after/ftplugin/diff/maps.vim | 23 | ||||
-rw-r--r-- | vim/after/ftplugin/html/maps.vim | 25 | ||||
-rw-r--r-- | vim/after/ftplugin/make/maps.vim | 21 | ||||
-rw-r--r-- | vim/after/ftplugin/perl/maps.vim | 25 | ||||
-rw-r--r-- | vim/after/ftplugin/php/maps.vim | 21 | ||||
-rw-r--r-- | vim/after/ftplugin/sh/maps.vim | 23 | ||||
-rw-r--r-- | vim/after/ftplugin/vim/maps.vim (renamed from vim/after/ftplugin/vim/clear_maps.vim) | 22 | ||||
-rw-r--r-- | vim/after/ftplugin/zsh/maps.vim | 21 |
8 files changed, 170 insertions, 11 deletions
diff --git a/vim/after/ftplugin/diff/maps.vim b/vim/after/ftplugin/diff/maps.vim new file mode 100644 index 00000000..f4ef8fd6 --- /dev/null +++ b/vim/after/ftplugin/diff/maps.vim @@ -0,0 +1,23 @@ +" diff/maps.vim: tejr's mappings for 'diff' filetypes + +" Don't load if running compatible or too old +if &compatible || v:version < 700 + finish +endif + +" Don't load if already loaded +if exists('b:did_ftplugin_diff_maps') + finish +endif + +" Flag as loaded +let b:did_ftplugin_diff_maps = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_diff_maps' + +" Set mappings +nmap <buffer> <LocalLeader>p <Plug>DiffPrune +xmap <buffer> <LocalLeader>p <Plug>DiffPrune +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>p' + \ . '|xunmap <buffer> <LocalLeader>p' diff --git a/vim/after/ftplugin/html/maps.vim b/vim/after/ftplugin/html/maps.vim new file mode 100644 index 00000000..e355d0e6 --- /dev/null +++ b/vim/after/ftplugin/html/maps.vim @@ -0,0 +1,25 @@ +" html/maps.vim: tejr's mappings for 'html' filetypes + +" Don't load if running compatible or too old +if &compatible || v:version < 700 + finish +endif + +" Don't load if already loaded +if exists('b:did_ftplugin_html_maps') + finish +endif + +" Flag as loaded +let b:did_ftplugin_html_maps = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_html_maps' + +" Set mappings +nmap <buffer> <LocalLeader>l <Plug>HtmlLint +nmap <buffer> <LocalLeader>r <Plug>HtmlUrlLink +nmap <buffer> <LocalLeader>t <Plug>HtmlTidy +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>l' + \ . '|nunmap <buffer> <LocalLeader>r' + \ . '|nunmap <buffer> <LocalLeader>t' diff --git a/vim/after/ftplugin/make/maps.vim b/vim/after/ftplugin/make/maps.vim new file mode 100644 index 00000000..bfe82891 --- /dev/null +++ b/vim/after/ftplugin/make/maps.vim @@ -0,0 +1,21 @@ +" make/maps.vim: tejr's mappings for 'make' filetypes + +" Don't load if running compatible or too old +if &compatible || v:version < 700 + finish +endif + +" Don't load if already loaded +if exists('b:did_ftplugin_make_maps') + finish +endif + +" Flag as loaded +let b:did_ftplugin_make_maps = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_make_maps' + +" Set mappings +nmap <buffer> <LocalLeader>m <Plug>MakeTarget +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>m' diff --git a/vim/after/ftplugin/perl/maps.vim b/vim/after/ftplugin/perl/maps.vim new file mode 100644 index 00000000..fe5def10 --- /dev/null +++ b/vim/after/ftplugin/perl/maps.vim @@ -0,0 +1,25 @@ +" perl/maps.vim: tejr's mappings for 'perl' filetypes + +" Don't load if running compatible or too old +if &compatible || v:version < 700 + finish +endif + +" Don't load if already loaded +if exists('b:did_ftplugin_perl_maps') + finish +endif + +" Flag as loaded +let b:did_ftplugin_perl_maps = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_perl_maps' + +" Set mappings +nmap <buffer> <LocalLeader>c <Plug>PerlCheck +nmap <buffer> <LocalLeader>l <Plug>PerlLint +nmap <buffer> <LocalLeader>t <Plug>PerlTidy +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>c' + \ . '|nunmap <buffer> <LocalLeader>l' + \ . '|nunmap <buffer> <LocalLeader>t' diff --git a/vim/after/ftplugin/php/maps.vim b/vim/after/ftplugin/php/maps.vim new file mode 100644 index 00000000..32cc8388 --- /dev/null +++ b/vim/after/ftplugin/php/maps.vim @@ -0,0 +1,21 @@ +" php/maps.vim: tejr's mappings for 'php' filetypes + +" Don't load if running compatible or too old +if &compatible || v:version < 700 + finish +endif + +" Don't load if already loaded +if exists('b:did_ftplugin_php_maps') + finish +endif + +" Flag as loaded +let b:did_ftplugin_php_maps = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_php_maps' + +" Set mappings +nmap <buffer> <LocalLeader>c <Plug>PhpCheck +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>c' diff --git a/vim/after/ftplugin/sh/maps.vim b/vim/after/ftplugin/sh/maps.vim new file mode 100644 index 00000000..e93a84c4 --- /dev/null +++ b/vim/after/ftplugin/sh/maps.vim @@ -0,0 +1,23 @@ +" sh/maps.vim: tejr's mappings for 'sh' filetypes + +" Don't load if running compatible or too old +if &compatible || v:version < 700 + finish +endif + +" Don't load if already loaded +if exists('b:did_ftplugin_sh_maps') + finish +endif + +" Flag as loaded +let b:did_ftplugin_sh_maps = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_sh_maps' + +" Set mappings +nmap <buffer> <LocalLeader>c <Plug>ShCheck +nmap <buffer> <LocalLeader>l <Plug>ShLint +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>c' + \ . '|nunmap <buffer> <LocalLeader>l' diff --git a/vim/after/ftplugin/vim/clear_maps.vim b/vim/after/ftplugin/vim/maps.vim index a84ca4b9..7f2a07a0 100644 --- a/vim/after/ftplugin/vim/clear_maps.vim +++ b/vim/after/ftplugin/vim/maps.vim @@ -1,5 +1,4 @@ -" vim/clear_maps.vim: Fix clearing buffer-local vim maps that the core -" ftplugin leaves in place +" vim/maps.vim: tejr's mappings for 'vim' filetypes " Don't load if running compatible or too old if &compatible || v:version < 700 @@ -7,21 +6,22 @@ if &compatible || v:version < 700 endif " Don't load if already loaded -if exists('b:did_ftplugin_vim_lint') - finish -endif - -" Don't load if the mappings probably weren't loaded in the first place -if exists('g:no_plugin_maps') || exists('g:no_vim_maps') +if exists('b:did_ftplugin_vim_maps') finish endif " Flag as loaded -let b:did_ftplugin_vim_clear_maps = 1 +let b:did_ftplugin_vim_maps = 1 let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_vim_clear_maps' + \ . '|unlet b:did_ftplugin_vim_maps' -" Add undo commands +" Set mappings +nmap <buffer> <LocalLeader>l <Plug>VimLint +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>l' + +" Add undo commands to fix clearing buffer-local vim maps that the core +" ftplugin leaves in place let b:undo_ftplugin = b:undo_ftplugin \ . '|silent! nunmap <buffer> [[' \ . '|silent! vunmap <buffer> [[' diff --git a/vim/after/ftplugin/zsh/maps.vim b/vim/after/ftplugin/zsh/maps.vim new file mode 100644 index 00000000..a670df46 --- /dev/null +++ b/vim/after/ftplugin/zsh/maps.vim @@ -0,0 +1,21 @@ +" zsh/maps.zsh: tejr's mappings for 'zsh' filetypes + +" Don't load if running compatible or too old +if &compatible || v:version < 700 + finish +endif + +" Don't load if already loaded +if exists('b:did_ftplugin_zsh_maps') + finish +endif + +" Flag as loaded +let b:did_ftplugin_zsh_maps = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_zsh_maps' + +" Set mappings +nmap <buffer> <LocalLeader>c <Plug>ZshCheck +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap <buffer> <LocalLeader>c' |