Shane Courtrille
Shane Courtrille

Reputation: 14097

Vim: running a command in the editor instead of shelling out

When I do something like !git init inside of vim it switches over to bash and runs the command there then says "Press Enter to continue".

From what I've read and seen I thought it would run the command in the bottom area of vim (in a buffer maybe?).

Am I doing something wrong? Is there a setting I messed up on?


While that git plugin does look interesting I'm watching a TekPub demo where he is doing things like !bundle install as well and the result is just displayed at the bottom (under where he typed the command) in vim directly.

Also I am using vim in Ubuntu if that matters.

Upvotes: 3

Views: 787

Answers (3)

Jeet
Jeet

Reputation: 39837

This is the behavior I have (and have always had) when using console Vim. The behavior that you were expecting is what I get when using GUI Vim (e.g., MacVim or GVim). So, to answer your question: no, you are not doing anything wrong, and there are no messed up settings.

Upvotes: 1

Celsius1414
Celsius1414

Reputation: 61

Use

:read !command

to insert output in current buffer. So, for example, if you want to insert the current date:

:r !date

Upvotes: 1

richo
richo

Reputation: 8999

If you're specifically wanting to use Git, checkout Tim Pope's fugitive plugin.

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

Upvotes: 3

Related Questions