I have a problem with custom syntax highlighting in Notepad++.
I want to display text in parentheses in a different color. In View → User Define Dialogue I've defined a custom language and set up corresponding delimiters, "(" and ")".
However, the problem is that Notepad++ is highlighting the text between parentheses only when there is a space before the left parenthesis. So for example, in ^reg(ular)?$ (ular) is not highlighted, but in ^reg (ular)$ it is.
Is there a way to force Notepad++ to recognize delimiters without the space before parentheses?
If you add open parenthesis, "(", to the list of activated operators in the User Define [sic] Language, then the content will be highlighted between the opening and closing parentheses (which you set as the delimiters).
add ( and ) in Operators 1 es better, then if you select ) in the source, the ( is hightlighted
Related
Very close to reverse of this question. I prefer coding with 2-whitespace indentation, but need to have files indented with tabs to align with project convention. What I would like to do is preferably automatically convert 2 spaces upon entry to tab symbol in Notepad++ and have the editor configured to tab length of 2.
A possible manual way for doing this could be Edit->Blank Operations->Space to TAB but this converts all of my spaces to tabs, even those of length 1 - which are, for example, spaces between function arguments, not just leading spaces.
In a perfect case scenario I'm trying to achieve formatting style as described in this question, but with typing just spaces and the editor taking care of the rest.
I'm on Notepad++ 6.0, but willing to upgrade if this helps
Let me complete the answer of Ari Okkonen to add a workaround to the problem commented by Sergii Zaskaleta of mixed tabs and spaces at the beginning of the line.
Settings->Preferences->Tab Settings->Tab size: 2 (if not already)
Edit->Blank Operations->Space to TAB (Leading)
Select a block of lines of text with the problem of mixed spaces and tabs. Press [Tab] and [Shift]+[Tab] to add and remove a tab from each line. In the process, the leading spaces had been converted to tabs.
A manual way that seems to work: After having edited the file before saving you may try (Works in Notepad++ v6.8.3):
Settings->Preferences->Tab Settings->Tab size: 2 (if not already)
Edit->Blank Operations->Space to TAB (Leading)
I am trying to use a double underscore "__" as word separator in Sublime Text 3. That means, I want the following to be selected by a double click (selection indicated by brackets):
(bar_foo)
(hello)__(world)
Is that possible? My first guess is "no", because nothing is specified in Preferences.sublime-settings, but maybe one of you guys knows a way to make this work?
Thanks in advance!
PS: I already had a look at some questions here at SO (e.g. Removed hyphen from word_separators, ctrl+d no longer makes sense and Sublime Text and Hypens vs Underscores), but they don't answer this specific question.
Edit: In case you're wondering, I want this because I want to select variables like bar_foo_counter but I also want to use double underscores for my CSS modifier classes, like bar__inner.
When I wirte the following example code (in VBscript) in Notepad++
dim X
X = Array( "string1", _
"string2", _
"string3" )
Wscript.Echo X(1)
it looks as follows:
As you can see, the three blank lines are inside the code block which one can collapse and uncollapse, which is an annoying behavior. I'd rather have these three lines outside the array group like here, but without REM:
Is there a setting of Notepad++ I am missing to get the desired behaviour?
You can utilized custom language defined settings to make custom fold begin and end objects. This will allow you to insert start and end paramaters within your code so folding done by your configuration.
Here, the language is set to VB and includes the blank spaced lines.
Click on the User Defined Languages Icon(sorry for bad drawing....).
Here, i've saved the user language as Custvbs and applied '{ and '} as my start/end blocks for folding. There is an additional field for secondary folding labelled Folding in code 2 style (seperators needed)
And here is the resulting custom fold:
How about removing the surplus blank lines. You can do this by selecting TextFX -> TextFX Edit -> Delete Surplus Blank Lines
I can use VIM to input these color control chars by "Ctrl-V, Esc" then it will show me ^[ as a special leading char for color control chars sequence.
How could I do this in Textmate?
Thanks
You can select those from the character viewer (Menu Edit -> Special Characters, then search for 'escape'), but I think you'd be better off using an escaped form of that character, e.g. \033 in Bash or \x1b in PHP. That, of course, would depend on what kind of document you're editing.
I have a specific language (its private, and closed source) that I'm writing code highlighting for in Notepad++. I've never done anything like this before... so, for the most part, I'm clueless.
There are a bunch of keywords, and I've figured out how to implement those, but the strings are denoted by square brackets ([ and ]) instead of normal quotes. How do I register those as strings in the XML file?
Another thing, the language relies heavily on recursion and nesting; is there some way to say "Level 1 of the square brackets is this color, level 2 is this color, etc..."?
There's a useful help page that explains how to use the GUI to define a custom language for Notepad++. As Alex K noted in a comment above, the option for setting string delimiters appears to be in the Delimiters boxes in the Operators tab. It doesn't look like it supports different colours for different levels of nesting, though.
Update for those who have been asking the same question:
(Temporary) Documentation for custom syntax highlighting is on: http://udl20.weebly.com/index.html
There is a link to this in Notepad++ but it doesn't stand out.
I had log4net files that I wanted to view in Notepad++. They contained lines like:
2015-06-03 16:38:10,751 [Compname][Thread:29][FATAL]
To highlight [FATAL] just the keyword list wasn't enough. I added this:
On tabpage "Folder & Default" > Folding in code style 1: >
Open: [
Close: ]
On tabpage "Keyword lists" > 1ste group > FATAL with some styling.