Shell Integration

81 views
Skip to first unread message

ironfish

unread,
Feb 15, 2008, 2:47:12 PM2/15/08
to vim_mac
Hi All,

First I'd like to state MacVim is awesome. Thanks for all the hard
work Bjorn. One issues that has always bugged me about gvim is shell
integration. I'm not sure how others feel about this but for me its
would be awesome if MacVim had true shell integration. I tried to
compile it with the vimshell patch but no love.

Perhaps it could be integrated outside of vim, like the way Coda, from
Panic, has shell integration. Since MacVim is a cocoa app maybe it
could just be another tab or something. May the cocoa part of MacVim
could split the window with the bottom part being terminal and the top
part being vim. Pathfinder from Cocoatech does something like this
using iTerm. See http://www.cocoatech.com/opensource.php. Pathfinder
integrates the terminal in a drawer/shelf. Personally I hate drawers/
shelf and prefer the way Panic does it in Coda.

What do others think?

Nico Weber

unread,
Feb 15, 2008, 2:55:45 PM2/15/08
to vim...@googlegroups.com
Hi Duncan,

>
> First I'd like to state MacVim is awesome. Thanks for all the hard
> work Bjorn. One issues that has always bugged me about gvim is shell
> integration. I'm not sure how others feel about this but for me its
> would be awesome if MacVim had true shell integration. I tried to
> compile it with the vimshell patch but no love.
>

> What do others think?

I'd like to see a shell in vim, but I don't think MacVim is the place
to add it. This should be added to vim core.

The vimshell patch looks interesting. Which problems did you face when
you tried to use it?

My biggest gripe with a missing shell is that doing `:make` in vim
freezes a whole window. This was really annoying in carbon vim, but
it's not that bad in MacVim, since the windows are independent -- so
you lose only one window :-P

Nico

Morel David

unread,
Feb 15, 2008, 2:56:39 PM2/15/08
to vim...@googlegroups.com

Le 15 févr. 08 à 20:47, ironfish a écrit :

>
> First I'd like to state MacVim is awesome. Thanks for all the hard
> work Bjorn. One issues that has always bugged me about gvim is shell
> integration. I'm not sure how others feel about this but for me its
> would be awesome if MacVim had true shell integration. I tried to
> compile it with the vimshell patch but no love.

I also tried to have a shell, but no success.

> Perhaps it could be integrated outside of vim, like the way Coda, from
> Panic, has shell integration. Since MacVim is a cocoa app maybe it
> could just be another tab or something. May the cocoa part of MacVim
> could split the window with the bottom part being terminal and the top
> part being vim. Pathfinder from Cocoatech does something like this
> using iTerm. See http://www.cocoatech.com/opensource.php. Pathfinder
> integrates the terminal in a drawer/shelf. Personally I hate drawers/
> shelf and prefer the way Panic does it in Coda.
>
> What do others think?

I was about to say +1 but I'd rather say +1000

D.Morel

Nico Weber

unread,
Feb 15, 2008, 2:58:01 PM2/15/08
to vim...@googlegroups.com
> The vimshell patch looks interesting. Which problems did you face when
> you tried to use it?

Nevermind, just found it on the web page: "Note, however, that so far
only the text mode VIM is fully supported, but support for the GUI
version is on its way."

ironfish

unread,
Feb 15, 2008, 3:19:49 PM2/15/08
to vim_mac
Nico,

I would agree with you but the shell seems to work just fine in
regular old vim. It's only gvim/macvim where there are problems and it
freezes such as you have experienced with make. Additionally, at least
for me, the shell doesn't have as useful in vim because I'm already in
the shell and I can just open a new terminal tab to run shell
commands. In gvim/macvim however I can't do that because the shell
doesn't behave properly. So I need at least two windows open, gvim/
macvim and terminal. On a laptop with small screen real-estate and
such, for me anyways, its a pain. I'm a one window guy. That's why I
love the MacVim tabs.

Since the shell seems to work in vim i'm not sure how much of a
priority it is for them to fix it in gvim. It seems that utilizing
open source like iTerm or something and integrating that into MacVim
may be the way to go.

Just my 2 cents.

P.S. Everyone, head over to paypal and donate to Bjorn and lets get
this guy a new laptop!

björn

unread,
Feb 15, 2008, 4:12:49 PM2/15/08
to vim...@googlegroups.com

It seems lots of people would like shell integration. I personally
probably wouldn't use it, but then again, maybe I would if it worked
nicely.

Like Nico I think this kind of feature should ideally be added to the
Vim source code, but that is not something I can do. Getting vimshell
to work might be a good "temporary" fix, but again, I don't think I
can do that.

As for having a shell in a split view under the vim view (which holds
the tabs, scrollers and text view); that is indeed something that I
could do and I will look into it when I get a chance.

However, this kind of functionality would be best suited as a plugin
of some sort. It would probably not be a good idea I start bloating
MacVim with lots of functionality that other ports of Vim lack. (It
would make MacVim nice, but it would no longer be Vim, right? Hmm...I
haven't already gone too far, have I?)

I have been thinking of getting around such issues by creating some
kind of a plugin architecture (and distribute plugins separately from
MacVim), but now we're talking weeks worth of coding so that will be
far into the future.

Still, I will keep thinking about it. I welcome more suggestions.

/Björn

Tim Allen

unread,
Feb 16, 2008, 4:03:48 AM2/16/08
to vim_mac
On Feb 16, 6:55 am, Nico Weber <nicolaswe...@gmx.de> wrote:
> I'd like to see a shell in vim, but I don't think MacVim is the place  
> to add it. This should be added to vim core.

I think a (possibly sluggish) terminal emulator could be added in
VimScript (or better yet in Python) if there was a way to hook into
Vim's select() loop - some sort of autocommand that said 'execute this
code when this file descriptor is readable' or 'execute this code when
this file descriptor is writable'.

I think that would open the door for a lot more Emacs-style
extensibility (IRC clients, mail readers, and the like), and would be
more likely to get into vim core than an entire vt100 emulator.

Nico Weber

unread,
Feb 16, 2008, 4:05:28 PM2/16/08
to vim...@googlegroups.com
> I would agree with you but the shell seems to work just fine in
> regular old vim. It's only gvim/macvim where there are problems and it
> freezes such as you have experienced with make. Additionally, at least
> for me, the shell doesn't have as useful in vim because I'm already in
> the shell and I can just open a new terminal tab to run shell
> commands. In gvim/macvim however I can't do that because the shell
> doesn't behave properly. So I need at least two windows open, gvim/
> macvim and terminal. On a laptop with small screen real-estate and
> such, for me anyways, its a pain. I'm a one window guy. That's why I
> love the MacVim tabs.

By the way, what are you using the shell for in vim? In my experience,
a lot of things can be done quite efficiently from within vim with a
few keybindings and with using `:!` (e.g. `:!ls`) every now and then.

> Since the shell seems to work in vim i'm not sure how much of a
> priority it is for them to fix it in gvim. It seems that utilizing
> open source like iTerm or something and integrating that into MacVim
> may be the way to go.

I use gvim on linux as well, and I'd prefer if MacVim would stay 'just
vim' (with some os x integration). Tim's suggestion (provide a hook
into select()) sounds reasonable to me (but I'm not too familiar with
that :-P).

Nico

travis

unread,
Feb 16, 2008, 4:54:52 PM2/16/08
to vim_mac
I can tell you right now there is no way that it will ever be built-in
to Vim, Bram likes to keep the features strictly to editing text, not
another bloated editor like Emacs.
Here's what it says in the Vim Documentation:
http://vimdoc.sourceforge.net/htmldoc/tips.html#shell-window

ironfish

unread,
Feb 16, 2008, 9:02:28 PM2/16/08
to vim_mac
Nico,

I use the shell to run Ruby/Java/MySQL stuff. I know there is a
rails.vim plugin and I use it quite extensively but I still like
running my script via the terminal rather than the built in commands.
Additionally I use MySQL quite a bit and use it via terminal. I've
tried all the gui's for MySQL and I still prefer terminal.

Having an editor on top and terminal on the bottom in a split screen
would invaluable for me. This is how I use Coda. I just like vim
better. In reading many of the various vim email groups it seems that
this is a common request and I know emacs supports it. Since MacVim is
cocoa application that opens a window that embeds gvim into it makes
perfect sense, to me anyways, to allow another window or tab for
terminal.

I think Bjorn is probably right in that it would be better suited as a
plugin. If the basic MacVim architecture was essentially a frame/
window that allowed you to vertically split or horizontally split on
any tab then all kinds of cool plugins could be written. I could see
finder (file explorer plugins), terminal plugins, heck even a webkit
plugin allowing an embedded browser.

I'm all for the integrity of the product being vim and Bjorn has done
an incredibly job at doing this, but the way I see it is these ideas
only increase its overall value.

Duncan

ironfish

unread,
Feb 16, 2008, 9:03:22 PM2/16/08
to vim_mac
All the more reason MacVim is the perfect application to do this in.

Matt Tolton

unread,
Feb 16, 2008, 9:37:41 PM2/16/08
to vim...@googlegroups.com
I second (or third, or whatever) the thought that a plugin
architecture would be great for MacVim.

travis

unread,
Feb 18, 2008, 5:15:42 AM2/18/08
to vim_mac
I don't really see the need for it (Terminal on bottom half) and think
that the effort put into could be better used elsewhere.

1) What's wrong with just using :! command?
2) With the :! command you can just map commands to that that, one
example of this is the Rails.vim script that works extremely well and
is very powerful.
3) There doesn't seem to be an equal amount of gain vs work put into
this, Vim is text editor, it does one tool and it does it very well,
concurrently the Terminal is made for these commands and will have a
lot more power than what would be possible through a plugin.

However as for a plugin architecture that sounds a little more
promising something that takes advantage of Cocoa, ie. WebKit preview
or something along that line.

Morel David

unread,
Feb 18, 2008, 5:22:47 AM2/18/08
to vim...@googlegroups.com
Le 18 févr. 08 à 11:15, travis a écrit :

> I don't really see the need for it (Terminal on bottom half) and think
> that the effort put into could be better used elsewhere.

Bottom half maybe not, but new tab yes.

> 1) What's wrong with just using :! command?

Doesn't run in real-time, no control, etc. For very long scripts, this
is annoying.

> 2) With the :! command you can just map commands to that that, one
> example of this is the Rails.vim script that works extremely well and
> is very powerful.
> 3) There doesn't seem to be an equal amount of gain vs work put into
> this, Vim is text editor, it does one tool and it does it very well,
> concurrently the Terminal is made for these commands and will have a
> lot more power than what would be possible through a plugin.

Since this is supposed to be an OO framework and apparently it isn't all
that difficult to integrate iTerm in a separate tab, why not have it?
I'd personnally much prefer staying in one window than switching.

> However as for a plugin architecture that sounds a little more
> promising something that takes advantage of Cocoa, ie. WebKit preview
> or something along that line.

So why put a webkit preview and not a terminal (which personnally I'd
use all the time)? I don't get it. Is it that much different?

David


Tim Allen

unread,
Feb 18, 2008, 5:59:06 AM2/18/08
to vim_mac
On Feb 17, 1:02 pm, ironfish <duncan.dev...@gmail.com> wrote:
> I use the shell to run Ruby/Java/MySQL stuff. I know there is a
> rails.vim plugin and I use it quite extensively but I still like
> running my script via the terminal rather than the built in commands.
> Additionally I use MySQL quite a bit and use it via terminal. I've
> tried all the gui's for MySQL and I still prefer terminal.

It has been pointed out to me by a friend that vimsh is probably about
as good as you're going to get without hacking the Vim source as
vimshell does:

http://www.vim.org/scripts/script.php?script_id=165

It's not a full terminal emulator, and while it suffers from
limitations like Vim's input model and being unable to poll for
output, it's more than sufficient for simple tools like bash, ftp, and
maybe mysql or psql. It certainly beats ":!".
Reply all
Reply to author
Forward
0 new messages