Question

I use Vim for Clojure development. I'd like a movement key or mapping that will jump through the top-level forms in the buffer. { and } are close, but stop if there's a blank line in the middle of the form. slimv-paredit's ( and ) move within a top-level forms. Here's an example:

(def foo :bar)
(defn plus [x y]
  (+ x y))

(def yum :cat)

Assuming the cursor starts at the top, I'd like to jump to the opening paren of foo, plus, and then yum.

Was it helpful?

Solution

I have added mappings [[ and ]] for moving to the previous/next defun in Slimv's paredit.vim. Please fetch it from the Slimv repository.

OTHER TIPS

You can write a quick vim macro to do what you want. Put this in your .vimrc:

map \n /^(<CR>

When you press \n, you'll hop to the next form that starts on a line.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top