Home Download Buy Blog Forum Support

subl command not working as expected anymore

Re: subl command not working as expected anymore

Postby perryclarke on Fri May 16, 2014 2:18 am

This probably isn't for everyone but I have found a workaround for subl's flakiness:

If you use the --wait option the tool works every time.

Using this from the shell causes some oddities (luckily that isn't my use case) but you can mostly work around them by putting the command in the background (with an & at the end of the line). You'll probably have to write a fully-fledged shell script to get this working seamlessly as it's beyond the scope of an alias or symbolic link.
perryclarke
 
Posts: 2
Joined: Wed May 07, 2014 11:01 pm

Re: subl command not working as expected anymore

Postby sebdd on Wed May 21, 2014 8:57 am

Here's my temporary solution, I threw it in a timeout function and mapped it to sub instead of subl. Just add this to your rc file in Unix.

Code: Select all
function timeout {
    perl -e 'alarm shift; exec @ARGV' "$@";
}

function sub {
    timeout 1 subl $1 --wait
}
sebdd
 
Posts: 1
Joined: Wed May 21, 2014 8:53 am

Re: subl command not working as expected anymore

Postby michaelaye on Thu Jun 26, 2014 2:09 am

I have the same problem on OSX 10.9.3 with ST3.
I had ST3 open with 2 files opened. Using
subl .zshrc_backup ST3 window came up but the file was not opened. Instead one of already open files was shown.
Executing just the same cmd again opened it eventually.

For completeness: I am using zsh and have seen this behaviour both with the Oh-my-zsh and prezto frameworks for setting up zsh.
michaelaye
 
Posts: 11
Joined: Tue Dec 13, 2011 5:28 pm

Re: subl command not working as expected anymore

Postby felixrabe on Fri Jun 27, 2014 12:50 pm

I've written a small Bash script that wraps subl reliably for me: https://gist.github.com/felixrabe/4a2673da8e203af824e6

Code: Select all
#!/usr/bin/env bash

if [[ $# -eq 0 ]] ; then
  subl -w . &
else
  subl -w "$@" &
fi

sleep 0.5
kill $!
felixrabe
 
Posts: 12
Joined: Tue Oct 16, 2012 10:26 am

Previous

Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot] and 11 guests