Emacs: Move Cursor to Punctuation 🚀
Jump to Punctuation
This command lets you jump to any punctuation. You can change what character are considered punctuation.
(defvar xah-punctuation-regex nil "A regex string for the purpose of moving cursor to a punctuation.") (setq xah-punctuation-regex "[\"=+]") (defun xah-forward-punct () "Move cursor to the next occurrence of punctuation. Punctuations is defined by `xah-punctuation-regex' URL `http://xahlee.info/emacs/emacs/emacs_jump_to_punctuations.html' Version 2017-06-26 2024-01-20" (interactive) (re-search-forward xah-punctuation-regex nil t)) (defun xah-backward-punct () "Move cursor to the previous occurrence of punctuation. See `xah-forward-punct' URL `http://xahlee.info/emacs/emacs/emacs_jump_to_punctuations.html' Version 2017-06-26 2024-01-20" (interactive) (re-search-backward xah-punctuation-regex nil t))
You need to give them easy keys for this idea to work, such as {Ctrl+7, Ctrl+8}. [see Emacs Keys: Define Key] (you'll need a key that can be held down to repeat, such as F8, Ctrl+8, and for example Ctrl+c c wouldn't work. [see Keybinding Design, Fast-Repeat Commands])
This is to be used together with Emacs: Move Cursor to Bracket 🚀
The jump to punctuation is inspired by ace-jump-mode: https://github.com/winterTTr by winterTTr. I heard about ace-jump from jcs's blog