Emacs: Commands to Jump to Punctuations

Buy Xah Emacs Tutorial. Master emacs benefits for life.
, , …,

2 commands that let you fly to any punctuation in language source code.

(defun xah-forward-dot-comma ()
  "Move cursor to the next occurrence of 「.」 「,」 「;」.
URL `http://ergoemacs.org/emacs/emacs_jump_to_punctuations.html'
Version 2015-03-24"
  (search-forward-regexp "\\.+\\|,+\\|;+" nil t))

(defun xah-backward-dot-comma ()
  "Move cursor to the previous occurrence of 「.」 「,」 「;」
URL `http://ergoemacs.org/emacs/emacs_jump_to_punctuations.html'
Version 2015-03-24"
  (search-backward-regexp "\\.+\\|,+\\|;+" nil t))

you need to give them a easy key for this idea to work, such as {【Ctrl+7】, 【Ctrl+8】}. 〔➤ Emacs: How to Define Keys〕 (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. 〔➤ Emacs: Fast-repeat vs Non-fast-repeat Commands & Keys〕)

this is to be used together with Emacs: Commands to Move Cursor by Brackets, Quotes. If you don't have that, use the backward/forward brackets first, because that's more useful.

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

Like it?
Buy Xah Emacs Tutorial
or share
blog comments powered by Disqus