From ad69b8aca286a9aa5f95f920199370e5512abcf7 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 29 Jun 2018 23:24:06 +1200 Subject: Use ftplugins for filetype mappings instead --- vim/after/ftplugin/diff/maps.vim | 23 ++++++++++++++++++++++ vim/after/ftplugin/html/maps.vim | 25 +++++++++++++++++++++++ vim/after/ftplugin/make/maps.vim | 21 ++++++++++++++++++++ vim/after/ftplugin/perl/maps.vim | 25 +++++++++++++++++++++++ vim/after/ftplugin/php/maps.vim | 21 ++++++++++++++++++++ vim/after/ftplugin/sh/maps.vim | 23 ++++++++++++++++++++++ vim/after/ftplugin/vim/clear_maps.vim | 37 ----------------------------------- vim/after/ftplugin/vim/maps.vim | 37 +++++++++++++++++++++++++++++++++++ vim/after/ftplugin/zsh/maps.vim | 21 ++++++++++++++++++++ 9 files changed, 196 insertions(+), 37 deletions(-) create mode 100644 vim/after/ftplugin/diff/maps.vim create mode 100644 vim/after/ftplugin/html/maps.vim create mode 100644 vim/after/ftplugin/make/maps.vim create mode 100644 vim/after/ftplugin/perl/maps.vim create mode 100644 vim/after/ftplugin/php/maps.vim create mode 100644 vim/after/ftplugin/sh/maps.vim delete mode 100644 vim/after/ftplugin/vim/clear_maps.vim create mode 100644 vim/after/ftplugin/vim/maps.vim create mode 100644 vim/after/ftplugin/zsh/maps.vim (limited to 'vim/after/ftplugin') 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 p DiffPrune +xmap p DiffPrune +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap p' + \ . '|xunmap 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 l HtmlLint +nmap r HtmlUrlLink +nmap t HtmlTidy +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap l' + \ . '|nunmap r' + \ . '|nunmap 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 m MakeTarget +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap 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 c PerlCheck +nmap l PerlLint +nmap t PerlTidy +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap c' + \ . '|nunmap l' + \ . '|nunmap 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 c PhpCheck +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap 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 c ShCheck +nmap l ShLint +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap c' + \ . '|nunmap l' diff --git a/vim/after/ftplugin/vim/clear_maps.vim b/vim/after/ftplugin/vim/clear_maps.vim deleted file mode 100644 index a84ca4b9..00000000 --- a/vim/after/ftplugin/vim/clear_maps.vim +++ /dev/null @@ -1,37 +0,0 @@ -" vim/clear_maps.vim: Fix clearing buffer-local vim maps that the core -" ftplugin leaves in place - -" 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_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') - finish -endif - -" Flag as loaded -let b:did_ftplugin_vim_clear_maps = 1 -let b:undo_ftplugin = b:undo_ftplugin - \ . '|unlet b:did_ftplugin_vim_clear_maps' - -" Add undo commands -let b:undo_ftplugin = b:undo_ftplugin - \ . '|silent! nunmap [[' - \ . '|silent! vunmap [[' - \ . '|silent! nunmap ]]' - \ . '|silent! vunmap ]]' - \ . '|silent! nunmap []' - \ . '|silent! vunmap []' - \ . '|silent! nunmap ][' - \ . '|silent! vunmap ][' - \ . '|silent! nunmap ]"' - \ . '|silent! vunmap ]"' - \ . '|silent! nunmap ["' - \ . '|silent! vunmap ["' diff --git a/vim/after/ftplugin/vim/maps.vim b/vim/after/ftplugin/vim/maps.vim new file mode 100644 index 00000000..7f2a07a0 --- /dev/null +++ b/vim/after/ftplugin/vim/maps.vim @@ -0,0 +1,37 @@ +" vim/maps.vim: tejr's mappings for 'vim' 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_vim_maps') + finish +endif + +" Flag as loaded +let b:did_ftplugin_vim_maps = 1 +let b:undo_ftplugin = b:undo_ftplugin + \ . '|unlet b:did_ftplugin_vim_maps' + +" Set mappings +nmap l VimLint +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap 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 [[' + \ . '|silent! vunmap [[' + \ . '|silent! nunmap ]]' + \ . '|silent! vunmap ]]' + \ . '|silent! nunmap []' + \ . '|silent! vunmap []' + \ . '|silent! nunmap ][' + \ . '|silent! vunmap ][' + \ . '|silent! nunmap ]"' + \ . '|silent! vunmap ]"' + \ . '|silent! nunmap ["' + \ . '|silent! vunmap ["' 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 c ZshCheck +let b:undo_ftplugin = b:undo_ftplugin + \ . '|nunmap c' -- cgit v1.2.3