I need to get the path and file name out of the open file. Wrinkle .. The file is FTP'd to my Desktop and I need the Linux path.

I found this on the web that prints the path file name

noremap <silent> <F4> :let @+=expand("%:p")<CR>

I get this C:\Users\rr243319\AppData\Local\Temp\scp30622\bcs\lgnt\clientapp\etscmbn\scripts\combine-ctc.pl

I need


Question : How do I convert the path to a linux like path?


1 Answer 1


This stores the current filename in the system clipboard with backslashes replaced with forward slashes:

noremap <silent> <F5> :let @+ = substitute(expand("%:p"), '\', '/', 'g')<cr>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.