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

The following commands have made quick navigation much easier.

" Select file and go to its parent directory ( fdfind is fd in debian)
   command! FZFfind : set noquickview
                    \| let $FZF_PICK = term('fdfind --type f --hidden --follow | fzf --height 80 2>/dev/tty')
                    \| if $FZF_PICK != ''
                    \|     execute 'goto' fnameescape($FZF_PICK)
                    \| endif

" Select folder and cd into it
   command! FZFlocate : set noquickview
                      \| let $FZF_PICK = term('locate $HOME | fzf --height 80 2>/dev/tty')
                      \| if $FZF_PICK != ''
                      \|     execute system('[ -f "$FZF_PICK" ] && echo goto || echo cd') fnameescape($FZF_PICK)
                      \| endif

How can this manipulated so that the selection is sent to the command line without replacing already typed command?

Example, for selecting source file/folder for symbolic link
I type :!ln -s "paste selection here"

1 Answer

0 votes
by

You could copy selection to a clipboard with xclip beforehand by adding another command for that.

Not sure, but it might also be possible to write a mapping that:

  1. Leaves command-line mode
  2. Picks a file
  3. Returns to command-line mode and pulls original command-line from history this time inserting the path (this is the hard part, probably need to define and undefine a mapping in the middle to make it work)

I'll attempt to do this later.

by

Oh, I forgot about the the xclip feature from the wiki. That would be sufficient really. But how can I paste it into command line? pressing ctrl-v doesn't paste it.

by

Shift+Insert does the pasting if you copy into selection buffer.

...