I want change style token individually
-
Hmm, if I am correctly understanding what you are asking for, then the answer is “no”: there is not currently a way to clear the Style#N on just one token, rather than all of Style#N. That surprises me.
Given text like
… I can see that you might want to be able to select the secondthree
and choose something like Search > Clear Style > Clear Styles (One Token) to result in only onethree
having the Style cleared, but allowing thetwo
s and the otherthree
to stay highlighted, like:
… And, to also be able to select one of the
two
s and pick something like Search > Clear Style > Clear Styles (All Occurrences of Token) , so that it can clear the Style on all instances oftwo
without having to clear the same Style on other tokens.Great idea.
If that’s a feature you would like, I would recommend reading our FAQ on making a feature request, which tells you where to go to make an official feature request. (Feel free to borrow my phrasing or images when you make the feature request.)
If you do make an official request, please come back here and paste a link, so that people who read about your idea here can see what progress, if any, there is on the official feature request. Good luck.
Or is there a similar higlight tactic I can use?
As far as a workaround: I think it might be possible to remove the style from a single token using PythonScript or other scripting plugin, but I’m forgetting right now which scintilla feature Notepad++ uses for doing the background color for the Style tokens, so I cannot remember which scintilla command I would point you to. Maybe someone else will remember. (Or maybe I’ll have time later to do more research.)
-
@PeterJones said in I want change style token individually:
but I’m forgetting right now which scintilla feature Notepad++ uses for doing the background color for the Style tokens
-
@PeterJones yes I want remove individually on as you posted different pics and it doesnt work it just removing all highlights
-
-
@gonyaliselim said in I want change style token individually:
@PeterJones said in I want change style token individually:
Clear Styles (One Token)
cant see this
You misunderstood me. I was saying “it would be nice if it gave those two new options”. You will have to put in a feature request to ask for them, because they don’t exist.
-
@PeterJones sad. thank you for information
-
It’s been discussed before, HERE.
-
-
You are right
The post here by @Ekopalypse contains almost the script you would want. I would recommend modifying it to
from Npp import editor INDICATORS = [21, 22, 23, 24, 25, 31] for i in range(editor.getSelections()): start = editor.getSelectionNStart(i) end = editor.getSelectionNEnd(i) if end-start == 0: start = editor.wordStartPosition(start, True) end = editor.wordEndPosition(start, True) for indicator in INDICATORS: editor.setIndicatorCurrent(indicator) editor.indicatorClearRange(start, end-start)
The changes I made to the script compared to the version from the old post:
- the original post’s script would only go to the end of the first word in each selection; mine will go from start to end of the selection (or of each selection, for multi-select mode)
- mine adds the feature that if you just click inside a single word (or do
ctrl+click
to do multiple zero-width selections), it will assume you want to clear the Style on the whole word that you clicked inside - mine adds the boilerplate at the top, because some people’s PythonScript
startup.py
don’t import all the used objects
To use that script, you would follow the instructions in our PythonScript FAQ to install the PythonScript plugin. Once it’s installed (and i recommend giving it a keyboard shortcut), you can select one or more words, and run the script using the menu or shortcut, and the script will remove the style indicator(s) for any of the selected text, while leaving anything else that has that style alone – effectively implementing the Clear Styles (One Token) that I suggested. This will give you what you asked for, without asking for and waiting for a new feature to be implemented in Notepad++.
update: assuming you name the script
ClearStylesOneToken.py
, and if you use PythonScript Configuration to move it into the main PythonScript menu (like you would have done if you wanted a keyboard shortcut), then you could use<Item FolderName="Clear style" PluginEntryName="Python Script" PluginCommandItemName="ClearStylesOneToken" ItemNameAs="Clear Styles (One Token)" />
in yourcontextMenu.xml
(using Settings > Edit Popup ContextMenu) in order to put it into your right-click context menu; if you put it right after the otherFolderName="Clear style"
entries in that XML, it will show up in the same submenu as the other Clear styles actions – but only in the context menu, not in the Search menu. To get it to show up, you will have to savecontextMenu.xml
and exit/restart Notepad++But, as I said in my first reply, you really should put in the feature request, because it’s something that should be native in Notepad++. But if no one asks, it will never be implemented.
-
YOU ARE KING ! 👑
This Video link
streamable com/eq1pswother question. If i add highlights when someone open that txt on his computer would can he see my highlights as it ?
-
@gonyaliselim said in I want change style token individually:
If i add highlights when someone open that txt on his computer would can he see my highlights as it
Sorry, no. Text files have no way to store things like highlighting – they are literally saved as just the text characters in the file. Notepad++ is not going to add any new binary commands or metadata to the file to be able to store such information (if it did, it would cease to be a text editor and instead would be a rather primitive, 80s-style word processor). [see, for reference, FAQ: Notepad++ is a Text Editor, not a Word Processor]
If you really needed to share the highlights, you could either print to PDF (if you don’t already have a print-to-PDF printer, you can search the internet to find a print-to-PDF driver that works for your needs), or you could use the Plugins > NppExport commands to export with the highlights to RTF or HTML (or put all formats into the clipboard, then paste into the Word Processor of your choice). But once you export to RTF or HTML or paste into a Word Processor, the file you are sending ceases to be a text file. We cannot decide for you whether or not that meets your needs.