more general.el keybinds

This commit is contained in:
Janis 2024-12-19 02:33:27 +01:00
parent 6af86b7c54
commit a9907f20ec
2 changed files with 43 additions and 22 deletions

1
.gitignore vendored
View file

@ -14,3 +14,4 @@
/.cache/
/straight/
/auto-save-list/
/.dap-breakpoints

View file

@ -441,6 +441,10 @@ Honestly not very happy with this at the moment, but it's kind of hacked togethe
#+begin_src emacs-lisp
(defconst nemo/leader-evil "SPC")
(defconst nemo/leader-global "C-c")
(defconst nemo/major-key "m")
(defconst nemo/leader-major-evil (concat nemo/leader-evil " " nemo/major-key))
(defconst nemo/leader-major-global (concat nemo/leader-global " " nemo/major-key))
(use-package general
:straight t
@ -461,6 +465,11 @@ Honestly not very happy with this at the moment, but it's kind of hacked togethe
:global-prefix nemo/leader-global
:prefix nemo/leader-evil
)
(general-create-definer leader-major-def
:states '(emacs normal)
:global-prefix nemo/leader-global
:prefix nemo/leader-evil
)
;; magit uses with-editor-mode to spawn the git process
;; in with the emacs client as the $EDITOR
(general-def '(emacs normal) 'with-editor-mode-map ",," 'with-editor-finish)
@ -599,28 +608,6 @@ Evil key-binds, documentation for how this works is [[https://evil.readthedocs.i
)
#+end_src
These bindings are somewhat different from spacemacs, which parents the insertion key binds under the major-mode prefix =m=.
With =TAB= I can cycle headings in org, and with =,,= I can exit the special source block editor.
#+begin_src emacs-lisp
(leader-other-def
:keymaps 'org-mode-map
"ih" 'org-insert-heading
"is" 'org-insert-subheading
"ii" 'org-insert-item
"ib" 'org-insert-structure-template
)
(general-def 'normal 'org-src-mode-map ",," 'org-edit-src-exit)
(general-def 'normal
:keymaps 'org-mode-map
"TAB" 'org-cycle
"RET" 'org-open-at-point)
(general-def '(normal visual)
:prefix nemo/leader-evil
:non-normal-prefix nemo/leader-global
:keymaps 'org-mode-map
"il" 'org-insert-link)
#+end_src
Close =:config=.
#+begin_src emacs-lisp
)
@ -775,6 +762,24 @@ Taken from [[https://sophiebos.io/posts/prettifying-emacs-org-mode/][ here]].
;; I basically always want to be running =visual-line-mode= anyway, but certainly in org-mode.
:hook (org-mode . visual-line-mode)
:hook (org-mode . nemo/prettify-symbols-setup)
:general-config
(general-define-key
:prefix-map 'nemo/org-map
"ih" '("Heading" . org-insert-heading)
"is" '("Subheading" . org-insert-subheading)
"ii" '("Item" . org-insert-item)
"ib" '("Block..". org-insert-structure-template)
"il" '("Link" . org-insert-link)
)
(leader-major-def
:keymaps 'org-mode-map
"m" '(:keymap nemo/org-map :wk "Org")
)
(general-def 'normal 'org-src-mode-map ",," 'org-edit-src-exit)
(general-def 'normal
:keymaps 'org-mode-map
"TAB" 'org-cycle
"RET" 'org-open-at-point)
:config
#+end_src
@ -1407,6 +1412,21 @@ hlsl-mode:
:hook (rust-mode . lsp)
:init
(setq rust-mode-treesitter-derive t)
:general-config
(general-define-key
:prefix-map 'nemo/rust-map
"c v" '("Check" . rust-check)
"c f" #'rust-format-buffer
"c b" #'rust-compile
"c B" #'rust-compile-release
"c t" #'rust-test
"c r" #'rust-run
"c l" #'rust-run-clippy
)
(leader-major-def
:keymaps 'rust-mode-map
"m" '(:keymap nemo/rust-map :wk "Cargo")
)
:config
(setq rust-format-on-save t))
#+end_src