Fork me on GitHub
#spacemacs
<
2020-09-24
>
jumar06:09:47

What's the best way to change keybinding for C-M-k? Specifically for clojure/lisp buffers. It used to work as kill-sexp but it doesn't work that way anymore in a clojure buffer (it still works properly in the REPL buffer); instead it's bound to evil-mc-make-cursor-move-prev-line which is very confusing for me and next to useless. I tried

(global-set-key  (kbd "C-M-k") 'kill-sexp)
=> has no effect (overridden?)
(define-key evil-mode (kbd "C-M-k") 'kill-sexp)
doesn't work because it needs a keymap (I don't know which one)

practicalli-johnny10:09:55

@jumar If you are using evil editing style, then try (evil-global-set-key 'normal "C-M-k" 'kill-sexp) to over-ride the evil keybinding for Evil normal state. Replace normal with insert if you want that keybinding to work when in Evil insert state. Or you can use SPC k d x to call sp-kill-sexp , SPC k d w to kill word and SPC k d s to kill a symbol. Or you can use Emacs or hybrid editing style if you do not make use of evil style editing.

jumar18:09:10

Thanks for the tip - the evil-global-set-key fails though:

(evil-global-set-key 'normal "C-M-k" 'kill-sexp)
*** Eval error ***  Key sequence C - M - k starts with non-prefix key C

jumar18:09:20

(with 'insert mode it seems to work)

👍 3
jumar12:09:29

Yeah, I mean, it works with the insert mode but what I'd like to make it work in normal mode too - for that I cannot do it it seems.

zane23:09:30

Wow, is it just me or does , e p e (`cider-pprint-eval-last-sexp`) print records as if they were maps?

practicalli-johnny23:09:40

@zane the , e p menu has keybindings that pretty print the evaluated results, added back in March https://github.com/syl20bnr/spacemacs/pull/13421 I think of Records in Clojure as custom typed maps, so not surprised they print as maps. Would be interested in seeing examples if you can share. Thanks.

zane23:09:51

clojure.pprint/pprint also prints records as maps, so I suppose the behavior is at least consistent. That was a huge surprise to me, though.

zane23:09:37

(defrecord Test [x y])
(->Test 0 1)
pretty-prints as
{:x 0, :y 1}

zane23:09:07

I would have expected

#user.Test{:x 0, :y 1}