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.

Mount fuse remote dir with a command

+1 vote
asked Jul 28, 2016 in vifm by tagwint

Currently the only way I know to mount remote dir over fuse is to prepare a .ssh file in advance.
How could I implement a command that would look like

 :ssh user@host:/dir

and result in mounting that remote dir and then displaying it in current pane ?

1 Answer

+2 votes
answered Jul 28, 2016 by xaizek

No direct way of doing this, but the automation can be achieved with a workaround (it's not really pretty, but it works):

command ssh
    \ : let $SSH_FILE = system('tempfile -d %d -s .ssh')
    \ | execute '!echo ''%a'' > $SSH_FILE; ls $SSH_FILE %%U'
    \ | execute 'normal l'
    \ | execute '!rm $SSH_FILE'

This creates file with .ssh extension in the current directory, uses it with FUSE and removes afterward.

commented Jul 28, 2016 by tagwint

I had to modify the system command syntax to adopt it to linux to make it work

command ssh 
\ : let $SSH_FILE = system('mktemp /tmp/XXXX.ssh')
\ | execute '!echo ''%a'' > $SSH_FILE; ls $SSH_FILE %%U'
\ | execute 'normal l'
\ | execute '!rm $SSH_FILE'

Thanks for the meaningful sample code - it shows me direction for further automation

commented Jul 28, 2016 by xaizek

Just FYI, tempfile is GNU/Linux command too. I always forget whether mktemp or tempfile is more common.

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.