From 8718238a8395d84690045ecf293681f15c9362a5 Mon Sep 17 00:00:00 2001 From: vheon Date: Sun, 30 Dec 2012 03:23:31 +0100 Subject: [PATCH] Let [e ]e work on fold in normal mode. --- plugin/unimpaired.vim | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/plugin/unimpaired.vim b/plugin/unimpaired.vim index 96edb52..b304d00 100644 --- a/plugin/unimpaired.vim +++ b/plugin/unimpaired.vim @@ -144,7 +144,22 @@ nmap ] unimpairedBlankDown function! s:Move(cmd, count, map) abort normal! m` - exe 'move'.a:cmd.a:count + + let range = '' + let address = '' + + if foldclosed(line('.')) >= 0 + let start_fold = foldclosed(line('.')) + let end_fold = foldclosedend(line('.')) + + let range = start_fold.','.end_fold + + if a:map =~ 'Down' + let address = end_fold + endif + endif + + exe range.'move'.address.a:cmd.a:count norm! `` silent! call repeat#set("\unimpairedMove".a:map, a:count) endfunction