waffl
waffl

Reputation: 5511

Vim and Paredit - why does line break push closing parenthesis to next line?

I'm using vim to edit Clojure with paredit.vim and am noticing what I can't imagine is expected behaviour: when doing a simple line break, the closing parenthesis is always pushed to the next line, for example:

(if true
  "hello"
  )

instead of what I would expect:

(if true
  "hello")

A screencap video: http://d.pr/v/14S8F/4Z8gkHOA

I've disabled all other plugins other than vundle and paredit.vim to be safe, and it is occurring. I am using vim 7.4 and also macvim 7.4 with the same results.

Am I mistaken or is this the intended behaviour of paredit?

edit

While the selected answer does set the functionality I expected, the comment from @amalloy does indeed answer that this is paredit's intended functionality, and in :help paredit it does clarify this:

If g:paredit_electric_return is on then it also re-gathers electric returns when appropriate.

and further:

If nonzero then "electric return" feature is enabled. This means that when an is pressed before a closing paren in insert mode, paredit will actually insert two newlines creating an empty line. The extra newline is consumed at pressing the next closing paren. This feature allows linewise editing of the subform entered in the next (empty) line. In other words "opens" parenthetical expressions while editing, ')' "closes" them. Please note that electric return is disabled for the REPL buffer if Slimv option |g:slimv_repl_simple_eval| is nonzero. In this case is used to send the command line to the swank server for evaluation.

Upvotes: 1

Views: 576

Answers (1)

OlegTheCat
OlegTheCat

Reputation: 4513

Disable electric return:

:let g:paredit_electric_return=0

Upvotes: 4

Related Questions