guns / vim-sexp

Precision Editing for S-expressions
MIT License
612 stars 33 forks source link

Convolute #24

Closed bpstahlman closed 7 years ago

bpstahlman commented 7 years ago

Synopsis Adds a convolute command, similar to the one provided by Emacs Paredit, but significantly smarter: e.g., breaks only at sensible locations, and preserves bracket types.

Intended Use Case Widen the scope of a let binding to include [count] ancestor forms. The following examples illustrate the intended usage. Note: cursor position denoted by `|'

Original Form:

(defun foo (a b)
  (if (bar x y)
      (baz (let ((x 1) (y 2))
             |(+ x y)))))

Example 1: convolute with [count]=1 (default):

(defun foo (a b)
  (if (bar x y)
      (let ((x 1) (y 2))
        (baz |(+ x y)))))

Example 2: convolute with [count]=2:

(defun foo (a b)
  (let ((x 1) (y 2))
    (if (bar x y)
        (baz |(+ x y)))))
guns commented 7 years ago

I am unfamiliar with the convolute command in Emacs Paredit, so I will have to take your word on the implementation. Thank you.

bpstahlman commented 7 years ago

No problem. I tested a number of examples in both vim-sexp and Paredit, and the results were pretty much identical, except in cases where I thought Paredit should have been a little smarter.

On Mon, May 15, 2017 at 11:30 AM, Sung Pae notifications@github.com wrote:

I am unfamiliar with the convolute command in Emacs Paredit, so I will have to take your word on the implementation. Thank you.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/guns/vim-sexp/pull/24#issuecomment-301528965, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7pQNxNgnnsdGCxOfYUIepzp_OkZuf7ks5r6H2agaJpZM4Nadkr .