How can I tell kate to use CSS highlighting for .less files by default?
3 Answers
Settings → Configure Kate → Open/save → Modes & filetypes → Download highlighting files.
No need to go to a website to copy any files or change any settings, just go to your Kate settings and simply download the Less CSS highlighting file that is available through the GUI. Somebody made it very easy.
point your browser to https://github.com/mtorromeo/kate-syntax-files/blob/master/less.xml click on raw and "save file as" to ~/.kde/share/apps/katepart/syntax this way you will always get the last version and not the day Rob W posted the commands.
I think there is no option needed additional to that. But you only have to go to settings -> configure kate -> open/save -> modes & filetypes inside kate to edit what syntax files to be used for what filetypes. No need to edit files for that, good hidden option tough ;).
It's not recommended to use the css syntax for less because it simply not enough and it comletly breaks after comments among other stuff.
- 151
- 1
- 6
The syntax highlighting definition files are located at:
~/.kde/share/apps/katepart/syntax/
/usr/share/kde4/apps/katepart/syntax/
Editing files in the first directory requires root permissions, and the syntax highlighting file will be available to every kate user in your environment. When the directory does not exist, create it in order to place the file.
Find the <language> tag, and modify the extensions attribute, as follows:
<language name="CSS" ... extensions="*.css" ... >
<language name="CSS" ... extensions="*.css;*.less" ... >
Instead of modifying css.xml, I recommend to get the definition file for less css, so that less-syntax is also highlighted correctly. See mtorromeo / kate-syntax-files / less.xml on GitHub.
Copy-paste the following commands, then restart Kate.
mkdir -p ~/.kde/share/apps/katepart/syntax
wget https://raw.github.com/mtorromeo/kate-syntax-files/master/less.xml
- 2,283
- 2
- 24
- 23