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

I'm trying to yank current selected filenames:

vnoremap yf :!echo -n %f | xclip -selection clipboard %i<cr>:echo "filenames yanked to clipboard"<cr>

But when the expansion of %f macro happens, it uses a single space as a separator. I want to change that separator. I tried using --delimiter option but it didn't work.

I know I could replace the space with a \n using sed, but what if the filenames themselves have a space?

I couldnt find anything about this on the manual.

1 Answer

0 votes

That separator is not configurable, but you can use printf for formatting (tail is to avoid extra empty line):

vnoremap yf :!printf "\n%%s" %f:p | tail -c+2 | xclip -selection clipboard %i<cr>:echo "filenames yanked to clipboard"<cr>
If you would like to make a bug report or feature request consider using GitHub, SourceForge or e-mail. Posting such things here is acceptable, but this is not a perfect place for them.