File path to clipboard in Emacs

前端 未结 7 948
闹比i
闹比i 2021-01-31 02:40

What is the most simple way to send current full file name with file path to clipboard?

What I am using now is messages buffer: I copy file name that appears there after

7条回答
  •  逝去的感伤
    2021-01-31 03:09

    In the Spacemacs distribution, you can press Spacefyy to display the buffer name in the minibuffer and copy it to the kill ring.

    The function spacemacs/show-and-copy-buffer-filename seems to originate from this blog post: Emacs: Show Buffer File Name.

    (defun camdez/show-buffer-file-name ()
      "Show the full path to the current file in the minibuffer."
      (interactive)
      (let ((file-name (buffer-file-name)))
        (if file-name
            (progn
              (message file-name)
              (kill-new file-name))
          (error "Buffer not visiting a file"))))
    

提交回复
热议问题