加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-15 21:45:42 所属栏目:安全 来源:网络整理
导读:我将m vim移动到/usr/local/bin,所以如果我键入mvim file.html,则从终端开始,然后MacVim将在新窗口中打开并打开文件file.html. 但是如果我从终端打开另一个文件,那么它将打开另一个MacVim窗口. 是否可以在MacVim上将新文件作为新标签打开? 我目前将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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读