Home Download Buy Blog Forum Support

Highlight bookmarked lines

Highlight bookmarked lines

Postby nefD on Mon Jun 25, 2012 5:57 pm

First of all, I absolutely adore Sublimetext2, and aside from Visual Studio (for C# ONLY), its pretty much the only edit I will use. One of my favorite features it the Bookmarking; I use it constantly. One thing I would like to be able to do, however, is highlight the background of lines which contain bookmarks. Much like the way the current caret line is highlighted (another feature I love), but using a color specifically for bookmarked lines. It would be great if these showed up in the minimap as well, but even if they didn't, this would still be great.

Now, why did I post this in Plugin Development rather than Ideas & Suggestions? Well, mainly because, as I am a developer, I don't mind putting in the work and making a plugin which does this myself (to be contributed back to the community, of course), but work and family demands mean I don't have time to chase down a rabbit hole only to find out that I would not be able to accomplish this via the plugin API. So how about it? Is this something that I could mod in, or is this something that would have to be implemented at the source level?
nefD
 
Posts: 2
Joined: Mon Jun 25, 2012 5:51 pm

Re: Highlight bookmarked lines

Postby FichteFoll on Sun Jul 01, 2012 12:44 pm

You could add a region to the edit and let this region have an outline, like SublimeLinter.
FichteFoll
 
Posts: 400
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany

Re: Highlight bookmarked lines

Postby adzenith on Thu Jul 05, 2012 5:49 pm

I don't think there's a callback for bookmarking, so you'd either have to poll the view to see if the bookmarks have changed or wrap the bookmark commands. I'd recommend the latter method.
What I'd actually recommend, though, is this plugin:
https://github.com/colinta/SublimeMarkAndMove
It does its own bookmarking and adds some cool features on top. As a bonus, it also draws an outline around your bookmarks. I just changed all the bookmarking shortcuts to use Mark and Move instead of Sublime Text's default bookmarks.
Changing the background color of an entire line (à la caret line highlighting) is unfortunately impossible with Sublime Text 2's API; you can only change the background color of characters themselves, and then only to colors that are in the current color scheme.
adzenith
 
Posts: 1216
Joined: Mon Oct 19, 2009 9:12 pm

Re: Highlight bookmarked lines

Postby agibsonsw on Fri Jul 06, 2012 5:52 pm

Changing the background color of an entire line (à la caret line highlighting) is unfortunately impossible with Sublime Text 2's API


Sections of my code have a different background colour (or effect) across the full width of the view. This appears for css and php blocks within HTML files. How is this created, or is it in-built to ST?
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Highlight bookmarked lines

Postby adzenith on Fri Jul 06, 2012 7:28 pm

It's built into your language grammar. If you want to modify the background color on the fly, you'd have to dynamically generate a language grammar to specifically target the section of code you're interested in. It can be done—I think there's a CSS color plugin that does it—but it's a *huge* hassle.
adzenith
 
Posts: 1216
Joined: Mon Oct 19, 2009 9:12 pm

Re: Highlight bookmarked lines

Postby agibsonsw on Fri Jul 06, 2012 7:56 pm

adzenith wrote:It's built into your language grammar. If you want to modify the background color on the fly, you'd have to dynamically generate a language grammar to specifically target the section of code you're interested in. It can be done—I think there's a CSS color plugin that does it—but it's a *huge* hassle.


Thank you. If it was straight-forward I was actually thinking of deleting it ;) although the ability to at least change the background colour would have been interesting.

I'll leave it - it's hardly noticeable (against my chosen background colour). Ta, Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Highlight bookmarked lines

Postby FichteFoll on Fri Jul 06, 2012 8:05 pm

It's somewhere in the Color Scheme you use. Mine looks like this:

Code: Select all
      <dict>
         <key>name</key>
         <string>♦ Embedded Source &amp; Code in Markup</string>
         <key>scope</key>
         <string>text source, markup.raw</string>
         <key>settings</key>
         <dict>
            <key>background</key>
            <string>#B0B3BA14</string>
         </dict>
      </dict>


Note the "text source" which defines the selector and the "background" stuff (if you're not used to tmThemes).
FichteFoll
 
Posts: 400
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany

Re: Highlight bookmarked lines

Postby agibsonsw on Fri Jul 06, 2012 8:21 pm

Thank you @FichteFoll

I'd searched for this in my theme before but missed it because of the rgba setting:

Code: Select all
<dict>
         <key>name</key>
         <string>♦ Embedded Source (Bright)</string>
         <key>scope</key>
         <string>text source</string>
         <key>settings</key>
         <dict>
            <key>background</key>
            <string>#B1B3BA08</string>
         </dict>
      </dict>

I might change it slightly now 8-)
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: Highlight bookmarked lines

Postby nefD on Mon Jul 09, 2012 2:14 pm

Thanks for the replies everyone! A shame this can't be done (at least, not cleanly/easily), but perhaps someday.
nefD
 
Posts: 2
Joined: Mon Jun 25, 2012 5:51 pm

Re: Highlight bookmarked lines

Postby stonefury13 on Sun Sep 22, 2013 2:14 am

Anyone know of anything new out there for Sublime3 that makes bookmarks more noticeable, or anything package?

thanks
stonefury13
 
Posts: 2
Joined: Mon Sep 16, 2013 6:42 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 2 guests