aboutsummaryrefslogtreecommitdiff
path: root/vim/vimrc
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-06-25 09:06:16 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-06-25 09:06:16 +1200
commitd025b8101b300c34e0e74d54ec821b69ee08cc94 (patch)
tree2b506fb06d9dd7c3cb6f2d20c9fa64719ca27599 /vim/vimrc
parentMerge branch 'release/v1.0.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-1.1.0.tar.gz (sig)
dotfiles-1.1.0.zip
Merge branch 'release/v1.1.0'v1.1.0
* release/v1.1.0: Bump VERSION Adjust an augroup name Missed an ftplugin map: HTML URL linking Update diff_prune.vim ftplugin Move all local bindings out into .vimrc Correct .vimrc comment Add diff_prune.vim ftplugin Update redact_pass.vim plugin Correct Vim 'formatlistpat' def for Markdown Add password filetype Correct an exists() call in markdown ftplugin Add "gitrebase" Vim filetype Print working directory after \g in Vim Bind \g in Vim to go to the current buffer's dir Add tab cycle bindings Update fixed_join.vim plugin
Diffstat (limited to 'vim/vimrc')
-rw-r--r--vim/vimrc52
1 files changed, 46 insertions, 6 deletions
diff --git a/vim/vimrc b/vim/vimrc
index 888542cf..13211067 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -192,6 +192,9 @@ nnoremap ]c :<C-U>cnext<CR>
" Cycle through location list items
nnoremap [l :<C-U>lprevious<CR>
nnoremap ]l :<C-U>lnext<CR>
+" Cycle through tabs
+nnoremap [t :<C-U>tabprevious<CR>
+nnoremap ]t :<C-U>tabnext<CR>
" Insert blank lines around current line
nmap [<Space> <Plug>PutBlankLinesAbove
@@ -212,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
@@ -237,6 +234,8 @@ if has('unix')
endif
" \f shows the current 'formatoptions' at a glance
nnoremap \f :<C-U>set formatoptions?<CR>
+" \g changes directory to the current file's location
+nnoremap \g :<C-U>cd %:h<CR>:pwd<CR>
" \h toggles highlighting search results
nnoremap \h :<C-U>set hlsearch! hlsearch?<CR>
" \i toggles showing matches as I enter my pattern
@@ -267,6 +266,47 @@ nmap \x <Plug>StripTrailingWhitespace
" \z sets NZ English spelling (compare \u)
nnoremap \z :<C-U>setlocal spelllang=en_nz spelllang?<CR>
+" 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_filetype_mappings
+ autocmd!
+
+ " Diff: prune sections
+ autocmd FileType diff nmap <buffer> _p <Plug>DiffPrune
+ autocmd FileType diff xmap <buffer> _p <Plug>DiffPrune
+
+ " HTML: lint, URL-to-link, tidy
+ autocmd FileType html nmap <buffer> _l <Plug>HtmlLint
+ autocmd FileType html nmap <buffer> _r <Plug>HtmlUrlLink
+ 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
+
" Add packaged matchit.vim, if supported
if has('packages')
packadd! matchit