微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在终端上打开新文件到选项卡而不是MacVim上的新窗口?

我将m vim移动到/usr/local/bin,所以如果我键入mvim file.html,则从终端开始,然后MacVim将在新窗口中打开并打开文件file.html.

但是如果我从终端打开另一个文件,那么它将打开另一个MacVim窗口.

是否可以在MacVim上将新文件作为新标签打开?

我目前将MacVim设置为

Open files from application: in the current window
    with a tab for each file

但是,只有当我从MacVim打开文件(不从终端运行mvim)时,才会在新选项卡中打开新文件.

解决方法

This hack应该可以工作,但每次更新MacVim时维护都可能会令人沮丧.它要求您编辑mvim脚本.这似乎是一个长期存在的问题.

mvim `which mvim`

## Add the following line to the top of the file,below the commented section:

tabs=true

## Replace the `if` structure at the bottom of the file with the following:

# Last step:  fire up vim.
if [ "$gui" ]; then
  if $tabs && [[ `$binary --serverlist` = "VIM" ]]; then
    exec "$binary" -g $opts --remote-tab-silent ${1:+"$@"}
  else
    exec "$binary" -g $opts ${1:+"$@"}
  fi
else
  exec "$binary" $opts ${1:+"$@"}
fi

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐