How can I set the right window to see the content of the highlighted directory or file in the left window in vifm? (like in ranger)
4 Answers
For versions prior to 0.8.1 (released on 2016-01-17)
Add command similar to the following one to your ~/.vifm/vifmrc file as one of the last of :fileview commands (because the order in which they appear matters and you don't want it to follow fileview *):
fileview */ tree %c
For 0.8.1 and up
Previewing directories is builtin now, just don't redefine viewer for */ and it will work (you can use *[^/] pattern for :fileviewer command to don't match directories).
Then turn on quick view with:
view
You can add this command to your vifmrc. Or add tui to 'vifminfo' (e.g. with set vifminfo+=tui in vifmrc) to make vifm save quick view state between sessions.
Extra
I also would suggest to add a mapping to switch quick view mode with a key in normal mode to your ~/.vifm/vifmrc file:
nnoremap w :view<cr>
By the way
Sample configuration file of vifm contains commands like these.
(like in ranger)
If you need closer resemblance, take a look at 'millerview' and 'milleroptions' options.
- 1,191
I'm not yet allowed to comment, so I provide an answer to get my points.
In addition to xaizek's answer
fileview */ tree %c
I have added
fileview ../ tree %c -L 1
below that to be able to see what is in the parent directory while scanning the contents of a directory. This is just for cosmetic completeness. (parent directory is not picked up by */)
- 49
I'm not allowed to comment.
To go a bit further than Svenn comment, you can add to your .vifmrc:
" Normal dirs
fileview */ tree %c -L <depth>
" Hidden dirs
fileview *./ tree %c -L <depth>
" .. Parent dir
fileview ../ tree %c -L <depth>
Please, note that order has its importance if you want to set a different depth for each kind of folder. Svenn's wildcard doesn't work for hidden directories (vifm version: 0.9.1 and tree v1.7.0.
- 101
I don't think you can without, possibly, writing your own command.
vifm is designed as a Midnight Commander like two-pane file explorer. It means that each pane can be considered as a "source" or "target" for your file manipulations. The right pane is pretty much totally disconnected from the left pane and can't be consired a "preview" of the content of some directory on the left pane.
ranger is designed after Mac OS X's Finder's column view where you don't have that notion of "source/target".
I guess it's one style or another. I've got both on all my machines and can't decide which one to throw away as each program has its strong points.
- 22,897
:fileviewand:viewcommands to handle quick view of selected file in the second pane. Different preview programs can be selected with globals. vifm can also be used in one-pane mode with marks and:pushd/:popdsupport. It also has less-like preview mode. – xaizek Jul 30 '12 at 21:42:viewonly allows to "preview" files while the OP wants to see the content of a directory. I wrote in the 1st line of my answer that he would need to write is own command to achieve his goal and you showed him how to write such a command. One thing I totally failed at (and that I only see right now, as I'm writing this comment) was reading carefully the question: I focused on the "viewing directories" part and totally missed the "viewing files" part. I'll be happy to give you the tick. – romainl Jul 31 '12 at 05:22