Sublime Forum

CLI: set :lin for different files

#1

Hello,

Ich habe a bash script, that open sublime in the following manner:

subl $DIR $file1 $file2 $file3:10000 $file4:100000 $file5 $file6:1000000

The Problem is now, that it only scrolls to the end of the $file6.
So :line only seems to work for the last file.

Is this intended or a bug?

Anyways, maybe someone has an idea for a workaround.

0 Likes

#2

just execute subl multiple times, once for each file (or combine files with no line info into one call)

subl $file1 $file2 $file5
subl $file3:10000
subl $file4:5210
subl $file6:1297
0 Likes

#3

Okay, this works:

            for i in "${OpenFiles[@]}"; do # open single files
                echo "$i"
                subl "$i"
                sleep 0.07
            done

But the sleep is quite long.
If I remove the sleep completely, only the last file is opened with the correct line.

Is there some way, how I can dynamically determine how long the wait has to be?
Either in Bash or with subl?

Because sometimes it works and sometimes (if sublime takes too long to open the previous filei guess), it does only work for the last file i opened.

0 Likes