Add my/bookmark-find-file
This commit is contained in:
parent
718b24d5e9
commit
85242cd785
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@
|
||||
/tree-sitter/
|
||||
/tramp
|
||||
/dape-breakpoints
|
||||
flycheck_init.el
|
||||
|
20
init.el
20
init.el
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user