Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I tell kate to use CSS highlighting for .less files by default?

share|improve this question
add comment

3 Answers 3

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.

share|improve this answer
add comment
up vote 1 down vote accepted

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.

share|improve this answer
add comment

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
share|improve this answer
    
thanks, i got it already, forgot about this. Actaully you dont need to edit files at all. –  wayne Jun 16 '12 at 10:38
    
@wayne You only have to edit files if you want to use existing syntax files for new extensions. But if you use less.xml, then there's indeed no need to edit the file. –  Rob W Jun 16 '12 at 10:39
    
Hmm? Actually you are wrong you can just type the extensions in there (the options i pointed to in my answer) with a semicolons between them. –  wayne Jun 17 '12 at 14:34
    
@wayne The fact that it can also be done through the GUI does not invalidate my answer. As for the dates: My answer contained the link to the latest version of the file, the displayed command was an illustration of how to apply the files. –  Rob W Jun 17 '12 at 14:47
    
"You only have to edit files if you want to use existing syntax files for new extensions. But if you use less.xml, then there's indeed no need to edit the file." That IS wrong! I bet you did not know about the option and the fact that you do not "have to" edit the files at all is right! End if story!I never said it is invalid to say it can also be edited in the files itself. You also said nothing about just an illustration its the latest version from today and if someone comes here a year from now he reads "copy paste this" and thats a bad idea to do so.My answer is better! –  wayne Jun 17 '12 at 16:35
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.