MW

Tag syntax highlighting

Recent Posts

Git commit message highlighting in nano (November 24, 2012)

For those who use nano as their CLI editor of choice: Here’s a syntax highlighting file for Git commit messages which also supports the special KDE commit hook keywords.

    ##  syntax highlighting for git commit messages of KDE projects
    syntax "patch" ".git/COMMIT_EDITMSG$"
     
    # overlong lines
    color brightred "^.{70,}.+$"
     
    # KDE commit hook keywords, see: http://community.kde.org/Sysadmin/GitKdeOrgManual#Commit_hook_keywords
    color yellow "^(FEATURE|BUG|CCBUG|FIXED-IN|CCMAIL|REVIEW|GUI|DIGEST):.*$"
    color yellow "(SVN_SILENT|GIT_SILENT|SVN_MERGE)"
     
    # comment
    color blue "^#.*$"
     
    # special comment lines
    color green "^# Changes to be committed:"
    color red "^# Changes not staged for commit:"
    color brightblue "^# Untracked files:"
    color brightblue "^# On branch .+$"
    color brightblue "^# Your branch is ahead of .+$"
     
    # diff files
    # meh - cannot match against \t ... should be: ^#\t.*$
    color cyan "^#[^ a-zA-Z0-9][^ ].*$"

continue reading...

syntax highlighting for *.ini files in nano (February 27, 2011)

Use the snippet below in your ~/.nanorc or /etc/nanorc file to highlight *.ini files like php.ini in Nano.

    # ini highlighting
    syntax "ini" "\.ini(\.old|~)?$"
     
    # values
    color brightred "=.*$"
    # equal sign
    color green "="
    # numbers
    color brightblue "-?[0-9\.]+\s*($|;)"
    # ON/OFF
    color brightmagenta "ON|OFF|On|Off|on|off\s*($|;)"
    # sections
    color brightcyan "^\s*\[.*\]"
    # keys
    color cyan "^\s*[a-zA-Z0-9_\.]+"
    # comments
    color brightyellow ";.*$"

continue reading...

Highlighted Backtraces on BKO (September 20, 2010)

Hello everyone, the “I can syntax highlight everything” guy speaking again :)

Yeah, I couldn’t sleep well after I put colors on Dr Konqi. I also did the same for Kate, if you did not notice it. There is a new GDB Backtrace syntax highlighting file for it, giving you the same pleasant experience you are now used to from Dr Konqi. Awesome.

But well, lets admit it: What use are these two for bug triaging? Visit any crash report on bko and you are left to plain old black-on-white… Stone-age stuff, lets put it on LSD, shall we not? I propose: The GDB Backtrace highlighter GreaseMonkey userscript!

highlighted GDB backtrace on BKO
Download User Script (Requires GreaseMonkey 0.8 or higher)

Bug reports, feedback, pizza & beer all welcome :)

continue reading...

Dr Konqi now with colors (Updated) (August 20, 2010)

Hey there :)

As I announced on the kde-core-devel mailing list, I planned to improve Dr Konqi for a long time, as for me as a developer it is an invaluable tool. Well, yesterday I sat down and implemented the first two things which I wanted for a long time:

Scroll to KCrash

Once the backtrace got loaded, Dr Konqi will automatically scroll to the line that contains [KCrash Handler]. No need to find that manually anymore. Awesome :)

Colors!

Yeah, you should know that I as a KDevelop user and developer am addicted to syntax highlighting. That’s what I did for Dr Konqi as well now:

dr konqi with syntax highlighted backtrace
Dr Konqi with syntax highlighted GDB backtrace

So anyone using KDEBase trunk will now have a shiny Dr Konqi :) Feedback appreciated, esp. whether more or less should be highlighted. I personally found it overly colorful when I also highlighted pointer adresses (ignore the bug in that outdated screenshot). What do you think?

continue reading...

Kate Love: HighlightInterface, Autobrace (November 23, 2009)

Well, I have to admit: I didn’t spent much time developing the PHP plugin for KDevelop these past weeks. Instead I hacked on Kate:

HighlightInterface

I added another Kate interface, this time to access some of the highlighting information:

  • what’s the Attribute for a given default style right now? Default styles are those known from syntax files, e.g. dsKeyword, dsFunction,…
  • what are used Attributes in a given line and what range do they occupy?
  • what modes do we embed? E.g. PHP embeds HTML, JavaScript, CSS, …
  • what mode is used at a given Cursor position?

This made it possible to port the “Export to HTML” action to a real plugin. If you come up with other output formats I might add them, I wondered about LaTeX support… might do this at some point.

This should also make it possible to use KatePart in other applications and than export the highlighting to a different format, e.g. a Flake shape for Koffice. Afaik this is actually planned by The_User - lets see if it works out!

continue reading...

Syntax Highlighting in Nano (August 04, 2009)

When I’m messing around with config files on the command line my editor of choice is Nano. It’s simple, fast and pretty much straight forward. You don’t have to learn any commands and can use keyboard shortcuts just like in GUI programs.

Settings

Today I had a look on the project website and saw that there are tons of settings which I really missed before. Just have a look into your /etc/nanorc for a default config file with all settings and their default values. Here are those I like most:

  • smooth (scrolling)
  • autoindent
  • mouse (though I use it rarely)
  • smarthome
  • tabsize (8 is far to much, I love 4)

Syntax Highlighting

Yes! Nano supports syntax highlighting! And I never knew it, but heck - it’s never to late. Not for neat features like this one, though I really wonder why this is not activated by default…

In the aforementioned /etc/nanorc are already some default languages which just wait to be commented out. You might also want to have a look into /usr/share/nano, there are some languages you can include in your nanorc file with:

continue reading...

recent GeSHi contributions (apache, xorg, apt, performance, ...) (June 18, 2008)

Your favourite syntax highlighter for web applications, GeSHi, recently got some new features and bug fixes. By yours sincerely. A rough summary of what I contributed:

  • various performance improvements, i.e. some speed optimizations and reduced memory consumptions (especially peak memory usage is down by roughly 1MB when highlighting geshi.php by itself)
  • minor bugfixes, including one which prevents some nasty PHP notices on PHP 5 systems to contaminate your precious log files
  • improved language files: bash, apache
  • added language files: GNU Gettext, Xorg configuration and Apt sources.list

Some of those features were already shipped with the recent 1.0.7.22 release. But the two new language files and the improvements to the existing apache language file are currently only available via SVN. Wait for the next stable release which should be 1.0.8.

continue reading...

highlighted APT sources.list in nano (April 10, 2007)

And here another syntax file for Nano. This time it highlights the /etc/apt/sources.list:

    ## syntax highlighting for /etc/apt/sources.list
     
    syntax "apt/sources.list" "sources\.list(\.old|~)?$"
    # component
    color brightmagenta "^deb(-src)? ((http|file|ftp):/[^ ]+|cdrom:\[[^\]]+\]/|cdrom:\[[a-zA-Z0-9\._-\(\) ]+\]/) [^ ]+ .+$"
    # distribution
    color brightred "^deb(-src)? ((http|file|ftp):/[^ ]+|cdrom:\[[^\]]+\]/|cdrom:\[[a-zA-Z0-9\._-\(\) ]+\]/) [^ ]+"
    # URI
    color brightgreen "(http|file|ftp):/[^ ]+"
    # cdroms
    # [^\]] does not work…
    color brightgreen "cdrom:\[[a-zA-Z0-9\._-\(\) ]+\]/"
    # deb / deb-src
    color cyan "^deb"
    color brightblue "^deb-src"
    # comments
    color brightyellow "#.*"

continue reading...