Shell Integration Point to BBEdit File Line

34 views
Skip to first unread message

BeeRich33

unread,
Jan 31, 2023, 8:32:05 AM1/31/23
to BBEdit Talk
Is there a way to get shell integration to point to a specific line in a BBEdit file?

I want to use iTerm2 to display links to files that can be opened in BBEdit (.md files), but I want that click navigation to also go to the line.  

Can this be done?

Cheers

Neil Faiman

unread,
Jan 31, 2023, 8:55:39 AM1/31/23
to BBEdit Talk Mailing List
From the BBEdit command line tool man page:

       +<line number>, filename:<line number>
            Go to line number. For example, to select line 33:

                    bbedit +33 filename
                    bbedit filename:33

            You may also use a character offset specification:

                    bbedit +33:10 filename
                    bbedit filename:33:10

            This will place the insertion point at character offset 10 on line
            33 in the above example.

            When piping data into bbedit, you can also add a line number
            specifier, and BBEdit will place the insertion point at the
            beginning of the indicated line, e.g.

                    ls -la | bbedit +5

            will select the fifth line of text in the text document. (Using
            --append or --prepend is allowed, but works at cross purposes: the
            indicated line in the document will be selected, irrespective of
            whether it's in the piped data or not.)

            Character offset specifications are allowed here as well:

                    ls -la | bbedit +5:60

Regards,
Neil Faiman

BeeRich33

unread,
Jan 31, 2023, 9:29:00 AM1/31/23
to BBEdit Talk
OK, but there's no shell integration using that.  Shell integration is a specific text sensitive clickable application inside a terminal program.  Here is what it does:


I thought somehow if I made some syntax in the results, I could instruct the file to open given metrics much like you provided above.  Almost like putting a bbedit link in the terminal.  

Rich Siegel

unread,
Jan 31, 2023, 11:57:39 AM1/31/23
to BBEdit Talk
On 31 Jan 2023, at 6:55, BeeRich33 wrote:

> Is there a way to get *shell integration* to point to a specific line in a
> *BBEdit* file?
>
> I want to use *iTerm2* to display links to files that can be opened in
> *BBEdit* (*.md *files), but I want that click navigation to also go to the
> line.
>
> Can this be done?

I have no idea what "shell integration" is, but page 71 of the user manual describes the `x-bbedit:` URL scheme, which provides the means to specify a file and line. Perhaps that is fit for purpose.

R.

BeeRich33

unread,
Jan 31, 2023, 2:01:16 PM1/31/23
to BBEdit Talk
Perfect.  That syntax comes up in iTerm2 as syntax I've generated, and with a Command-key, becomes a link.  Opens up perfectly in BBEdit.

Thank you.  Cheers
Reply all
Reply to author
Forward
0 new messages