From 96fea84ab648862394d81a7a6af374eb8c47af1a Mon Sep 17 00:00:00 2001 From: j5shi Date: Tue, 22 Aug 2017 11:00:20 +0800 Subject: [PATCH] Added feature "restore last selection after an align operation (apply for live easy align only)". --- plugin/easy_align.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugin/easy_align.vim b/plugin/easy_align.vim index c71af4e..4d91d25 100644 --- a/plugin/easy_align.vim +++ b/plugin/easy_align.vim @@ -26,6 +26,10 @@ if exists("g:loaded_easy_align_plugin") endif let g:loaded_easy_align_plugin = 1 +if !exists('g:easy_align_restore_last_selection') + let g:easy_align_restore_last_selection = 0 +endif + command! -nargs=* -range -bang EasyAlign ,call easy_align#align(0, 0, 'command', ) command! -nargs=* -range -bang LiveEasyAlign ,call easy_align#align(0, 1, 'command', ) @@ -113,6 +117,9 @@ endfunction function! s:live_easy_align_op(type, ...) call s:generic_easy_align_op(a:type, a:0, 1) + if g:easy_align_restore_last_selection == 1 + execute "normal gv" + endif endfunction function! s:easy_align_repeat()