在macbook上运行vim内的终端?

时间:2022-02-04 17:15:34

I searched some old answers on *, some of them seem relevant, but none of the solutions work on my macbook (with mountain lion). e.g. The shortcuts mentioned in answers here do not work on my computer: How do I run a terminal inside of Vim?

我在*上搜索了一些旧的答案,其中一些看似相关,但没有一个解决方案适用于我的macbook(与山狮)。例如这里的答案中提到的快捷方式在我的计算机上不起作用:如何在Vim内部运行终端?

So I'm wondering if it's because vim on mac/unix is different from a normal linux one. I don't think so, but I'm not sure.

所以我想知道是不是因为mac / unix上的vim与普通的linux上的vim不同。我不这么认为,但我不确定。

Since I can split the screen with :sp, I'm wondering if it's possible to use one split as terminal and another as the regular vim editor, just like emacs. If so, what's the correct way to do it? (Maybe particularly for mac) If not, it's sad.

因为我可以用:sp分割屏幕,我想知道是否可以使用一个分割作为终端而另一个作为常规vim编辑器,就像emacs一样。如果是这样,那么正确的方法是什么? (也许特别对于mac)如果没有,那很难过。

3 个解决方案

#1


1  

Why don't you do things the other way around?

你为什么不反过来做事?

You can use a terminal multiplexer such as Tmux and split a terminal window into two panes using C-b %.

您可以使用终端多路复用器(如Tmux)并使用C-b%将终端窗口拆分为两个窗格。

Inside the second pane you can run macvim inside a terminal with $ mvim -v

在第二个窗格中,您可以使用$ mvim -v在终端内运行macvim

You can navigate between the two panes with C-b o, (And do much more, but I'll leave it up to you to discover!)

您可以使用C-b o在两个窗格之间导航(并且还要做更多,但我会留给您发现!)

Doing things this way around is much more sane in my opinion, you get the full power of both the terminal and vim without having to hack around with Vim too much (Plus Tmux is very handy for many other uses).

以这种方式做事在我看来更加明智,你可以获得终端和vim的全部功能,而不必过多地攻击Vim(Plus Tmux对于许多其他用途非常方便)。

I hope doing things this way around is appealing enough for you!

我希望以这种方式做事对你来说足够吸引人!

#2


0  

Having a terminal inside of vim would go against the author's philosophy and design so no: that feature will probably never appear nativelyly in vim.

在vim中设置一个终端会违背作者的理念和设计,所以不会:该功能可能永远不会出现在vim中。

There are a couple of plugins that more or less work like conqueterm, try them if you really want that feature. Or simply use a separate terminal window like everybody.

有几个插件或多或少像conqueterm一样工作,如果你真的想要这个功能,请尝试它们。或者像每个人一样使用单独的终端窗口。

#3


0  

You should definitely look at programs like tmux or screen.

你应该看看像tmux或屏幕这样的程序。

But an even simpler solution is to use C-z (which halt vim) to access the terminal and fg to bring back vim into the foreground.

但更简单的解决方案是使用C-z(停止vim)访问终端和fg将vim带回前台。

#1


1  

Why don't you do things the other way around?

你为什么不反过来做事?

You can use a terminal multiplexer such as Tmux and split a terminal window into two panes using C-b %.

您可以使用终端多路复用器(如Tmux)并使用C-b%将终端窗口拆分为两个窗格。

Inside the second pane you can run macvim inside a terminal with $ mvim -v

在第二个窗格中,您可以使用$ mvim -v在终端内运行macvim

You can navigate between the two panes with C-b o, (And do much more, but I'll leave it up to you to discover!)

您可以使用C-b o在两个窗格之间导航(并且还要做更多,但我会留给您发现!)

Doing things this way around is much more sane in my opinion, you get the full power of both the terminal and vim without having to hack around with Vim too much (Plus Tmux is very handy for many other uses).

以这种方式做事在我看来更加明智,你可以获得终端和vim的全部功能,而不必过多地攻击Vim(Plus Tmux对于许多其他用途非常方便)。

I hope doing things this way around is appealing enough for you!

我希望以这种方式做事对你来说足够吸引人!

#2


0  

Having a terminal inside of vim would go against the author's philosophy and design so no: that feature will probably never appear nativelyly in vim.

在vim中设置一个终端会违背作者的理念和设计,所以不会:该功能可能永远不会出现在vim中。

There are a couple of plugins that more or less work like conqueterm, try them if you really want that feature. Or simply use a separate terminal window like everybody.

有几个插件或多或少像conqueterm一样工作,如果你真的想要这个功能,请尝试它们。或者像每个人一样使用单独的终端窗口。

#3


0  

You should definitely look at programs like tmux or screen.

你应该看看像tmux或屏幕这样的程序。

But an even simpler solution is to use C-z (which halt vim) to access the terminal and fg to bring back vim into the foreground.

但更简单的解决方案是使用C-z(停止vim)访问终端和fg将vim带回前台。