Welcome to Vifm Q&A, where you can ask questions about Vifm usage. Registration is optional, anonymous posts are moderated. GitHub or Google logins are enabled.
0 votes
in vifm by

Hello,

In this page we see the following:

" yank path to current file to Windows clipboard with forward slashes
nnoremap yf :!echo %"c:gs!\!/! %i | clip<cr>

However, with this in my configuration file, if I navigate to a file, say "C:/temp/myfile.txt", and press "yf", my clipboard will contain:

"myfile.txt"

including the quotation marks. Ideally, I think the clipboard should contain:

 C:/temp/myfile.txt

How we would go about achieving this? Any help would be appreciated.

Best regards.

1 Answer

0 votes
by

Hello,

try this (added :p):

nnoremap yf :!echo %"c:p:gs!\!/! %i | clip<cr>
by

Thank you very much, that did the job.

One more thing: any chance the quotation marks can be removed as well? My clipboard contains:

"C:/temp/myfile.txt"
by

You can try dropping " to get

nnoremap yf :!echo %c:p:gs!\!/! %i | clip<cr>

but I'm not sure how well it would work with paths containing spaces. Those quotation marks are there to do the escaping, but echo doesn't handle its arguments properly.

...