Add my/bookmark-find-file

This commit is contained in:
Alexander Rosenberg 2024-09-13 05:17:00 -07:00
parent 718b24d5e9
commit 85242cd785
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
2 changed files with 21 additions and 0 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
/tree-sitter/
/tramp
/dape-breakpoints
flycheck_init.el

20
init.el
View File

@ -229,6 +229,26 @@ Interactively, force the recompile if called with a prefix."
:config
(recentf-mode 1))
;; bookmarks
(use-package bookmark
:ensure nil
:bind ("C-c b" . my/bookmark-find-file)
:config
(defun my/bookmark-find-file (&optional name)
"Run `find-file' in or on bookmark NAME.
If NAME points to a directory, run `find-file' with `default-directory' in that
directory. Otherwise, run `find-file' on that file."
(interactive (list (bookmark-completing-read
"Find file in" bookmark-current-bookmark)))
(unless name
(error "No bookmark specified"))
(bookmark-maybe-historicize-string name)
(when-let ((file (bookmark-get-filename name)))
(if (file-directory-p file)
(let ((default-directory (file-name-as-directory file)))
(call-interactively 'find-file))
(find-file file)))))
;; kitty keyboard protocol
(use-package kkp
:config