Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Bridging the gap

After years of daily swims in the vast sea of Vim-plugins, ranging from 2-line snippets to full-blown superstar programs, I have observed how a very significant amount of these plugins aim to bring Vim closer to the Shell by filling the gap with plugins that basically wrap Shell-functionality into neat little Vim commands.

While many of these plugins surely justify the time spent installing, configuring and learning them, I cannot help feeling that the approach is "odd". It kind of feels like siblings; they may need, support and love each other, yet marrying them would be weird. That is how I feel about Vim and the Shell.


So what are our options?

Out of the box, your best bet for interacting with the shell through Vim would be something along the lines of:

1) Run a 'ls -al' in a separate window, Vim restored when the command finishes and user presses the ENTER key.

:! pwd


2) Starts a shell inside Vim. Leaving the shell by typing 'exit' returns the user to Vim.

:shell


3) C-z (Control+z) puts Vim in the background, giving the user back to the shell while keeping the Vim-session intact. At this point, the user may use the shell indefinitely and can at any time restore Vim by typing 'fg'.

C-z
$ grep -ir "penguins" .
$ fg

Extra: Output from system commands can also be piped into Vim using the :r ex-command.

:r! ls -al


Ain't that all we need?

Perhaps. While these are all great options and have slightly different areas of usage, none of the above options are asynchronous. Additionally, the only option that feels native, as if I am not working inside an "artificial environment", is 3.

Wouldn't it be great to be able to do a deep find/grep/ack search, or perhaps start a daemon in a pane while being able to continue writing in another? Vim doesn't allow this, as it as of today does not support asynchronous invocations. Since Vim alone is unable to do more than one thing at the same time (can we now conclude Vim is a male?), Vim has to hand out tasks to someone else, say a wrapping program like tmux (a terminal-multiplexer alternative to screen).

But at the end of the day, Vim alone cannot (to my knowledge) perform asynchronous tasks.

Taking into consideration the great community of Vim and the empirical fact that Vim-users will, no matter how ugly the hack, make things work in the end, I would expect that if something that was considered a complete necessity was missing, it would get out there somehow.


Except.. If it's intentional

Like Emacs is jokingly referred to as an Operating System due to its rich multitude of ways to interact with your system, I feel that Vim is in the complete opposite end of the spectrum.

Vim doesn't feel like it's meant to be used to sending emails. Vim doesn't feel like it's meant to be used to tail logs, kill processes, modify access rights and restart daemons. However, Vim does feel like the worlds deadliest army-knife in terms of chopping, rearranging and creating new code, and I am completely, utterly satisfied with that.


Should Vim, taking it's historical roots and technical design into consideration,
be used for more than editing?

share|improve this question

closed as primarily opinion-based by Nifle, evilsoup, Ingo Karkat, Mark, Tog Dec 23 '13 at 12:22

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Interesting question but this isn't the place for it. Voting to close. –  Nifle Dec 23 '13 at 11:09
    
I don't want my text editor to do anything I don't explicitely tell it to do, asynchronously or not. –  romainl Dec 23 '13 at 12:45
add comment

1 Answer

This is probably best explained by :help design-not:

  • Vim is not a shell or an Operating System. You will not be able to run a shell inside Vim or use it to control a debugger. This should work the other way around: Use Vim as a component from a shell or in an IDE. A satirical way to say this: "Unlike Emacs, Vim does not attempt to include everything but the kitchen sink, but some people say that you can clean one with it. ;-)"

Apart from that, your question is highly opinion-based; there are various users with very divergent use cases and environments, so expect different people to have vastly differing (and often contradicting) opinions.

Lastly, I think the majority of plugins is concerned with basic editing tasks, not deep shell integration, and I think this is a good sign.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.