Hacker News new | past | comments | ask | show | jobs | submit login
Paredit mnemonics for slurping and barfing Lisp symbolic expressions (susam.net)
70 points by susam on March 12, 2022 | hide | past | favorite | 16 comments



vim-sexp-mappings-for-regular-people [1] uses really easy-to-remember shortcuts for these:

- "backward slurp" is "<(" (move opening paren to the left)

- "forward slurp" is ">)" (move closing paren to the right)

- "forward barf" is "<)" (move closing paren to the left)

- "backward barf" is ">(" (move opening paren to the right)

[1]: https://github.com/tpope/vim-sexp-mappings-for-regular-peopl...


Thanks, I will give paredit a shot.

I'm a regular emacs user, but I normally use expand-region[1] and cut/paste to edit lisp code. Expand-region usually knows what I want to move around after just one or two calls, only requires one key binding, and has visual feedback. And it works great in every language I have used.

[1] https://github.com/magnars/expand-region.el


See also: the animated guide to paredit: http://danmidwood.com/content/2014/11/21/animated-paredit.ht... for an animated presentation of those commands, plus a few more.


Try smartparens. It's a successor to paredit and works for other languages as well. I have never coded (and navigated code) faster than in Clojure on Emacs w/ smartparens.


Also try Lispy (only for lisps). Works just like SP and Paredit except most commands require a single unmodified key press, but can only be used when point precedes or follows a delimiter or text is selected. Feels like magic.


For Lisps I prefer parinfer. It just works, no need to learn any new shortcuts.



I'm racking my brains, but in the #lisp channel I read a discussion about dealing with parentheses before paredit, and it was really interesting. I entirely forget the key-chords that were mentioned though...


next: paredit-convolute-sexp


I'm learning structural editing at work at the moment, the most useful ones for me so far have been:

- slurp forward

- raise


Any good pre-made keybinding options for VS Code Vim?


cannot do clojure without paredit, which is all finger memory now


Congratulations, you came up with a programming verb that’s even more disgusting than “squelch”.


Came up with? Slurp/Barf are _at least_ ~35 years old. Possibly more?


That doesn't make those terms any less disgusting to use.


Squelch is a disgusting verb? Is this one of those "I can't stand the word moist" things?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: