HOWTO: Neat Little Things

This is not a real howto, but a small collection of neat little things.

Quickly show code syntax colour coded.

  1. Install highlight.
  2. Create a script called lesscode with the following lines: #!/bin/bash highlight -A $* | less -R Extra parameters to the script controls the highlight program.
  3. Put your script in /usr/local/bin and run chmod 755 /usr/local/bin/lesscode
  4. Now you can display a wide range of programs using the lesscode command. You can also pipe code output from some other program to this command, for example from subversion, however you have to specify the syntax, for example svn cat file.cpp | lesscode -S cpp
  5. If your favourite language is not supported by highlight it possible to create a new custom language definition. There are also extra definitions available for download.

Visualize the changes in versioning repositories, such as subversion (SVN) and CVS.

  1. Install kompare, a KDE tool for visualizing the difference between two files.
  2. Execute svn diff | kompare -o -

Rename files using regular expressions (regexp).

  1. Renaming of multiple files can be a hassle. Most of the time you need to use a shell script.
  2. Try renaming your files using the Python script g-rename, a part of the g-jutils package. If you don't know regexp yet, this is the time to learn it.