The Computer Oracle

vifm: How to set right window to see content of dir or file highlighted in left window

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: A Thousand Exotic Places Looping v001

--

Chapters
00:00 Vifm: How To Set Right Window To See Content Of Dir Or File Highlighted In Left Window
00:19 Answer 1 Score 0
00:59 Accepted Answer Score 22
02:09 Answer 3 Score 4
02:32 Answer 4 Score 0
02:59 Thank you

--

Full question
https://superuser.com/questions/455044/v...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#filemanagement

#avk47



ACCEPTED ANSWER

Score 22


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.




ANSWER 2

Score 4


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 */)




ANSWER 3

Score 0


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.




ANSWER 4

Score 0


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.