<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Syntax highlight entire line - or to end of line]]></title><description><![CDATA[<p dir="auto">Is there a way to have syntax highlighting color an entire line (i.e. the width of the notepad++ window).  Scite and some other scintilla derived apps have the “eolfilled” option on syntax lexers but I can’t seem to find anything like it on notepad++</p>
<p dir="auto">Please help - thank you</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/11913/syntax-highlight-entire-line-or-to-end-of-line</link><generator>RSS for Node</generator><lastBuildDate>Tue, 09 Jun 2026 23:56:54 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/11913.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 04 Jun 2016 21:24:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Syntax highlight entire line - or to end of line on Tue, 07 Jun 2016 01:34:25 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">how can I switch back to this custom highlighter</p>
</blockquote>
<p dir="auto">The easiest way is probably just to switch to a file and switch back. The only other way I could think of is possibly tie it to a shortcut key.</p>
<blockquote>
<p dir="auto">to do code-folding using BRACES or something?</p>
</blockquote>
<p dir="auto">It technically should be possible since the plugin simply wraps all the API calls for Scintilla, however I’ve never actually messed with code folding at all so I’m not sure what all it would take to do it properly…so most likely I will pass on this.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/16267</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/16267</guid><dc:creator><![CDATA[dail]]></dc:creator><pubDate>Tue, 07 Jun 2016 01:34:25 GMT</pubDate></item><item><title><![CDATA[Reply to Syntax highlight entire line - or to end of line on Tue, 07 Jun 2016 00:54:07 GMT]]></title><description><![CDATA[<p dir="auto">I downloaded the latest plugin and used the new code and things are working great.</p>
<p dir="auto">And thanks for the explanation on how to customize the syntax - 30 different types are plenty and I’ll be able to take it from here.</p>
<p dir="auto">I do have a couple questions:</p>
<ol>
<li>After opening a document of the correct type ( i.e. “.notes” ) if I switch syntax highlighters to something else, how can I switch back to this custom highlighter - I couldn’t see a way?</li>
</ol>
<p dir="auto">quote:<br />
I’ve never tried it but the folding can probably be done with Lua as well.</p>
<p dir="auto">I’ll see what I can come up with.</p>
<ol start="2">
<li>Have you been able to brainstorm to figure out a way to do code-folding using BRACES or something?  Currently the coloring works fine even if I use the braces (thanks to the update you sent) but it does not recognize it as a “code fold”.</li>
</ol>
<p dir="auto">Now I’m not is a great hurry and I certainly don’t want to pressure you because it turns out that you’ve ended up writing a partial custom lexer for me - which is more than I expected.  I won’t be able to do much more with this until tomorrow evening or Wed. so I may not respond until then if there are any updates.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/16266</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/16266</guid><dc:creator><![CDATA[Miller James]]></dc:creator><pubDate>Tue, 07 Jun 2016 00:54:07 GMT</pubDate></item><item><title><![CDATA[Reply to Syntax highlight entire line - or to end of line on Mon, 06 Jun 2016 01:22:23 GMT]]></title><description><![CDATA[<p dir="auto">You’ll have to re-download the DLL <a href="https://dl.dropboxusercontent.com/u/13788271/LuaScript.dll" rel="nofollow ugc">here</a> since I tracked down a bug in the plugin. Follow the above steps again and replace the code with this…</p>
<pre><code>styles = {
	-- pattern, foreground, background, bold
	-- colors are BGR hex
	{"^[%s{}]*()///",  0x000000, 0xffffff, true},
	{"^[%s{}]*()//",   0xffffff, 0x00ff00, false},
	{"^[%s{}]*()'",    0xffffff, 0x0000ff, false},
	-- add to this list as needed
}
default = {0xffffff, 0x000000, false}

npp.AddEventHandler("OnSwitchFile", function(filename, bufferid)
	-- Always try to remove it just to be safe
	npp.RemoveEventHandler("OnStyle", StyleNotes)

	if npp:GetExtPart() == ".notes" then
		npp.AddEventHandler("OnStyle", StyleNotes)
		editor.Lexer = SCLEX_CONTAINER
		editor.StyleFore[STYLE_DEFAULT] = default[1]
		editor.StyleBack[STYLE_DEFAULT] = default[2]
		editor.StyleBold[STYLE_DEFAULT] = default[3]
		for i,v in ipairs(styles) do
			editor.StyleFore[i] = v[2]
			editor.StyleBack[i] = v[3]
			editor.StyleBold[i] = v[4]
			editor.StyleEOLFilled[i] = true
		end
		editor:ClearDocumentStyle()
		editor:Colourise(0, -1)
		editor.CaretLineVisible = false -- Just remove it for now
	else
		editor.CaretLineVisible = true -- Restore it
	end
end)

-- Line oriented lexer
function StyleNotes(styler)
	local lineStart = editor:LineFromPosition(styler.startPos)
	local lineEnd = editor:LineFromPosition(styler.startPos + styler.lengthDoc)
	editor:StartStyling(styler.startPos, 31)
	for line=lineStart,lineEnd,1 do
		local lengthLine = editor:PositionFromLine(line+1) - editor:PositionFromLine(line)
		if lengthLine == 0 then break end
		local lineText = editor:GetLine(line)
		local styleToUse = STYLE_DEFAULT
		for i,v in ipairs(styles) do
			local m = lineText:match(v[1])
			if m ~= nil then
				if m &gt; 1 then 
					editor:SetStyling(m - 1, STYLE_DEFAULT)
					lengthLine = lengthLine - m + 1
				end
				styleToUse = i
				break
			end
		end
		editor:SetStyling(lengthLine, styleToUse)
	end
end

</code></pre>
<p dir="auto"><img src="https://camo.nodebb.org/374bcb769810b105abf16f4d4fde7296381842e6?url=http%3A%2F%2Fi.imgur.com%2FHZgphVU.png" alt="" class=" img-fluid img-markdown" /></p>
<p dir="auto">Again you’ll have to change the file extension you want to use, and you can easily change the colors. The styles toward the top can be added to as needed. Like I said you can add about 30 of them before you run into issues.</p>
<p dir="auto">You can change what triggers the style. They use <a href="https://www.lua.org/manual/5.3/manual.html#6.4.1" rel="nofollow ugc">Lua patterns</a> which are much like regular expressions. For example the first pattern is</p>
<pre><code>^[%s{}]*()///
</code></pre>
<p dir="auto">This means</p>
<ol>
<li><code>^</code> - Start at the beginning of the line</li>
<li><code>%s</code> - Any whitespace</li>
<li><code>[]</code> - Creates a group of characters (in this case any whitespace and braces)</li>
<li><code>*</code> - Allow 0 or more of the characters in the group</li>
<li><code>///</code> - The actual text</li>
</ol>
<p dir="auto">From this you can probably piece together other stuff you want to match</p>
]]></description><link>https://community.notepad-plus-plus.org/post/16247</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/16247</guid><dc:creator><![CDATA[dail]]></dc:creator><pubDate>Mon, 06 Jun 2016 01:22:23 GMT</pubDate></item><item><title><![CDATA[Reply to Syntax highlight entire line - or to end of line on Sun, 05 Jun 2016 22:14:10 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">So any whitespace before the symbol would not be highlighted.</p>
</blockquote>
<p dir="auto">Yep very doable.</p>
<blockquote>
<p dir="auto">I would like to be able to indent these as needed</p>
</blockquote>
<p dir="auto">Also doable.</p>
<blockquote>
<p dir="auto">am I able to add as many of these highlighting rules as I want</p>
</blockquote>
<p dir="auto">This should be able to handle about 30 of them. Any more than that then extra logic would have to be added to handle ~200.</p>
<blockquote>
<p dir="auto">and to define the characters / characterSets that trigger them?</p>
</blockquote>
<p dir="auto">Yep.</p>
<blockquote>
<p dir="auto">And can this be used concurrently with another highlighting lexer?</p>
</blockquote>
<p dir="auto">No that’s not possible.</p>
<blockquote>
<p dir="auto">in order to be able to collapse / fold the sections as needed.</p>
</blockquote>
<p dir="auto">I’ve never tried it but the folding can probably be done with Lua as well.</p>
<p dir="auto">I’ll see what I can come up with.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/16246</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/16246</guid><dc:creator><![CDATA[dail]]></dc:creator><pubDate>Sun, 05 Jun 2016 22:14:10 GMT</pubDate></item><item><title><![CDATA[Reply to Syntax highlight entire line - or to end of line on Sun, 05 Jun 2016 21:21:54 GMT]]></title><description><![CDATA[<p dir="auto">Thank you - this is great.  Could you help me to change a couple of things?</p>
<ol>
<li>I would like the highlighting to start at the location of the syntax trigger - (i.e. // or ///, etc.) So any whitespace before the symbol would not be highlighted.</li>
<li>I would like to be able to indent these as needed (related to request #1) so the syntax rule would be something like “Highlight if symbol begins a line or if there are only BRACES or whitespace preceding it (spaces, tabs)” - like this:</li>
</ol>
<p dir="auto"><img src="https://camo.nodebb.org/10a6d353f8a9d174e558b71066475805d7bb8d62?url=http%3A%2F%2Fi.imgur.com%2Ffb9rFNv.gif" alt="" class=" img-fluid img-markdown" /></p>
<p dir="auto">And then, am I able to add as many of these highlighting rules as I want and to define the characters / characterSets that trigger them?  Currently, I am using these because they happen to be the comment symbols used by c++ but I would like to change/add a few.</p>
<p dir="auto">And can this be used concurrently with another highlighting lexer? It doesn’t seem to work but I thought I’d ask.  One of the reasons is that I’d like to be able to use BRACES { } or something in order to be able to collapse / fold the sections as needed.</p>
<p dir="auto">Thank you again for the time you’ve spent on this.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/16245</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/16245</guid><dc:creator><![CDATA[Miller James]]></dc:creator><pubDate>Sun, 05 Jun 2016 21:21:54 GMT</pubDate></item><item><title><![CDATA[Reply to Syntax highlight entire line - or to end of line on Sun, 05 Jun 2016 13:42:58 GMT]]></title><description><![CDATA[<p dir="auto">I didn’t have much to go on but this is what I put together real quick. Depending on what the line starts with, it will color the line. This expects exact indentation but if you provide a bit more info it wouldn’t be hard to change it.</p>
<p dir="auto">It’s not perfect but with more time it can probably be tweaked. You can easily add new strings to style the line differently or change the colors. This is what it currently looks like</p>
<p dir="auto"><img src="https://camo.nodebb.org/8edfb94cc6eb7603e2862ad7c95652e4b52db808?url=http%3A%2F%2Fi.imgur.com%2FIUJ7KhI.png" alt="" class=" img-fluid img-markdown" /></p>
<p dir="auto">To use this…</p>
<ol>
<li>Download the latest <a href="https://dl.dropboxusercontent.com/u/13788271/LuaScript.dll" rel="nofollow ugc">LuaScript plugin</a></li>
<li>Copy it to your plugins directory</li>
<li>Start N++</li>
<li>Select <code>Plugins &gt; LuaScript &gt; Edit Startup Script</code></li>
<li>Paste the code (see below)</li>
<li>You’ll probably have to change line #12. I have it based on file extension currently.</li>
<li>You can change the colors too</li>
<li>Save/Restart N++</li>
<li>Open up one of your files</li>
</ol>
<p dir="auto">And the code…</p>
<pre><code>styles = {
	-- string, foreground, background, bold
	-- colors are BGR hex
	{"///",  0x000000, 0xffffff, true},
	{"  //", 0xffffff, 0x00ff00, false},
	{"  '",  0xffffff, 0x0000ff, false},
	-- add to this list as needed
}
default = {0xffffff, 0x000000, false}

npp.AddEventHandler("OnSwitchFile", function(filename, bufferid)
	if npp:GetExtPart() == ".notes" then -- This is currently based on file extention
		npp.AddEventHandler("OnStyle", StyleNotes)
		editor.Lexer = SCLEX_CONTAINER
		editor.StyleFore[STYLE_DEFAULT] = default[1]
		editor.StyleBack[STYLE_DEFAULT] = default[2]
		editor.StyleBold[STYLE_DEFAULT] = default[3]
		for i,v in ipairs(styles) do
			editor.StyleFore[i] = v[2]
			editor.StyleBack[i] = v[3]
			editor.StyleBold[i] = v[4]
			editor.StyleEOLFilled[i] = true
		end
		editor:ClearDocumentStyle()
		editor:Colourise(0, -1)
		editor.CaretLineVisible = false -- Just remove it for now
	else
		npp.RemoveEventHandler("OnStyle", StyleNotes)
		editor.CaretLineVisible = true -- Restore it
	end
end)

-- Line oriented lexer
function StyleNotes(styler)
	local function sstarts(String,Start)return string.sub(String,1,string.len(Start))==Start end
	local lineStart = editor:LineFromPosition(styler.startPos)
	local lineEnd = editor:LineFromPosition(styler.startPos + styler.lengthDoc)
	editor:StartStyling(styler.startPos, 31)
	for line=lineStart,lineEnd,1 do
		local lengthLine = editor:PositionFromLine(line+1) - editor:PositionFromLine(line)
		if lengthLine == 0 then break end
		local lineText = editor:GetLine(line)
		local styleToUse = STYLE_DEFAULT
		for i,v in ipairs(styles) do
			if sstarts(lineText, v[1]) then
				styleToUse = i
				break
			end
		end
		editor:SetStyling(lengthLine, styleToUse)
	end
end
</code></pre>
<blockquote>
<p dir="auto">how did you post the in-line images here?</p>
</blockquote>
<p dir="auto">You’d type this…</p>
<pre><code>![](http://i.imgur.com/fCq96tW.gif)
</code></pre>
<p dir="auto">In your post and it shows up.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/16237</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/16237</guid><dc:creator><![CDATA[dail]]></dc:creator><pubDate>Sun, 05 Jun 2016 13:42:58 GMT</pubDate></item><item><title><![CDATA[Reply to Syntax highlight entire line - or to end of line on Sun, 05 Jun 2016 02:35:52 GMT]]></title><description><![CDATA[<p dir="auto">I am not familiar with either python or lua but if I have a template to work with, I can probably work my way around.</p>
<p dir="auto">Here’s an example of what I’m currently working with using programmers notepad - (hasn’t been developed in years)<br />
<a href="http://i.imgur.com/fCq96tW.gif" rel="nofollow ugc">http://i.imgur.com/fCq96tW.gif</a><br />
but I’m limited to just a few line styles because I am using c++ syntax lexer.</p>
<p dir="auto">So, I would love to work on this - go ahead and let me know where to begin - or I can wait until you have the lua plugin ready.</p>
<p dir="auto">Thanks again - it is appreciated.<br />
p.s. how did you post the in-line images here?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/16233</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/16233</guid><dc:creator><![CDATA[Miller James]]></dc:creator><pubDate>Sun, 05 Jun 2016 02:35:52 GMT</pubDate></item><item><title><![CDATA[Reply to Syntax highlight entire line - or to end of line on Sun, 05 Jun 2016 00:14:58 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">I’d like to do it on the C++ lexer</p>
</blockquote>
<p dir="auto">That is possible. There are plugins that can help out. PythonScript is one option if you are familiar with it. Another one is <a href="https://github.com/dail8859/LuaScript" rel="nofollow ugc">LuaScript</a> that I created. Using LuaScript you could set all C++ line comments to extend the background color to the end of the line by doing</p>
<pre><code>npp.AddEventHandler("OnSwitchFile", function(filename, bufferid)
	if npp.BufferLangType[bufferid] == L_CPP then
		editor.StyleEOLFilled[SCE_C_COMMENTLINE] = true
	end
end)
</code></pre>
<p dir="auto">Obviously that can be changed as needed, but that’s the gist of it.</p>
<blockquote>
<p dir="auto">what I really want to do is make a custom lexer</p>
</blockquote>
<p dir="auto">You have a few ways of doing it. One would be to create a custom User Defined Language in Notepad++. I’ve never done it myself so it may or may not be sufficient for what you need. Another way would be to write a custom lexer in C++ or C# as a plugin…certainly non-trivial to do. Another way would be to use the LuaScript plugin again. I’ve been working on some changes to the plugin that would allow writing a custom lexer in Lua. For example it would look something like this to highlight a CSV file with alternating line row colors.</p>
<pre><code>npp.AddEventHandler("OnSwitchFile", function(filename, bufferid)
	if npp:GetExtPart() == ".csv" then
		npp.AddEventHandler("OnStyle", StyleCSV)
		editor.Lexer = SCLEX_CONTAINER
		editor.StyleBack[1] = 0xffffff
		editor.StyleBack[2] = 0xC0D9AF
		editor.StyleEOLFilled[1] = true
		editor.StyleEOLFilled[2] = true
		editor:ClearDocumentStyle()
		editor:Colourise(0, -1)
		editor.CaretLineVisible = false
	else
		npp.RemoveEventHandler("OnStyle", StyleCSV)
		editor.CaretLineVisible = true
	end
end)

-- A line oriented lexer - style the line according to the line number
function StyleCSV(styler)
	local lineStart = editor:LineFromPosition(styler.startPos)
	local lineEnd = editor:LineFromPosition(styler.startPos + styler.lengthDoc)
	editor:StartStyling(styler.startPos, 31)
	for line=lineStart,lineEnd,1 do
		local lengthLine = editor:PositionFromLine(line+1) - editor:PositionFromLine(line)
		if line % 2 == 0 then
			editor:SetStyling(lengthLine, 1)
		else
			editor:SetStyling(lengthLine, 2)
		end
	end
end
</code></pre>
<p dir="auto">All this should be doable with the PythonScript plugin as well but I’m not as familiar with it. If you are interested in trying to right it in Lua I can get you a new build of the plugin to try it out.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/16229</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/16229</guid><dc:creator><![CDATA[dail]]></dc:creator><pubDate>Sun, 05 Jun 2016 00:14:58 GMT</pubDate></item><item><title><![CDATA[Reply to Syntax highlight entire line - or to end of line on Sat, 04 Jun 2016 23:30:01 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for the reply!  Initially, I’d like to do it on the C++ lexer… but what I really want to do is make a custom lexer, not so much for coding-language syntax, but for note-taking.  For example:</p>
<p dir="auto">If I could define 8 or 10 different “line comment” character(s), I could use these to have a colored-line separating different topics / sub-topics.</p>
<p dir="auto">I know this is a non-standard use, but if anyone has a way to do this it would really help me out a lot.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/16228</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/16228</guid><dc:creator><![CDATA[Miller James]]></dc:creator><pubDate>Sat, 04 Jun 2016 23:30:01 GMT</pubDate></item><item><title><![CDATA[Reply to Syntax highlight entire line - or to end of line on Sat, 04 Jun 2016 21:34:29 GMT]]></title><description><![CDATA[<p dir="auto">Notepad++ sets this option on a few of the lexers but doesn’t expose any type of option to the user. Is there a specific language/style you are wanting to set? With the right plugin you can most likely do it.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/16225</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/16225</guid><dc:creator><![CDATA[dail]]></dc:creator><pubDate>Sat, 04 Jun 2016 21:34:29 GMT</pubDate></item></channel></rss>