Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

subl --wait doesn't work within tmux

Setting and using Sublime Text 2 as the git editor does not wait correctly within a tmux session.

$ tmux
$ export EDITOR="subl -w" 
$ git rebase HEAD^ -i (close file, terminal hangs)

If the EDITOR is set without the wait, then the file is opened in ST2 as before, but then of course the rebase then gets applied immediately within the shell.

like image 219
quinn Avatar asked Dec 17 '12 15:12

quinn


1 Answers

I do not use Sublime Text, but I have read a question on Super User that seems to be about this same problem.

The solution involves using the “wrapper” program that I made to allow pasteboard access inside tmux. The “fix” is not specific to pasteboard access, so the program also turns out to alleviate problems in several other areas that are not related to cut/copy/paste operations. The method that Sublime Text uses to implement the “wait” feature of subl -w invocations seems to be one of these “other areas”.

You can get the wrapper through MacPorts from their tmux-pasteboard port, or through Homebrew from their reattach-to-user-namespace formula, or compile it yourself from my tmux-MacOSX-pasteboard repository at GitHub.

Once you have it installed, you may want to configure (per the README) a default-command in your .tmux.conf so that shells spawned inside tmux will automatically be “reattached”. Alternatively, you could use the wrapper in your EDITOR value:

EDITOR='reattach-to-user-namespace subl -w'
like image 115
Chris Johnsen Avatar answered Oct 20 '22 05:10

Chris Johnsen