From 76d99e522aea3478d122bed20b785527c00162eb Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 20 Oct 2023 10:49:26 +0200 Subject: [PATCH] Move key bindings to their final place --- configuration.org | 143 ++++++++++++++++++++++------------------------ 1 file changed, 68 insertions(+), 75 deletions(-) diff --git a/configuration.org b/configuration.org index 09b49df..61faf1b 100644 --- a/configuration.org +++ b/configuration.org @@ -3026,6 +3026,74 @@ Because that’s still my favourite language. (c-mode-common . gpolonkai/cond-enable-ggtags-mode)) #+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 + ("" . wted/open-line-below) + ("" . 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 + ("" . ep/isearch-exit-other-end) + ("" . 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 ** Frame manipulation @@ -3062,81 +3130,6 @@ To temporarily hide the mode line. "Use M-x hidden-mode-line-mode to make mode-line appear.")))) #+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 - ("" . wted/open-line-below) - ("" . 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 - ("" . ep/isearch-exit-other-end) - ("" . 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 Sometimes i start an ~emacsclient~ process, like for editing a commit message or something