settings--preference--language style setting--bash--instruction word，is the keywords has number or word limit？
settings–preference–language style setting–bash–instruction word，is the keywords has number or word limit？
when i input api、all or any other words, the bash text not highlight.
when i input api、all or any other words, the bash text not highlight
Are you working on a file which has already been saved and has an extension such as listed on the screen you refer to (bash sh bsh csh bash_profile bashrc profile). Otherwise Notepad++ has no idea that’s what your intention is.
The tab header will confirm the file name, or possibly it is just “new 1”, or “new 2” etc.
@Terry-R yeah, my file is xxxx.bash, i added some keywords, like su wget api ssh, but only su wget ssh worked, the api and others not.
like su wget api ssh, but only su wget ssh worked, the api and others not.
I don’t personally use this feature (not a programmer , yet) so I might be on the wrong track, but a quick test showed that the word you add must be of the same case as in the file. So if added “api” then “api” must be in file, not “API”.
I added several dumb words in my test and all highlighted if of same case as added.
but a quick test showed that the word you add must be of the same case as in the file.
Actually a further test seems to show only the word against the margin will highlight if amongst the user added words. That might be a feature of the “bash” coding that Notepad++ has used as a rule?
@Terry-R yes, my content like “i use ssh tools to debug some api for testing”, “ansible -vv api -m copy”, but it’s not work.
i added some keywords, like su wget api ssh, but only su wget ssh worked, the api and others not.
wgetare already keywords (INSTRUCTION WORD), so you don’t need to add them.
And when I add
api sshto the list, they immediately start highlighting:
But, as @Terry-R said,
further test seems to show only the word against the margin will highlight if amongst the user added words
It’s more nuanced than that, as shown by my screenshot:
cat apionly marks
catas a keyword because in the grammar of bash,
catis in the location of a command, but
apiis not (it’s the argument, not the instruction). But
api blahat the beginning of the line will allow
apito be recognized as an INSTRUCTION WORD, because it is grammatically where an instruction should be. Further, on my examples with
;separators, the first word after the separator can also be recognized as an INSTRUCTION WORD, too… because they are instructions.
You might try to argue that something like
should highlight the
lsas well as the
lsis also a command… but really, it’s not a command in terms of the bash script running on the local machine – it’s only a command once it’s sent all the way to the remote connection.
ansible -vv api -m copyhas
copyas arguments, not as instructions, so only the
ansibleis a potential instruction word… and since it’s not a builtin keyword nor in my list of user-defined keywords, it is not highlighted.
So, personally, I consider the bash/unix-shell syntax highlighter to be working correctly; according to the grammar that’s built into the lexer, it is highlighting the builtin or user-defined keywords when they are grammatically being used as instruction words, and only then. If you consider that a bug (I do not), this forum is not the right place to report it; in fact, the Notepad++ project is even the wrong place to report it, because the bash lexer is defined/coded in the Scintilla project which Notepad++ uses for that feature. You would have to go report that bug to Scintilla; once/if they fix it, you would then have to ask Notepad++ to upgrade to the newer Scintilla.
However, you can add extra highlighting to a builtin lexer (like the bash/unix-shell lexer) using regexes via the script
EnhanceAnyLexer.pythat @Ekopalypse shares in his github repo. Those regexes wouldn’t be limited by the bash/unix-shell grammatical constraints, so if you defined a regex like
\b(api|ssh|ansible)\b, it would highlight those words under the scripts color definitions whenever they were found, not just in grammatically instruction-word locations.