From 77a3c2ddf9f3eefe8bdb7380e3af34b7708b5f84 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 13:10:55 +1200 Subject: Remove misguided buffer mapping clear This gets rid of the targets as well, of course... --- vim/vimrc | 3 --- 1 file changed, 3 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index a6a3beae..13211067 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -277,9 +277,6 @@ if has('autocmd') && v:version >= 700 augroup vimrc_filetype_mappings autocmd! - " Clear away existing local mappings - autocmd FileType * mapclear - " Diff: prune sections autocmd FileType diff nmap _p DiffPrune autocmd FileType diff xmap _p DiffPrune -- cgit v1.2.3 From 942cf4e8afef712d9329701ec145f1005e82ac68 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 13:12:52 +1200 Subject: Upgrade fixed_join.vim, define map explicitly --- vim/bundle/fixed_join | 2 +- vim/vimrc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/vim/bundle/fixed_join b/vim/bundle/fixed_join index f4564785..5e55ca6d 160000 --- a/vim/bundle/fixed_join +++ b/vim/bundle/fixed_join @@ -1 +1 @@ -Subproject commit f4564785ea7538d91a9400d082fea4ba8eed8acd +Subproject commit 5e55ca6dd34e8a6caed0e265e5e94fd63a927325 diff --git a/vim/vimrc b/vim/vimrc index 13211067..028ccdce 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -200,6 +200,9 @@ nnoremap ]t :tabnext nmap [ PutBlankLinesAbove nmap ] PutBlankLinesBelow +" Remap normal J to hold the cursor still while joining lines +nmap J FixedJoin + " Remap normal Y to yank to end of line (consistent with C, D) nnoremap Y y$ -- cgit v1.2.3 From 5f73fa74a27145830177d4c9e24223efd70c222c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 13:53:32 +1200 Subject: Clear local leader maps on filetype change Iterate through all the buffer-local mappings each time the filetype changes, and clear any that begin with the local leader, using two autoloaded functions and one autoload variable for :redir. I really don't think it should be this hard. I hope I haven't missed something in the documentation that makes this easier. I thought maparg() or mapcheck() might do it, but no such luck. Maybe I can refactor this later. --- vim/autoload/vimrc.vim | 39 +++++++++++++++++++++++++++++++++++++++ vim/vimrc | 3 +++ 2 files changed, 42 insertions(+) create mode 100644 vim/autoload/vimrc.vim diff --git a/vim/autoload/vimrc.vim b/vim/autoload/vimrc.vim new file mode 100644 index 00000000..eaeefd5d --- /dev/null +++ b/vim/autoload/vimrc.vim @@ -0,0 +1,39 @@ +" Get all buffer-local mappings into a string variable +function! vimrc#GetBufferLocalMaps() abort + redir => l:out + map + redir END + let g:vimrc#buffer_local_maps = l:out +endfunction + +" Clear all buffer-local mappings beginning with +function! vimrc#ClearLocalLeaderMaps() abort + + " Do nothing if there isn't a defined local leader + if !exists('g:maplocalleader') + return + endif + + " Get all the buffer-local mappings into a list + silent call vimrc#GetBufferLocalMaps() + let l:mappings = split(g:vimrc#buffer_local_maps, '\n') + + " Iterate through the mappings + for l:mapping in l:mappings + + " Match the list mapping and mode; skip if no match + let l:matchlist = matchlist(l:mapping, '\m\C^\(.\)\s\+\(\S\+\)') + if !len(l:matchlist) + continue + endif + let l:mode = l:matchlist[1] + let l:sequence = l:matchlist[2] + + " If the mapping starts with our local leader, clear it + if stridx(l:sequence, g:maplocalleader) == 0 + execute l:mode.'unmap '.l:sequence + endif + + endfor + +endfunction diff --git a/vim/vimrc b/vim/vimrc index 028ccdce..86f13359 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -280,6 +280,9 @@ if has('autocmd') && v:version >= 700 augroup vimrc_filetype_mappings autocmd! + " 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 -- cgit v1.2.3 From af76781061e8b5c04115066760be9578bcaf1685 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 25 Jun 2018 14:01:46 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 04945fbb..1dcd1d76 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v1.2.0 -Sun Jun 24 23:54:16 UTC 2018 +tejr dotfiles v1.3.0 +Mon Jun 25 02:01:41 UTC 2018 -- cgit v1.2.3