Fork me on GitHub
#emacs
<
2019-04-05
>
orestis09:04:13

Any opinions on using parinfer on Emacs? It seems like the promoted plugin is experimental WRT “smart-mode”

practicalli-johnny11:04:00

I find Parinfer very distracting in practice. For myself, learning slurp, barf, delete and raise in paredit or smartparents was relatively low effort and is mostly all that is needed. I can also use smartparents for all the programming language, even non lisps

orestis11:04:42

I got a new keyaboard which (by accident) has no arrow keys. So my paredit keybindings stopped working (I’ve since rebound them). Thought I’d try parinfer, I liked it when I was trying it out in other editors (using the smart mode)

orestis11:04:59

TIL about smartparens being available to other languages. I’d have to investigate.

dpsutton12:04:09

@orestis happy hacking keyboard?

orestis13:04:13

No, just some PCB from kbdfans — but they sent me the wrong one without arrow keys

practicalli-johnny12:04:33

I use Evil mode in Emacs, so only need to use specific arrow keys in the few things I do outside of Emacs. Since using Spacemacs my keyboard usage has been much more effective in minimising hand move and works very well with the reduced physical keys on my model01 http://keboard.io keyboard.

ag16:04:35

I use Vim keybinding pretty much everywhere: - browser: Vimium - OSX: hammerspoon with Spacehammer - Linux: EXWM

mpenet12:04:13

No need to move to vim keybindings to get rid of arrow keys usage, emacs default movements keys are fine too. I guess it's a matter of preference.

mpenet12:04:58

as a bonus emacs movement keys work everywhere on linux with some minor fiddling

☝️ 8
orestis12:04:35

Also macOS with no fiddling at all. But the new breed of Electron apps breaks that (e.g. slack)

👍 4
yuhan12:04:55

check out adjust-parens too, it's basically an on-demand version of Parinfer's enforced indent mode

didibus17:04:17

Ya, I personally prefer Holy mode as well. And I have quite a few custom keybindings. But I guess if you don't want to fiddle with customization as much, Evil is good, since Vim has a lot of default bindings to a lot of good editor commands.

didibus17:04:26

And I use smartparens and pairinfer both. Only parinfer has a wrap around command, so I use it for that.

didibus17:04:04

;; Enable moving between windows using S-left, S-right, S-up, S-down.
  (when (fboundp 'windmove-default-keybindings)
    (windmove-default-keybindings))

  ;; Make windmove work in org-mode.
  ;; Will only work when not in a context where org uses S-<arrow>:
  (add-hook 'org-shiftup-final-hook 'windmove-up)
  (add-hook 'org-shiftleft-final-hook 'windmove-left)
  (add-hook 'org-shiftdown-final-hook 'windmove-down)
  (add-hook 'org-shiftright-final-hook 'windmove-right)


  ;; Make M-left/right/up/down global shortcuts for forward, backward, up
  ;; and down sexp. Normally, it's C-M-left/right/up/down, but I bind that to
  ;; linux next/prev desktop. So I needed to find a replacement shortcut for
  ;; them in emacs.
  (global-set-key (kbd "M-<left>") 'backward-sexp)
  (global-set-key (kbd "M-<right>") 'forward-sexp)
  (global-set-key (kbd "M-<up>") 'backward-up-list)
  (global-set-key (kbd "M-<down>") 'down-list)


  ;; Make `C-c d` a global shortcut for duplicating the current line or region.
  (global-set-key (kbd "C-c d") 'spacemacs/duplicate-line-or-region)


  ;; Make M-( , M-[ and M-{ global shortcuts to wrap following sexp
  ;; in respective brackets.
  (global-set-key (kbd "M-(") 'paredit-wrap-round)
  (global-set-key (kbd "M-[") 'paredit-wrap-square)
  (global-set-key (kbd "M-{") 'paredit-wrap-curly)


  ;; Make M-r a global shortcut for raising sexp over parent.
  (global-set-key (kbd "M-r") 'sp-raise-sexp)


  ;; Make M-S-up/down global shortcuts for expanding and contracting region.
  (global-set-key (kbd "M-S-<up>") 'er/expand-region)
  (global-set-key (kbd "M-S-<down>") 'er/contract-region)


  ;; Make C-S-up/down global shortcuts for moving a line up or down.
  (global-set-key (kbd "C-S-<up>") 'move-text-line-up)
  (global-set-key (kbd "C-S-<down>") 'move-text-line-down)

didibus17:04:15

I don't find I ever need slurp and barf with this setup. And it's more intuitive to me then slurp and barf

orestis18:04:59

Oh, how can you do things without slurp/barf? I just went with the “animated guide to paredit” and I’m just using these two. And sometimes I raise sexp by accident :)

didibus18:04:59

I mean. I can wrap things in sexp, I can unwrap things. And I can move the cursor up/down/left/right of sexpr.

didibus18:04:09

That's all you need

didibus18:04:07

I don't personally find slurping and barfing to be useful given the above commands.

didibus18:04:18

I still sometimes use split and join

didibus18:04:29

But that's rare too

PB19:04:01

I feel dumb for not being able to find this, but how do I set custom identation for functions/macros?

PB20:04:06

Thanks very much!