There is something that blocks my workflow quite often and I'm quite sure it's easy to solve.
I sometimes copy file paths (e.g. /tmp/bar/foo.gz
) from the command line into my host systems clipboard. Then I want to open them inside emacs and edit them. My system clipboard is linked to emacs clipboard so this is no problem.
Currently I use (ido-find-file)
bound to C-x C-f
which brings up the minibuffer with the path of the current file e.g. /home/cb0/
.
Option 1: If I now yank into the minibuffer it will always append to the current selection, resulting in something non-existing /home/cb0//tmp/bar/foo.gz".
Option 2: Pressing M-DEL
multiple times will delete the path in the minibuffer, leaving a single /
at the beginning. Now yanking will also result in a faulty path ``//tmp/bar/foo.gz`.
Option 3: Pressing C-a
(go to line start), C-k
(kill rest of line) and yank again also does not work in minibuffer.
These are not applicable for me:
use
emacsclient
straight from command line to edit this fileuse a shell script to tell emacs to open the file whose filepath is in current clipboard.
using
find-file
orhelm-mode-find-file
all left me with the same result
What is the easiest way to have a filepath in "system" or "emacs" clipboard, and then head over to emacs and start editing just that file ?