Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to the Power Users community on Codidact!

Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.

Open file from vifm in split view

+4
−0

I use vifm in split mode - it always shows two vertically separated windows each with a directory listing. From there I can open files using the right arrow. However when I open a text file, vifm goes to the background and vi is in the foreground covering the whole screen. Is it possible to have vi only open in the window from where I open the text file (ie. half the screen), and have the other window (the other half of the screen) continue to show vifm and the directory listing?

I'm using debian 11 if that matters.

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+4
−0

From the FAQ:

No, unfortunately it's not possible. Allowing this would require embedding terminal multiplexer into Vifm, which is kinda silly because it is a file manager. The compromise is to run Vifm inside terminal multiplexer and provide some integration between them (there is already some builtin support for GNU Screen and tmux in Vifm, e.g. :screen, :ls).

However, there are several options to prevent the editor from blocking Vifm.

Use Gvim

A GUI editor opens in a new window, leaving Vifm's terminal free.

:set vixcmd="gvim &"

Note this option really needs to specify a Vi editor if you want external editor tasks to work. In other words, if you try, for example,

:set vixcmd="xedit &"
:set vixcmd="xterm -e nano &"

that will work fine for normal file editing, but will break q: and :rename. The reason is explained in the manual:

vicmd

Command used to edit files in various contexts. Ampersand sign at the end (regardless whether it's preceded by space or not) means backgrounding of command.

Background flag is ignored in certain context where vifm waits for the editor to finish. Such contexts include any command that spawns editor to change list of file names or a command, with :rename being one example. ’-f’ is also appended to prevent forking in such cases, so the command needs to handle the flag.

Additionally ’+{num}’ and ’+'call cursor()'’ arguments are used to position cursor when location is known.

Use a terminal multiplexer

If you run Vifm under Tmux or Screen and activate multiplexer integration with the :screen! command, then the files are opened in a new Tmux or Screen window.

Open a new terminal for the editor

Vifm supports binding different commands to different mime-types (as listed by file -i filename) or file patterns. For example,

:filextype <text/*> xterm -e vim %f &

opens files whose mime-type matches text/* in a new terminal with Vim, while

:filextype *.txt xterm -e vim %f &

does the same for all files with a .txt extension, and since the Vim terminal is put in the background, the Vifm terminal does not block.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

Works for me (1 comment)

Sign up to answer this question »