Skip to content

Commit

Permalink
* layers/+spacemacs/spacemacs-defaults/funcs.el: Enhance copying file…
Browse files Browse the repository at this point in the history
… path for dired-mode
  • Loading branch information
sunlin7 authored and Lin Sun committed Dec 28, 2024
1 parent c5fc206 commit eb44da2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion layers/+spacemacs/spacemacs-defaults/funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,11 @@ ones created by `magit' and `dired'."
(defun spacemacs/copy-file-path ()
"Copy and show the file path of the current buffer."
(interactive)
(if-let* ((file-path (spacemacs--file-path)))
(if-let* ((file-path (or (spacemacs--file-path)
(and (eq major-mode 'dired-mode)
(condition-case nil
(dired-get-file-for-visit)
(error default-directory))))))
(progn
(kill-new file-path)
(message "%s" file-path))
Expand Down

0 comments on commit eb44da2

Please sign in to comment.