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

I use VIFM in ConEmu alonside Visual Studio to browse directories and open files. Is there a way to have Vifm emulate Emacs style Dired or Helm modes so that i could start typing a directory or file name and have VIFM incrementally browse directories until the file is selected?

1 Answer

0 votes
by
edited by

I haven't used Emacs much and thus don't really understand the question (a try to find a screencast that demonstrated something similar failed too). So feel free to provide more details. But maybe you're looking for one of these or can compare to them:

  1. Regexp search with / (do :set incsearch to make it incremental).
  2. Regexp filtering with =.
  3. You could load all files in a sub-tree via :!find * (might not work on Windows, so maybe :tree which will be available since the next version) and then do filtering among hem.

If it's something that involves fuzzy matching, then there is no such thing in vifm, at least not yet.


UPDATE (15 January 2023): master now contains a mode that somewhat resembles Dired (commit), there is no fuzzy matching though (at least at the moment).

by

https://www.youtube.com/watch?v=lsgPNVIMkIE

Here's a video where at the start he is in dired mode and uses find file. I guess it is fuzzy matching though.

by

Thanks for the link. Now I recall that I even tried this thing. Actually I want some kind of fast navigation feature similar to this, but never decided how exactly it should work. Probably need to play with Dired to see how convenient is their version, though vifm is not limited to command-line and maybe could filter files directly in the view.

by

A nice thing to play around with is Spacemacs. Its basically a community driven improvement over base emacs and has lots of nice search features if I recall (and build in Vim mode). I actually found VIFM because I wanted to use Spacemacs for dev but you can't beat visual studio for intellisense and debugging. So I've since setup my visual studio with VsVim and removed all the UI clutter, and I launch VIFM inside ConEmu with quake mode enabled so I can quickly use the keyboard to navigate source directories.

by

Would there be a way to integrate this into VIFM:

https://github.com/ctrlpvim/ctrlp.vim

so that it uses fuzzy search from the current directory and post append the current results.

For instance if I turned on fuzzy search it would enter input mode with :| "current fuzzy search results"

by

Integrating a Vim plugin won't work, it requires actual Vim. But an external application like fzf can be used for navigation as in this question (didn't try it on Windows, but it might work).

by

Thanks for the info. I just added your fix from that thread to my .vifmrc and tried running it, but after finding a file with fzf and hitting enter I just return to vifm. Not sure if this is a problem with fzf on Windows though.

by

Nevermind, I typed :!fzf instead of :fzf. This is exactly what I was looking for thank you.

If anyone else is on Windows and wants to use this to open source files in Visual Studio this is how I handled it:

In your vifmrc under the filetype associations look for

" For Windows:

and change explorer to

filetype * OpenFile.cmd 

Then create a OpenFile.cmd script that vifm can find and have it do the following

@echo off

for /f "tokens=2 delims=," %%I in (
	'wmic process where "name='devenv.exe'" get ExecutablePath^,Handle /format:csv ^| find /i "devenv.exe"' ) do set "exepath=%%~I" 

if %errorlevel% NEQ 0 (goto notepad)

"%exepath%" /edit "%*"
exit
:notepad
start /b "" notepad.exe "%*"
exit

This will find the current (or first) open visual studio and send the file to it, otherwise it will open the file in notepad.

To use FZF you need to put the executable somewhere VIFM can find it.

In your vimrc under the section

" :com[mand][!] command_name action

add the following commnds

command! f :execute '!fzf 2>&0 %%U' | normal! gf
command! o :execute '!fzf 2>&0 %%U' | normal! ih

the first will open the directory of the file in vifm and the second will open the file and return to the directory you started fzf in.

...