3.6. point histry

[point-history.el] 過去のカーソル位置を記憶・閲覧・選択・移動する

🔗 blue0513/point-history: Show the history of points you visited before.

過去に訪れた箇所の一覧をリストとして表示して、そこから戻りたい箇所を選択できます。 デフォルトは tab移動ですが変更しています。また、g でリスト画面が消えてくれるので、わかりやすくggで発動するようにキーバインドしています。

リスト上でポイントを移動させると、連動してビューバッファーを表示し対応位置をハイライトしてくれるところが優れものです。

ignore-bufferの正規表現、なかなか難しいのですが…

  • ^* » scratch dashboard Message init-log などが有効になるようです。
  • ^magit » 先頭にmagit とつくmagit commit時に作られるbuffer を無視します。
  • \]$ » diredで開いたバッファーには 末尾に[dir]がつくようにカスタマイズしているので、最後尾の]がマッチすれば無視します。
(leaf point-history
  :el-get blue0513/point-history
  :hook (after-init-hook . point-history-mode)
  :chord ("gg" . point-history-show) ;; Since it disappears with `g'
  :bind ((:point-history-show-mode-map
		  ("<SPC>" . point-history-next-line)
		  ("b" . point-history-prev-line)))
  :custom (point-history-show-buffer-height . 15)
  :custom
  (point-history-ignore-buffer . "^ \\*Minibuf\\|^*\\|^ \\*point-history-show*\\|^magit\\|\]$"))

デレクトリバッファー名の末尾に [dir]をつける

counsel-switch-buffer でファイルとデレクトリとを区別しやすいようにこのようにしてます。

(defun dired-my-append-buffer-name-hint ()
  "Append a auxiliary string [Dir] to a name of dired buffer."
  (when (eq major-mode 'dired-mode)
	(let* ((dir (expand-file-name list-buffers-directory))
    	   ;; Add a drive letter for Windows
		   (drive (if (and (eq 'system-type 'windows-nt)
			               (string-match "^\\([a-zA-Z]:\\)/" dir))
	                  (match-string 1 dir) "")))
	  (rename-buffer (concat (buffer-name) " [" drive "dir]") t))))
(add-hook 'dired-mode-hook 'dired-my-append-buffer-name-hint)