From 30edd6ba0a654d22db62359e4bca9d174f1eead5 Mon Sep 17 00:00:00 2001 From: Jeet Sukumaran Date: Sat, 26 May 2018 11:03:30 -0400 Subject: [PATCH 1/2] Stay in container line when unwrapping (for spatial idempotency) --- autoload/argwrap.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/autoload/argwrap.vim b/autoload/argwrap.vim index 90fbdc0..af416e1 100644 --- a/autoload/argwrap.vim +++ b/autoload/argwrap.vim @@ -259,6 +259,7 @@ function! argwrap#toggle() call argwrap#wrapContainer(l:range, l:container, l:arguments, l:wrapBrace, l:tailComma, l:tailCommaBraces, l:tailIndentBraces, l:linePrefix, l:commaFirst, l:commaFirstIndent) else call argwrap#unwrapContainer(l:range, l:container, l:arguments, l:padded) + let l:cursor[1] = l:range.lineStart endif call setpos('.', l:cursor) From 2ca601e10b1d2799425a49ff951d8dd3fabadd1e Mon Sep 17 00:00:00 2001 From: Jeet Sukumaran Date: Sat, 26 May 2018 11:08:07 -0400 Subject: [PATCH 2/2] When wrapping, move to first line inside container. This (in combination with previous patch) allows for seamless back-and-forth toggling between wrapped and unwrapped states. --- autoload/argwrap.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/autoload/argwrap.vim b/autoload/argwrap.vim index af416e1..21cabae 100644 --- a/autoload/argwrap.vim +++ b/autoload/argwrap.vim @@ -257,6 +257,7 @@ function! argwrap#toggle() let l:container = argwrap#extractContainer(l:range) if l:range.lineStart == l:range.lineEnd call argwrap#wrapContainer(l:range, l:container, l:arguments, l:wrapBrace, l:tailComma, l:tailCommaBraces, l:tailIndentBraces, l:linePrefix, l:commaFirst, l:commaFirstIndent) + let l:cursor[1] = l:range.lineStart + 1 else call argwrap#unwrapContainer(l:range, l:container, l:arguments, l:padded) let l:cursor[1] = l:range.lineStart