Syntax Highlighting / Shebang?

hyper_ch kwrite-devel at sjau.ch
Wed Oct 25 10:23:54 UTC 2017


Hi there

New to the list bug long-time kate user. In #bash on freenode they 
recommend to not use a file extension for bash scripts giving this reason:

‎<‎greybot‎>‎ Don't use extensions for your scripts. Scripts define new 
commands that you can run, and commands are generally not given 
extensions. Do you run ls.elf? Also: bash scripts are *not* sh scripts 
(so don't use .sh) and the extension will only cause dependencies 
headaches if the script gets rewritten in another language. See 
http://www.talisman.org/~erlkonig/documents/commandname-extensions-considered-harmful

However due to syntax highlighting I'm accustomed to just adding .sh to 
scripts but lately I less and less do so - up to now it meant that Kate 
didn't do any syntax highlighting automagically so I asked today if it 
could be done by analyzing the shebang line.

The response I was given was to add modelines like:

# kate: syntax bash

and that really works well.

However it's another line and some might consider it not as pretty. For 
that reason I've been wondering if syntax detection could be based on 
the shebang line?

hyper_ch



More information about the KWrite-Devel mailing list