Ubuntu – Gedit syntax color wont show up

bashcolorsgedit

I have some programs I wrote a while ago to edit a journal I've been keeping. I normally don't like to use gedit, I like to keep my vim skills up for my next "gui-less" project. I was editing one of those programs written in bash script with gedit, and even with #!/bin/bash at the top, it wouldn't show the bash syntax. all the other ones seem to be working fine. here is the problematic script.

#!/bin/bash
############################
# ok, this is going to be  #
# a remake of my first     #
# easy access log editing  #
# Program.                 #
############################

chmod 770 ~/.Secret_Files
vi ~/.Secret_Files/Log17
chmod 000 ~/.Secret_Files
sleep .5
echo 'Done'

(like my feeble attempts at documentation?)

the thing that sucks is right here, it just showed the syntax coloring in askubuntu.

Question answered, no need to add.

Best Answer

  • I don't know how gedit handles syntax highlighting of extension-less files (there are questions about that: Can Gedit default highlighting style be set for files without an extension?), but there definitely is a plugin that handles modelines:

    enter image description here

    So, if you have a comment of the form in the first (or last) few lines:

    # vi: ft=sh #
    

    It will use shell syntax highlighting, and with ft=perl, Perl syntax highlighting and so on.