From fbf5479d6a5e12d0565c2213f08d27ffa36aca3c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 15:10:03 +1200 Subject: Reindent and refactor local leader mappings --- vim/vimrc | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'vim/vimrc') diff --git a/vim/vimrc b/vim/vimrc index 86f13359..6944c51e 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -274,41 +274,40 @@ if 1 let g:maplocalleader = '_' endif -" Filetype-specific mappings below; use a literal underscore rather than -" to keep the commands short +" Filetype-specific mappings if has('autocmd') && v:version >= 700 augroup vimrc_filetype_mappings - autocmd! + autocmd! - " Clear existing local leader maps - autocmd FileType * call vimrc#ClearLocalLeaderMaps() + " Clear existing local leader maps + autocmd FileType * call vimrc#ClearLocalLeaderMaps() - " Diff: prune sections - 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, URL-to-link, tidy - autocmd FileType html nmap _l HtmlLint - autocmd FileType html nmap _r HtmlUrlLink - autocmd FileType html nmap _t HtmlTidy + " 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 - autocmd FileType perl nmap _c PerlCheck - autocmd FileType perl nmap _l PerlLint - autocmd FileType perl nmap _t PerlTidy + " 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 + " PHP: check + autocmd FileType php nmap c PhpCheck - " Shell: check and lint - autocmd FileType sh nmap _c ShCheck - autocmd FileType sh nmap _l ShLint + " Shell: check and lint + autocmd FileType sh nmap c ShCheck + autocmd FileType sh nmap l ShLint - " VimL: lint - autocmd FileType vim nmap _l VimLint + " VimL: lint + autocmd FileType vim nmap l VimLint - " Zsh: check - autocmd FileType zsh nmap _c ZshCheck + " Zsh: check + autocmd FileType zsh nmap c ZshCheck augroup END endif -- cgit v1.2.3 From 75f2d2f394c2dc1c8db7df54a774c8ef3af1fa17 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 15:12:57 +1200 Subject: Use in vimrc where reasonable --- vim/vimrc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'vim/vimrc') diff --git a/vim/vimrc b/vim/vimrc index 6944c51e..720d3f3a 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -219,12 +219,12 @@ if has('digraphs') endif " Normal mode leader mappings below; use a literal backslash rather than -" so that the non-plugin mappings work on vim-tiny +" on the non-plugin maps so that they work on vim-tiny " \a toggles 'formatoptions' 'a' flag using a plugin -nnoremap \a :ToggleOptionFlagLocal formatoptions a +nnoremap a :ToggleOptionFlagLocal formatoptions a " \b toggles copy-pasteable linebreak settings -nmap \b CopyLinebreakToggle +nmap b CopyLinebreakToggle " \c toggles 'cursorcolumn', \C toggles 'cursorline' nnoremap \c :set cursorcolumn! cursorcolumn? nnoremap \C :set cursorline! cursorline? @@ -250,8 +250,8 @@ nnoremap \l :set list! list? " \n toggles line numbers nnoremap \n :set number! number? " \o and \O open 'pasted insert' lines -nmap \o PasteOpenBelow -nmap \O PasteOpenAbove +nmap o PasteOpenBelow +nmap O PasteOpenAbove " \p toggles paste mode nnoremap \p :set paste! paste? " \r reloads .vimrc @@ -265,7 +265,7 @@ nnoremap \u :setlocal spelllang=en_us spelllang? " \w toggles wrapping nnoremap \w :set wrap! wrap? " \x strips trailing whitespace via a custom plugin -nmap \x StripTrailingWhitespace +nmap x StripTrailingWhitespace " \z sets NZ English spelling (compare \u) nnoremap \z :setlocal spelllang=en_nz spelllang? -- cgit v1.2.3 From 02f8c846ca614fdf06bf6fcc77280c590337cdac Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 19:12:28 +1200 Subject: Add and apply new clear_local_maps.vim plugin --- vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vim/vimrc') diff --git a/vim/vimrc b/vim/vimrc index 720d3f3a..12892474 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -280,7 +280,7 @@ if has('autocmd') && v:version >= 700 autocmd! " Clear existing local leader maps - autocmd FileType * call vimrc#ClearLocalLeaderMaps() + autocmd FileType * silent! call clear_local_maps#Clear() " Diff: prune sections autocmd FileType diff nmap p DiffPrune -- cgit v1.2.3