tweak: change calc keybindings
This commit is contained in:
parent
e468119f06
commit
bfa54c8f5f
1 changed files with 36 additions and 25 deletions
61
config.org
61
config.org
|
|
@ -2493,15 +2493,46 @@ If prefix ARG is given, delete the window instead of selecting it."
|
||||||
|
|
||||||
Emacs Calc is the best calculator I've ever used, and given the fact that it's an RPN calculator, that's saying something.
|
Emacs Calc is the best calculator I've ever used, and given the fact that it's an RPN calculator, that's saying something.
|
||||||
|
|
||||||
*** Leader Key Bindings
|
*** Bindings
|
||||||
|
|
||||||
Typing =C-x *= every time I want to use Calc (very often) is annoying.
|
**** Evil Bindings
|
||||||
|
|
||||||
|
I want to have vim keybindings in Calc, so let's enable the =evil-collection= module for it by removing it from ~+evil-collection-disabled-list~.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
;; Enable evil-collection-calc
|
||||||
|
(delq 'calc +evil-collection-disabled-list)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
**** Rebindings
|
||||||
|
|
||||||
|
Let's also rebind some keys:
|
||||||
|
|
||||||
|
- We'll set =[= and =]= to directly begin and end vectors like it did originally, as there is very little reason to use Evil's bindings on these keys.
|
||||||
|
- =C-r= makes more sense as a redo binding than =D D=.
|
||||||
|
- The "keep arguments" binding (=K=) was removed by =evil-collection= for some reason? I'm putting it back.
|
||||||
|
- Selection commands are important, so we'll use =J= for them instead of =z j=.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(defadvice! ~/evil-collection-calc-bindings ()
|
||||||
|
:after #'evil-collection-calc-setup
|
||||||
|
(map! :map calc-mode-map
|
||||||
|
:n "C-r" #'calc-redo
|
||||||
|
:n "[" #'calc-begin-vector
|
||||||
|
:n "]" #'calc-end-vector
|
||||||
|
:n "K" #'calc-keep-args
|
||||||
|
:n "J" (keymap-lookup calc-mode-map "<normal-state> z j"))
|
||||||
|
(map! :map calc-mode-map
|
||||||
|
:n "z j" nil))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
**** Leader Key Bindings
|
||||||
|
|
||||||
|
Typing =C-x *= every time I want to use Calc (very often) is annoying. To alleviate this problem, we can create some keybindings under =SPC C=:
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(map! :leader
|
(map! :leader
|
||||||
:prefix ("#" . "calc")
|
:prefix ("C" . "calc")
|
||||||
:desc "Emacs Calc"
|
|
||||||
"#" #'calc
|
|
||||||
:desc "Emacs Calc"
|
:desc "Emacs Calc"
|
||||||
"c" #'calc
|
"c" #'calc
|
||||||
:desc "Emacs Calc (full window)"
|
:desc "Emacs Calc (full window)"
|
||||||
|
|
@ -2553,26 +2584,6 @@ what type of visual state is currently active."
|
||||||
(calc-grab-region top bot arg)))
|
(calc-grab-region top bot arg)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** Evil Bindings
|
|
||||||
|
|
||||||
I want to have vim keybindings in Calc, so let's enable the =evil-collection= module for it by removing it from ~+evil-collection-disabled-list~.
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
;; Enable evil-collection-calc
|
|
||||||
(delq 'calc +evil-collection-disabled-list)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Let's also rebind some keys. We'll set =[= and =]= to directly begin and end vectors like it did originally, and =C-r= makes more sense as a redo binding than =D D=.
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(defadvice! ~/evil-collection-calc-bindings ()
|
|
||||||
:after #'evil-collection-calc-setup
|
|
||||||
(map! :map calc-mode-map
|
|
||||||
:n "C-r" #'calc-redo
|
|
||||||
:n "[" #'calc-begin-vector
|
|
||||||
:n "]" #'calc-end-vector))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
*** Appearance
|
*** Appearance
|
||||||
|
|
||||||
Calc doesn't use faces to show selections by default, which I think is rather strange.
|
Calc doesn't use faces to show selections by default, which I think is rather strange.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue