Minor changes to C-a

And M-j/k move up the function lists.
This commit is contained in:
Howard Abrams 2024-07-02 22:58:28 -07:00
parent c047eaa18b
commit acc8cd98ba
3 changed files with 19 additions and 6 deletions

View file

@ -376,7 +376,6 @@ For this feature, I may want to pull it out into its own file, so as to keep all
("w" Info-goto-node-web "View on Web")))))
#+end_src
** Text Expanders and Completion
The following defines my use of the Emacs completion system. Ive decided my /rules/ will be:
- Nothing should automatically appear; that is annoying and distracting.
@ -626,6 +625,20 @@ The built-in =isearch= is fantastically simple and useful, but the [[https://git
#+end_src
The idea, is that you can start a search with ~C-s~ (or even ~s-f~ … er, ~Command-f~ on the Mac), and type some letters. Hitting ~C-s~ goes to the next occurrence of what youve typed, but if you hit ~Command-g~, a menu appears allowing you to pull in the rest of the word or symbol you are looking at, or edit it completely.
** Minor Keybinding Annoys
I like ~C-a~ to go to the beginning of the line, but what about getting to the beginning of text on that line? In Evil, you have ~^~ for beginning of line, and ~0~ for first text. Why not have ~C-a~ toggle between them both:
#+begin_src emacs-lisp
(defun ha-beginning-of-line (&optional n)
"Toggles between the beginning of line and first of text."
(interactive "^p")
(if (= (point) (line-beginning-position))
(beginning-of-line-text n)
(beginning-of-line n)))
(global-set-key (kbd "C-a") 'ha-beginning-of-line)
#+end_src
* Working Layout
While editing any file on disk is easy enough, I like the mental context switch associated with a full-screen window frame showing all the buffers of a /project task/ (often a direct link to a repository project, but not always).
** Projects

View file

@ -161,7 +161,7 @@ I am not a long term VI user, and dont have much need for any of its control
(use-package evil
:config
(evil-define-key '(normal visual motion operator) 'global
(kbd "C-a") 'move-beginning-of-line
(kbd "C-a") 'ha-beginning-of-line
(kbd "C-e") 'move-end-of-line
;; Since C-y scrolls the window down, Shifted Y goes up:

View file

@ -258,13 +258,13 @@ We need to make sure we keep the [[https://github.com/Fuco1/smartparens][smartpa
*** Move by Functions
The =mark-paragraph= and =downcase-word= isnt very useful in a programming context, and makes more sense to use them to jump around function-by-function:
#+begin_src emacs-lisp
(global-set-key (kbd "M-h") 'beginning-of-defun)
(global-set-key (kbd "M-l") 'beginning-of-next-defun)
; (global-set-key (kbd "M-k") 'beginning-of-defun)
; (global-set-key (kbd "M-j") 'beginning-of-next-defun)
(when (fboundp 'evil-define-key)
(evil-define-key '(normal insert emacs) prog-mode-map
(kbd "M-h") 'beginning-of-defun
(kbd "M-l") 'beginning-of-next-defun))
(kbd "M-k") 'beginning-of-defun
(kbd "M-j") 'beginning-of-next-defun))
#+end_src
But one of those functions doesnt exist:
#+begin_src emacs-lisp