4

I installed vifm through macports.

If I press enter on a file, it just opens it for editing.

How can I launch a file with it's associated program?

i.e. if I have a file highlighted, is there a key I can press so that it does the same thing as

open %c

Where %c is the name of the file that's highlighted?

z-buffer
  • 485

2 Answers2

3

I almost accidentally saw this question and decided to provide an answer in case you're still didn't find one in the documentation.

To open files with associated programs you need to add the following command to your ~/.vifm/vifmrc file:

filetype * open %c

Then both l and i keys will work for you as expected. See help on :filetype and :filextype in the documentation.

This doesn't work out of the box, since different systems have different open commands and the default behavior is to open all files with Vim (for example, xdg-open for Ubuntu 16.04, as opposed to the aforementioned "open", which is specific to Mac). Maybe new version will contain a set of open commands for different systems in sample vifmrc file, so it will work from the beginning.

xaizek
  • 131
1

Using i will open the selected file with its associated program. This is per the online documentation from the Vifm site. I am not sure how or if you can alter which application opens a file from within vi; that might have to be switched elsewhere.

soxman
  • 1,935
  • Actually open /mp3/file/to/play works just fine. The problem is getting vifm to do this. – z-buffer Feb 25 '12 at 15:27
  • I misunderstood your question - sorry about that. I edited my answer to hopefully offer the correct information and possibly solution. – soxman Feb 25 '12 at 19:23
  • i doesn't do anything. I also tried it in Linux and it doesn't work there either. – z-buffer Feb 26 '12 at 01:57