11

Is there a way, in the buffer launched from helm-find-files, to copy a file path to the kill ring?

DJG
  • 213
  • 2
  • 5

2 Answers2

15

If yanking the path into the current buffer is not acceptable, use C-u C-c C-k, which invokes helm-kill-selection-and-quit.

From the documentation of helm-kill-selection-and-quit:

Store display value of current selection to kill ring. With a prefix arg set to real value of current selection. Display value is what you see in `helm-buffer' and real value is what is used to perform actions.

Tested using helm 1.9.1.

Constantine
  • 9,072
  • 1
  • 34
  • 49
  • Nice, I thought about adding `helm-kill-selection-and-quit`, but I thought it just gave you the file name. I didn't realize that with a prefix argument you get the path! – elethan Jan 26 '16 at 02:33
  • 2
    This works, but how would anyone ever find this! – GaryO Jan 21 '20 at 20:52
10

Try C-c TAB when you have the file highlighted. This will yank the path into the current buffer, which might be an undesired side effect, but as long as you do helm-find-files from the buffer you want to use it in, you should be fine.

elethan
  • 4,755
  • 3
  • 29
  • 56
  • The key binding of `helm-copy-to-buffer` is `C-c C-i`, however, `C-c TAB` works as well (though I don't know why). – xuchunyang Jan 26 '16 at 03:58
  • @xuchunyang hmm, now that you mention it I see in `helm.el` that `helm-copy-to-buffer` is indeed bound to `C-c C-i`, but `helm-help` lists the binding as `C-c TAB` with no mention of `C-c C-i`... – elethan Jan 26 '16 at 04:20
  • 2
    I see: Emacs doesn't distinguish between `C-i` and `TAB` according to http://emacs.stackexchange.com/questions/17509/properly-distinguish-ctrli-and-tab – xuchunyang Jan 26 '16 at 04:34
  • @xuchunyang Ha! That is interesting! Thanks for pointing this out. – elethan Jan 26 '16 at 04:36
  • 1
    This copies the absolute path - is there some way to copy the relative path? – Chris Stryczynski Nov 15 '18 at 15:09