开发者

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

开发者 https://www.devze.com 2023-03-19 19:25 出处:网络
When I do something like !git init inside of vim it switches over to bash and runs the command th开发者_StackOverflow社区ere then says \"Press Enter to continue\".

When I do something like !git init inside of vim it switches over to bash and runs the command th开发者_StackOverflow社区ere 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.


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

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


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.


Use

:read !command

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

:r !date
0

精彩评论

暂无评论...
验证码 换一张
取 消