Skip to content

Instantly share code, notes, and snippets.

@myuhe
Created March 1, 2010 01:40
Show Gist options
  • Save myuhe/317997 to your computer and use it in GitHub Desktop.
Save myuhe/317997 to your computer and use it in GitHub Desktop.
;;; 物理行の移動
(global-set-key "¥C-p" 'previous-window-line)
(global-set-key "¥C-n" 'next-window-line)
(defun previous-window-line (n)
(interactive "p")
(let ((cur-col
(- (current-column)
(save-excursion (vertical-motion 0) (current-column)))))
(vertical-motion (- n))
(move-to-column (+ (current-column) cur-col)))
(run-hooks 'auto-line-hook)
)
(defun next-window-line (n)
(interactive "p")
(let ((cur-col
(- (current-column)
(save-excursion (vertical-motion 0) (current-column)))))
(vertical-motion n)
(move-to-column (+ (current-column) cur-col)))
(run-hooks 'auto-line-hook)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment