Skip to content

Instantly share code, notes, and snippets.

@igaiga
Created January 29, 2014 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igaiga/8680014 to your computer and use it in GitHub Desktop.
Save igaiga/8680014 to your computer and use it in GitHub Desktop.
;; 一文字検索移動
;; 順方向
(defun move-forward-char (char)
(interactive "cMove to Char: ")
(if (eq (char-after (point)) char) (forward-char))
(and (search-forward (char-to-string char) nil t)
(backward-char)))
(defun move-forward-char-repeatable ()
(interactive)
(if (eq last-command this-command)
(command-execute 'previous-command)
(command-execute 'move-forward-char)))
;; 逆方向
(defun move-backward-char (char)
(interactive "cMove backward to Char: ")
(search-backward (char-to-string char) nil t))
(defun move-backward-char-repeatable ()
(interactive)
(if (eq last-command this-command)
(command-execute 'previous-command)
(command-execute 'move-backward-char)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment