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

Hi, I've noticed that I often have one vifm instance where I house all of my relevant directories. However, upon rebooting / restarting my session I now manually start new tabs and go to my directories.

So my directory structure looks something like this:

Tab 1 (named local): dir/a (left), dir/b (right)
Tab 2 (named remote): dir/c (left), dir/d (right)
Tab 3 (named remote2): dir/e (left), dir/f (right)

etc.

Is there a way to set up vifm in such a way that it automatically starts with the tabs named accordingly and in those tabs the left and right panes opened in their specific directories?

1 Answer

0 votes
by

Hello,

you can add something like the following to your vifmrc to get the desired configuration:

tabname local
cd /etc /var

tabnew
tabname remote
cd /usr /proc

tabnew
tabname remote2
cd /home /dev

" start on the first tab
tabnext 1

Next release (the one after 0.10.1) will have persistent tabs
(set vifminfo+=tabs), which might also be relevant in this case.

by

Thanks!

Is there a way to call those instructions using a command or something similar?
I would love to have something like :gotomydirs and have it run those commands.

by

You can do:

command! gotomydirs tabname local
                 \| cd /etc /var
                 \| " and so on...

However, in this case it might be simpler to save configuration in a file like
:e $VIFM/mydirs.vifm and define

command! gotomydirs source $VIFM/mydirs.vifm
by
edited by

Thanks, but that doesn't seem to be working for me.

I've put the following in $VIFM/mydirs_test.vifm:

tabname test
cd /home/ /home/

And in $VIFM/vifmrc I put command! mytest source $VIFM/mydirs_test.vifm

But when I start vifm and run :mytest it says:

/home/me/.config/vifm/mydirs_test.vifm: line 1: tabname: command not found
/home/me/.config/vifm/mydirs_test.vifm: line 2: cd: too many arguments
Press return ...

It's the same if I prepend both of the lines with :

by

My bad, sorry, I missed a colon, it should be:

command! mytest :source $VIFM/mydirs_test.vifm
by

Thanks, that did the trick.
And I'm looking forward to the persistent tabs feature :)

...