aboutsummaryrefslogtreecommitdiff
path: root/vim/filemap.vim
blob: bbbf19559458bcae74770dab2493183bb670e60e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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