vim-sexp icon indicating copy to clipboard operation
vim-sexp copied to clipboard

Easier navigation of subforms

Open jonathanj opened this issue 9 years ago • 2 comments

I hope I'm not missing something obvious but navigating into (and out of) subforms seems to be more difficult than one would hope it would be in a Lisp. For example imagine the following Clojure code:

(defn some-function
  "Some
   docstring."
  [x]
  (if (= x 42)
    "That's the answer!"
    (str x " is not the answer")))

If the cursor is at |(defn (perhaps by way of using [[ or ]] to navigate) and one wanted to navigate into the function to add a parameter, for example but imagine introducing another let assignment, adjusting a condition, etc., how would one achieve this? Currently I believe you have to move the cursor into the form you wish to subnavigate and use the sibling motion keys but then of course this navigates elements and not forms.

jonathanj avatar Oct 06 '14 10:10 jonathanj

I believe you're missing the following from paredit:

paredit-forward-down paredit-forward-up paredit-backward-down paredit-backward-up

I've pointed out the lack of these commands and several others in issue #5 .

bpstahlman avatar Oct 06 '14 11:10 bpstahlman

Something like vim-easymotion could definitely facilitate traversing levels until the aforementioned list navigation commands become available. In fact, for jumps of more than a level or two, I could even imagine easymotion being faster (though perhaps less aesthetically pleasing) than the corresponding paredit-like commands.

bpstahlman avatar Mar 03 '17 18:03 bpstahlman