Skip to content

Instantly share code, notes, and snippets.

@kaz-utashiro
Last active May 28, 2023 03:43
Show Gist options
  • Save kaz-utashiro/7aa619794d2e72e96d25a61cf757db2b to your computer and use it in GitHub Desktop.
Save kaz-utashiro/7aa619794d2e72e96d25a61cf757db2b to your computer and use it in GitHub Desktop.
ウィンドウを分割すると follow-mode にして行番号を表示する
(defun activate-follow-mode (&optional window)
(follow-mode t)
(display-line-numbers-mode t))
(advice-add 'split-window-right :after 'activate-follow-mode)
(defun deactivate-follow-mode (&optional window del-all)
(when (= 1 (length (window-list)))
(follow-mode -1)
(display-line-numbers-mode -1)))
(dolist (cmd '(delete-window
delete-other-windows))
(advice-add cmd :after 'deactivate-follow-mode))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment