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 was wondering if there was a way to open a pdf file or any file and still have vifm running so that I can go to it and open more files?

1 Answer

0 votes
by

Hi,

when invoking pdf viewer just add & at the end (see the docs).

by
edited by

Please help, the "&" work fine in pdf files but not in vim txt files.

Please refer to my vifmrc

filetype *.txt "C:\Program Files (x86)\Vim\vim82\vim.exe" &
fileviewer *.txt "C:\Program Files (x86)\Vim\vim82\vim.exe" &

filetype *.pdf "C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe" &
fileviewer *.pdf "C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe" & 
by

That's because vim.exe is a console application, use gvim.exe.

by

Thanks @xaizek, it's a good way, but I like using wim terminal mode.

by
edited by

You can try using

start cmd /C "C:\Program Files (x86)\Vim\vim82\vim.exe"

for command instead or maybe this will be enough:

start "C:\Program Files (x86)\Vim\vim82\vim.exe"

But I'd expect issues with escaping, which just isn't well-defined on Windows.

by

Thanks a lot xaizek. Didn't work. I tried all you suggested.

by

Try this one, seems to work for me:

filetype *.txt echo && start "vim" "C:\Program Files (x86)\Vim\vim82\vim.exe" %"c

Turns out if you quote the first argument, it's treated as a title. echo && is to workaround start being an internal command.

by

Hi xaizek, I guess we are near of solution maybe one more step.

I tried, but didn't open new session, following I share with you the message showed.

'vim' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .

by

Wierd, maybe they changed start command. Try without "vim" then:

filetype *.txt echo && start "C:\Program Files (x86)\Vim\vim82\vim.exe" %"c
by

Hi xaizek, thanks a lot, I tried everything and didn't work, lastly tried the statements directly in Power Shell, and some of that worked, but not in vifmrc, I don't know why.
Doing that I discovered the correct statement separator is ";", not &&, anyway didn't work in vifmrc.

filetype *.txt start cmd /k ; start "C:\Program Files (x86)\Vim\vim82\vim.exe"

by

Dear xaizek, it's only script issues. We are near of solution. With the last test I achieved al least launch the file in other cmd session, the only point that I want to solve is what I'll describe for you.

Now, with this statement...

filetype *.txt cmd && start "C:\Program Files (x86)\Vim\vim82\vim.exe"

Occurs the following...

I press Enter over file >> CMD is opened >> I close the CMD >> The file in VIM pop up

WE ARE REALLY CLOSER, only remains that wont be neccessary to close CMD for view the txt file.

by

Maybe try:

filetype *.txt cmd /C "C:\Program Files (x86)\Vim\vim82\vim.exe"
by

WORKING!!!!!! tHANKS A LOT.

...