Mapping/macro of the day: Add Rich comment containing def for the element under the cursor: nmap <Leader>jd yie<Plug>(sexp_move_to_prev_top_element)O<CR><Up>(comment<CR>(def <C-r>" :<Esc>pB
Given this snippet:
(defn plus1
[x]
(inc x))
With your cursor over x
, the result of the above mapping is this:
(comment
(def x :x))
(defn plus1
[x]
(inc x))
Got the idea from a recent thread in #beginners about evaluating nested forms in the REPL that contain vars defined outside of that form (like (inc x)
in the example).