guns / vim-sexp

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

Easier navigation of subforms #6

Open jonathanj opened 9 years ago

jonathanj commented 9 years ago

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.

bpstahlman commented 9 years ago

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 commented 7 years ago

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.