Move key bindings to their final place

This commit is contained in:
Gergely Polonkai 2023-10-20 10:49:26 +02:00
parent d2c81b01f5
commit 76d99e522a
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4

View File

@ -3026,6 +3026,74 @@ Because thats still my favourite language.
(c-mode-common . gpolonkai/cond-enable-ggtags-mode)) (c-mode-common . gpolonkai/cond-enable-ggtags-mode))
#+end_src #+end_src
* Key bindings
#+begin_src emacs-lisp
(defun gpolonkai/isearch-regexp (prefix)
"Call `isearch-forward-regex'. If PREFIX is non-nil, call `isearch-backward-regex' instead."
(interactive "P")
(call-interactively
(if prefix
'isearch-backward-regexp
'isearch-forward-regexp)))
#+end_src
#+begin_src emacs-lisp
(bind-keys
:map global-map
("<C-return>" . wted/open-line-below)
("<C-S-return>" . wted/open-line-above)
("M-t" . nil) ;; Remove the old keybinding
("M-t c" . transpose-chars)
("M-t w" . transpose-words)
("M-t l" . transpose-lines)
("M-t e" . transpose-sexps)
("M-t s" . transpose-sentences)
("M-t p" . transpose-paragraphs)
("M-t W" . gpolonkai/transpose-windows)
("C-a" . gpolonkai/move-to-beginning-of-line)
("C-e" . gpolonkai/move-to-end-of-line)
("M-q" . sachachua/fill-or-unfill-paragraph)
("C-c r" . gpolonkai/round-number-at-point-to-decimals)
("C-s" . consult-line)
("C-r" . gpolonkai/isearch-regexp)
("C-M-s" . isearch-forward)
("C-M-r" . isearch-backward)
("C-~" . gpolonkai/toggle-char-case)
("C-z" . nil)
("M-g SPC" . gpolonkai/goto-next-char)
("M-F" . gpolonkai/beginning-of-next-word)
("C-h C-l" . find-library)
("C-h C-f" . find-function)
("C-h C-k" . find-function-on-key)
("C-h C-v" . find-variable)
:map ctl-x-map
("C-y" . duplicate-line)
("_" . maximize-window)
("C-r" . wted/rename-current-buffer-file)
("C-d" . wted/delete-current-buffer-file)
("|" . gpolonkai/toggle-window-split)
("k" . kill-this-buffer)
("C-b" . bury-buffer)
("/" . repeat)
:map isearch-mode-map
("<C-return>" . ep/isearch-exit-other-end)
("<S-return>" . e-se/isearch-exit-mark-match)
:map gpolonkai/pers-map
("h" . hidden-mode-line-mode)
("C-i e" . "gergely@polonkai.eu")
("C-i w" . "http://gergely.polonkai.eu/")
("u" . browse-url-at-point)
("M-C" . clean-buffer-list)
("C-c" . calc)
("c i" . org-clock-in)
("c I" . org-clock-in-last)
("c o" . org-clock-out)
("c g" . org-clock-goto)
("M-o" . mbork/insert-current-file-name-at-point)
("i" . string-inflection-all-cycle))
#+end_src
* Custom commands and functions * Custom commands and functions
** Frame manipulation ** Frame manipulation
@ -3062,81 +3130,6 @@ To temporarily hide the mode line.
"Use M-x hidden-mode-line-mode to make mode-line appear.")))) "Use M-x hidden-mode-line-mode to make mode-line appear."))))
#+END_SRC #+END_SRC
* Last, but not least, key bindings!
** The actual key bindings
#+begin_src emacs-lisp
(defun gpolonkai/isearch-regexp (prefix)
"Call `isearch-forward-regex'. If PREFIX is non-nil, call `isearch-backward-regex' instead."
(interactive "P")
(call-interactively
(if prefix
'isearch-backward-regexp
'isearch-forward-regexp)))
#+end_src
#+BEGIN_SRC emacs-lisp
(bind-keys
:map global-map
("<C-return>" . wted/open-line-below)
("<C-S-return>" . wted/open-line-above)
("M-t" . nil) ;; Remove the old keybinding
("M-t c" . transpose-chars)
("M-t w" . transpose-words)
("M-t l" . transpose-lines)
("M-t e" . transpose-sexps)
("M-t s" . transpose-sentences)
("M-t p" . transpose-paragraphs)
("M-t W" . gpolonkai/transpose-windows)
("C-a" . gpolonkai/move-to-beginning-of-line)
("C-e" . gpolonkai/move-to-end-of-line)
("M-q" . sachachua/fill-or-unfill-paragraph)
("C-c r" . gpolonkai/round-number-at-point-to-decimals)
("C-s" . consult-line)
("C-r" . gpolonkai/isearch-regexp)
("C-M-s" . isearch-forward)
("C-M-r" . isearch-backward)
("C-~" . gpolonkai/toggle-char-case)
("C-z" . nil)
("M-g SPC" . gpolonkai/goto-next-char)
("M-F" . gpolonkai/beginning-of-next-word)
:map ctl-x-map
("C-y" . duplicate-line)
("_" . maximize-window)
("C-r" . wted/rename-current-buffer-file)
("C-d" . wted/delete-current-buffer-file)
("|" . gpolonkai/toggle-window-split)
("k" . kill-this-buffer)
("C-b" . bury-buffer)
("/" . repeat)
:map isearch-mode-map
("<C-return>" . ep/isearch-exit-other-end)
("<S-return>" . e-se/isearch-exit-mark-match)
:map gpolonkai/pers-map
("h" . hidden-mode-line-mode)
("C-i e" . "gergely@polonkai.eu")
("C-i w" . "http://gergely.polonkai.eu/")
("u" . browse-url-at-point)
("M-C" . clean-buffer-list)
("C-c" . calc)
("c i" . org-clock-in)
("c I" . org-clock-in-last)
("c o" . org-clock-out)
("c g" . org-clock-goto)
("M-o" . mbork/insert-current-file-name-at-point)
("i" . string-inflection-all-cycle))
#+END_SRC
** TODO These fail to work using ~bind-keys~, but why?
#+BEGIN_SRC emacs-lisp
(define-key 'help-command (kbd "C-l") 'find-library)
(define-key 'help-command (kbd "C-f") 'find-function)
(define-key 'help-command (kbd "C-k") 'find-function-on-key)
(define-key 'help-command (kbd "C-v") 'find-variable)
#+END_SRC
* And finally, server mode * And finally, server mode
Sometimes i start an ~emacsclient~ process, like for editing a commit message or something Sometimes i start an ~emacsclient~ process, like for editing a commit message or something