From e5a77b2ae47731663c955b6f3fbe803c82f4b85f Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 23 Jun 2018 17:07:08 +1200 Subject: Add tab cycle bindings --- vim/vimrc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'vim/vimrc') diff --git a/vim/vimrc b/vim/vimrc index 888542cf..ee01e3fb 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -192,6 +192,9 @@ nnoremap ]c :cnext " Cycle through location list items nnoremap [l :lprevious nnoremap ]l :lnext +" Cycle through tabs +nnoremap [t :tabprevious +nnoremap ]t :tabnext " Insert blank lines around current line nmap [ PutBlankLinesAbove -- cgit v1.2.3 From 3b7b5b7026e96be7d37aacb7d13cd8f7e70f898e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 23 Jun 2018 17:12:01 +1200 Subject: Bind \g in Vim to go to the current buffer's dir --- vim/vimrc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vim/vimrc') diff --git a/vim/vimrc b/vim/vimrc index ee01e3fb..ee05236c 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -240,6 +240,8 @@ if has('unix') endif " \f shows the current 'formatoptions' at a glance nnoremap \f :set formatoptions? +" \g changes directory to the current file's location +nnoremap \g :cd %:h " \h toggles highlighting search results nnoremap \h :set hlsearch! hlsearch? " \i toggles showing matches as I enter my pattern -- cgit v1.2.3 From 39faf749a08491e53cea0d10f417eb149d9fd7e6 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 23 Jun 2018 17:13:02 +1200 Subject: Print working directory after \g in Vim --- vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vim/vimrc') diff --git a/vim/vimrc b/vim/vimrc index ee05236c..ab4e971d 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -241,7 +241,7 @@ endif " \f shows the current 'formatoptions' at a glance nnoremap \f :set formatoptions? " \g changes directory to the current file's location -nnoremap \g :cd %:h +nnoremap \g :cd %:h:pwd " \h toggles highlighting search results nnoremap \h :set hlsearch! hlsearch? " \i toggles showing matches as I enter my pattern -- cgit v1.2.3 From 97d3c005b9825e605a4524295733330c473a0d33 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 08:38:49 +1200 Subject: Add diff_prune.vim ftplugin --- vim/vimrc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'vim/vimrc') diff --git a/vim/vimrc b/vim/vimrc index ab4e971d..5eadb86a 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -272,6 +272,17 @@ nmap \x StripTrailingWhitespace " \z sets NZ English spelling (compare \u) nnoremap \z :setlocal spelllang=en_nz spelllang? +" Key bindings for diff mode +if has('autocmd') && v:version >= 700 + augroup vimrc + autocmd! + autocmd FileType diff + \ nmap p DiffPrune + autocmd FileType diff + \ xmap p DiffPrune + augroup END +endif + " Add packaged matchit.vim, if supported if has('packages') packadd! matchit -- cgit v1.2.3 From d8bd43cb0ec9f2747a9fa82f4c4d6740c9b410d5 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 08:44:33 +1200 Subject: Correct .vimrc comment --- vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vim/vimrc') diff --git a/vim/vimrc b/vim/vimrc index 5eadb86a..e32b14a8 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -272,7 +272,7 @@ nmap \x StripTrailingWhitespace " \z sets NZ English spelling (compare \u) nnoremap \z :setlocal spelllang=en_nz spelllang? -" Key bindings for diff mode +" Filetype-specific bindings if has('autocmd') && v:version >= 700 augroup vimrc autocmd! -- cgit v1.2.3 From 669b695d8f8663f4c1bc8514e0738e2963b66167 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 09:00:52 +1200 Subject: Move all local bindings out into .vimrc This is the natural way of things, I think. --- vim/vimrc | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) (limited to 'vim/vimrc') diff --git a/vim/vimrc b/vim/vimrc index e32b14a8..f8a5fb78 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -215,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 " so that the non-plugin mappings work on vim-tiny @@ -272,14 +266,43 @@ nmap \x StripTrailingWhitespace " \z sets NZ English spelling (compare \u) nnoremap \z :setlocal spelllang=en_nz spelllang? -" Filetype-specific bindings +" 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 +" to keep the commands short if has('autocmd') && v:version >= 700 augroup vimrc autocmd! - autocmd FileType diff - \ nmap p DiffPrune - autocmd FileType diff - \ xmap p DiffPrune + + " Diff: prune sections + autocmd FileType diff nmap _p DiffPrune + autocmd FileType diff xmap _p DiffPrune + + " HTML: lint and tidy + autocmd FileType html nmap _l HtmlLint + autocmd FileType html nmap _t HtmlTidy + + " Perl: check, lint, and tidy + autocmd FileType perl nmap _c PerlCheck + autocmd FileType perl nmap _l PerlLint + autocmd FileType perl nmap _t PerlTidy + + " PHP: check + autocmd FileType php nmap _c PhpCheck + + " Shell: check and lint + autocmd FileType sh nmap _c ShCheck + autocmd FileType sh nmap _l ShLint + + " VimL: lint + autocmd FileType vim nmap _l VimLint + + " Zsh: check + autocmd FileType zsh nmap _c ZshCheck + augroup END endif -- cgit v1.2.3 From f53b1edbdbe752a79f614bfd1010213715e35776 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 09:04:46 +1200 Subject: Missed an ftplugin map: HTML URL linking --- vim/vimrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'vim/vimrc') diff --git a/vim/vimrc b/vim/vimrc index f8a5fb78..41a76270 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -281,8 +281,9 @@ if has('autocmd') && v:version >= 700 autocmd FileType diff nmap _p DiffPrune autocmd FileType diff xmap _p DiffPrune - " HTML: lint and tidy + " HTML: lint, URL-to-link, tidy autocmd FileType html nmap _l HtmlLint + autocmd FileType html nmap _r HtmlUrlLink autocmd FileType html nmap _t HtmlTidy " Perl: check, lint, and tidy -- cgit v1.2.3 From e5a7f6029b9f4d2bacec5287aaedb9edf64a5188 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 09:04:57 +1200 Subject: Adjust an augroup name --- vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vim/vimrc') diff --git a/vim/vimrc b/vim/vimrc index 41a76270..13211067 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -274,7 +274,7 @@ endif " Filetype-specific mappings below; use a literal underscore rather than " to keep the commands short if has('autocmd') && v:version >= 700 - augroup vimrc + augroup vimrc_filetype_mappings autocmd! " Diff: prune sections -- cgit v1.2.3