1

I understand how to associate a color scheme to a certain file type, but i often run into the case where I have a shell script that is a wrapper for an SQL script.

My question is can you select portions of text in notepad++ to be associated with a certain color scheme?

for example, say I have a script --> some_script.sh, but within it is an SQL script (ie: select * from whatever...). Can I select the upper and lower text that are bash shell commands and have them coloured as .sh theme, and then select the SQL query and have it colorized as SQL text?

1 Answers1

1

Notepad++ does not natively offer this. You can switch between the 2 languages, but not select 2 languages at the same time.

Notepad++ does however support adding your own language. So in theory, you should be able to construct your own language that combines the two together using their own highlighting.

But creating your own copy of the language in question can be hard. The stylers.model.xml file contains all config for colors, but not the dictionary behind it.

The langs.model.xml file does have all the functions, so exporting a UserStyle, then copy/paste between the 3 files will be a tedious job, but it should allow you to construct something.

Its up to you to determine if you really need this, or that you'll settle for just switching between SQL and shell scripts syntax highlighting.

EDIT: I suppose that in the same fassion, you could edit the langs.model.xml and stylers.model.xml file after making a backup and hack yourself SQL support into the script layout.

EDIT2: Just tried myself to combine php, html and sql into the php style, but it doesn't seem to make any change. So apparently its more than just editing these two files and restart notepad, and might not even be possible.

LPChip
  • 66,193