13

I've been searching with no results for an integration of bash inside vi, as featured in emacs; the problem is: I have vi open with 2 views, one open with :split command, and I want to use bash through the second view, while I'm editing a file in the first; if I do :sh while editing the second view, the whole session pauses and a bash shell is opened, but I'm not able to edit the file and use the shell at the same time.. I don't want to use !<command> or external programs such as "terminator".. Is there a solution? Thx

gc5
  • 9,468
  • 24
  • 90
  • 151
  • 2
    vi (I assume Vim) != emacs, I'm afraid - the philosophy behind the two is completely different –  Jul 11 '10 at 12:04
  • I know :) I would use vi because is more portable and lighter than emacs but I can't bear that there's not a feature like that :\ – gc5 Jul 11 '10 at 12:17
  • 2
    I think `screen(1)` is a nice solution if you're on *nix – YasirA Jul 11 '10 at 12:41

6 Answers6

13

Have you tried looking for third-party Vim plugins? Conque Shell looks like it might do the job.

jabirali
  • 1,315
  • 7
  • 13
  • 1
    Conque shell has a few drawbacks like how everything is done in insert mode, so you have to return to normal mode before changing windows, can't enter shell then vim again... – puk Mar 19 '12 at 20:59
1

I'm afraid this feature isn't available in (presumably) Vim. It is on the list of possible new features. See here http://www.vim.org/sponsor/vote_results.php. At the current time of writing this is feature number two, add IDE features. If you want to vote for this feature you will need to sponsor Vim.

Greg Sexton
  • 9,189
  • 7
  • 31
  • 37
  • I've sponsored the vim project too, even if I've found in the ConqueShell plugin what I was looking for. Hope for an integration or implementation soon.. – gc5 Jul 11 '10 at 21:55
  • 1
    @Francesco this likely won't happen. Read `:help shell-window`. This saddens me :( – Randy Morris Jul 11 '10 at 23:36
1

I use VIM in conjunction with tmux, which handles window splits very well. I just transitioned to this workflow from a combination of terminal and GVIM, though, and I encountered your question in looking for a piece missing from my old workflow.

I could run GVIM from the command line with the "--servername" flag and add files to that window with the "--remote-tab" flag. Now that I'm living entirely in the terminal with tmux, I don't seem to have the same option, so BBW. :/

AL the X
  • 1,004
  • 11
  • 15
0

I just wrote myself a plugin for that purpose, see http://www.vim.org/scripts/script.php?script_id=4887

It won't work under Windows. On the other hand, it uses the Unix philosophy: two FIFOs, some tricky interaction between background processes. It doesn't require python or whatever. It allows to execute either a shell or any interpreter for a programming language. You can see a video of it with GNU APL working in a buffer here.

Like IPython, you work on your own buffer and see the output in a scratch buffer.

Since I spent much time on Stackoverflow studying the answers of the three following pages:

I will post the same answer on the three pages; I hope nobody will be hurt by this triple post, but really they ask something close and someone else could find my answer interesting for his/her own purposes by browsing the web and finding any of these three pages.

Community
  • 1
  • 1
Thomas Baruchel
  • 7,236
  • 2
  • 27
  • 46
0

As a new (and maybe better) answer, may I suggest you to have a try to the amazing neovim fork of vim? It is a newer project; I tried it myself and found no compatibility issue with vim (including the use of sophisticated plugins) and it has exactly what you are asking for.

Thomas Baruchel
  • 7,236
  • 2
  • 27
  • 46
0

neovim now support terminal emulation. More details at help nvim-terminal-emulator in nvim

dlmeetei
  • 9,905
  • 3
  • 31
  • 38