File path to clipboard in Emacs

前端 未结 7 943
闹比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:13

    Why no one tell the simple solution.

    Just go to your dired buffer then press 0 w or C-u 0 w.

    This will call dired-copy-filename-as-kill which gives you full path of a file. If you want current dir, just delete the file at the end of it or you can use the function below, then bind it to any key you like.

    (defun my/dired-copy-dirname-as-kill ()
      "Copy the current directory into the kill ring."
      (interactive)
      (kill-new default-directory))
    

    PS: personally I go to current directory from file buffer using dired-jump

提交回复
热议问题