使用 TMUX 时无法在 Sublime 中打开文件夹

I can't open folders in Sublime when I'm using TMUX

OS: Yosemite iterm2, zsh

当我在我的终端上运行 "subl ."时,我可以打开文件夹,但是如果我运行 tmux 和"subl project-folder" 文件夹打不开。

➜  ~  whereis subl
/usr/bin/subl

➜  ~  which subl
/usr/local/bin/subl

➜  ~  subl -v
Sublime Text Build 3083

➜  ~  cat .bashrc
export PATH=~/bin:/Users/olleh/bin:/Users/olleh/bin:/Users/olleh/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

➜  ~  cat .bash_profile
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH=/usr/local/node/bin:$PATH
export MANPATH=/usr/local/node/share/man:$MANPATH

➜  ~  ls -l /usr/local/bin/subl
lrwxr-xr-x  1 root  staff  62 Jul 13 09:51 /usr/local/bin/subl -> /Applications/Sublime Text.app/Contents/SharedSupport/bin/subl

tmux.conf

# Use vim keybindings in copy mode
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on


# Setup 'v' to begin selection as in Vim

# Update default binding of `Enter` to also use copy-pipe

.zshrc

PATH=$PATH:/usr/local/bin/; export PATH

好的,我明白了。这是因为 Tmux 没有文件系统的 root 权限。

但是您可以授予对 Tmux 的访问权限,https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard

步骤如下。

  1. 安装这个包。brew install reattach-to-user-namespace

  2. 将此添加到 ~/.tmux.conf set-option -g default-command "reattach-to-user-namespace -l zsh"(根据您的 shell 更改 zsh)

希望对您有所帮助。