aboutsummaryrefslogtreecommitdiff
path: root/vim/filemap.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-06-26 11:18:13 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-06-26 11:18:13 +1200
commit6ed7e3c18378f627488f20d6af00de1a89fe5042 (patch)
treefbacf8e72729db38089c293b29fc79023aeeb327 /vim/filemap.vim
parentMerge branch 'release/v1.5.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-6ed7e3c18378f627488f20d6af00de1a89fe5042.tar.gz
dotfiles-6ed7e3c18378f627488f20d6af00de1a89fe5042.zip
Merge branch 'release/v1.6.0'v1.6.0
* release/v1.6.0: Bump VERSION Update clear_local_maps.vim plugin Clear away VimL mapping rubbish Refactor filetype-specific .vimrc material Remap normal J only if loading plugins
Diffstat (limited to 'vim/filemap.vim')
-rw-r--r--vim/filemap.vim51
1 files changed, 51 insertions, 0 deletions
diff --git a/vim/filemap.vim b/vim/filemap.vim
new file mode 100644
index 00000000..bbbf1955
--- /dev/null
+++ b/vim/filemap.vim
@@ -0,0 +1,51 @@
+" Filetype-specific mappings
+if &compatible || v:version < 700 || !has('autocmd')
+ finish
+endif
+
+" No 'loaded' guard; this file is an extension of our .vimrc, and we do want
+" to reload it if the .vimrc is re-sourced.
+
+" Set up filetype mapping hooks
+augroup filetypemap
+ autocmd!
+
+ " Clear existing local leader maps if possible
+ autocmd FileType *
+ \ silent! call clear_local_maps#Clear()
+
+ " Diff: prune sections
+ autocmd FileType diff
+ \ nmap <buffer> <LocalLeader>p <Plug>DiffPrune
+ \|xmap <buffer> <LocalLeader>p <Plug>DiffPrune
+
+ " HTML: lint, URL-to-link, tidy
+ autocmd FileType html
+ \ nmap <buffer> <LocalLeader>l <Plug>HtmlLint
+ \|nmap <buffer> <LocalLeader>r <Plug>HtmlUrlLink
+ \|nmap <buffer> <LocalLeader>t <Plug>HtmlTidy
+
+ " Perl: check, lint, and tidy
+ autocmd FileType perl
+ \ nmap <buffer> <LocalLeader>c <Plug>PerlCheck
+ \|nmap <buffer> <LocalLeader>l <Plug>PerlLint
+ \|nmap <buffer> <LocalLeader>t <Plug>PerlTidy
+
+ " PHP: check
+ autocmd FileType php
+ \ nmap <buffer> <LocalLeader>c <Plug>PhpCheck
+
+ " Shell: check and lint
+ autocmd FileType sh
+ \ nmap <buffer> <LocalLeader>c <Plug>ShCheck
+ \|nmap <buffer> <LocalLeader>l <Plug>ShLint
+
+ " VimL: lint
+ autocmd FileType vim
+ \ nmap <buffer> <LocalLeader>l <Plug>VimLint
+
+ " Zsh: check
+ autocmd FileType zsh
+ \ nmap <buffer> <LocalLeader>c <Plug>ZshCheck
+
+augroup END