Home Download Buy Blog Forum Support

Highlight current line

Highlight current line

Postby metamatik on Tue Aug 09, 2011 3:12 pm

Hello,

I would really like to be able to see the current line with a specific background color,
I find it very practical to see the line you're on, especially when your cursor is at the beginning of a deeply indented line.

Am I missing something obvious or is this currently impossible in ST2? :)

Thanks in advance.
metamatik
 
Posts: 2
Joined: Tue Aug 09, 2011 2:58 pm

Re: Highlight current line

Postby jbjornson on Tue Aug 09, 2011 3:17 pm

Add the following setting to your "File Settings - User" preferences file:
Code: Select all
"highlight_line": true
jbjornson
 
Posts: 348
Joined: Tue Oct 27, 2009 4:25 pm
Location: Zurich, Switzerland

Re: Highlight current line

Postby ehamiter on Tue Aug 09, 2011 3:23 pm

...and you can alter the color in your .tmTheme file here:

Code: Select all
<key>lineHighlight</key>
<string>#hexcolor</string>
Last edited by ehamiter on Tue Aug 09, 2011 6:39 pm, edited 1 time in total.
ehamiter
 
Posts: 67
Joined: Wed Apr 27, 2011 2:42 am

Re: Highlight current line

Postby metamatik on Tue Aug 09, 2011 3:39 pm

Thanks a lot!
metamatik
 
Posts: 2
Joined: Tue Aug 09, 2011 2:58 pm

Re: Highlight current line

Postby knrd on Sun Aug 21, 2011 8:45 pm

Not working for me.
knrd
 
Posts: 7
Joined: Sun Aug 21, 2011 8:23 pm

Re: Highlight current line

Postby kakubei on Tue Sep 27, 2011 8:17 am

Hello, this works for me, but not when viewing PHP files with the Twilight theme. The PHP code seems to have an overlay colour for the background that prevents the line highlighting from working properly. I can see the highlight in the gutter next to line numbers, but not on the main text.

If I switch to a window with plain text or even a section of the page that is in HTML and not PHP I can see the highlight.

Anyone have a clue as to what's happening and how to fix it? I was even searching for the background colour in the PHP code under the theme settings but it's not even listed.

Thanks.
kakubei
 
Posts: 58
Joined: Sun Sep 25, 2011 9:19 am

Re: Highlight current line

Postby jakobud on Wed Nov 23, 2011 6:30 pm

This is also the case for the Cobalt theme. The embedded source (PHP code) has a different background color than HTML source, so that when you view a PHP file that contains both PHP and HTML, you can easily differentiate between the two. The problem is that the embedded source background color somehow overrides (or hides) the current line highlight.

I documented this bug/request here a while back:
http://sublimetext.userecho.com/topic/7 ... alt-theme/

Is there a solution for this?
jakobud
 
Posts: 37
Joined: Wed Feb 17, 2010 6:05 pm

Re: Highlight current line

Postby C0D312 on Wed Nov 23, 2011 8:48 pm

You can easily edit the colorschemes. Just open up the .tmTheme and look for anything that has a scope of PHP. Anything that has the key "background" and the scope "PHP," just remove it.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Highlight current line

Postby netpro2k on Sat Nov 26, 2011 8:14 pm

I am having this same issue, but in all files, with he twilight theme. I am very new to sublime text (coming from vim, seeing if I can get it as close to my vim config as possible). Thought I was just doing something wrong, but sounds like this is a bug.
netpro2k
 
Posts: 3
Joined: Sat Nov 26, 2011 8:10 pm

Re: Highlight current line

Postby jakobud on Tue Nov 29, 2011 6:12 pm

@C0D312 - Thanks but I do not want to remove the background color for PHP code. It helps a lot when working with an HTML file that contains both HTML and PHP code. The specified background color for the PHP code helps to differentiate the PHP code from the HTML. Removing the background just to make the current line highlight come up is not an option for me. Would rather just see the bug fixed. Is there any other way to tweak the tmTheme to make this work?

In Cobalt.tmTheme I found the following

Code: Select all
<dict>
         <key>name</key>
         <string>Embedded Source</string>
         <key>scope</key>
         <string>text source, string.unquoted.heredoc, source source</string>
         <key>settings</key>
         <dict>
            <key>background</key>
            <string>#223545</string>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#FFFFFF</string>
         </dict>
      </dict>


I tried adding something like this:

Code: Select all
            <key>lineHighlight</key>
            <string>#FF0000</string>


To the settings section, but it didn't seem to have any effect at all. Is lineHighlight maybe not an acceptable setting to set for embedded sources?

Also I noticed this problem with other themes besides just Cobalt. Any theme that has a different background color defined for Embedded Sources, this problem occurs.
jakobud
 
Posts: 37
Joined: Wed Feb 17, 2010 6:05 pm

Next

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 19 guests