Syntax highlighted printing with vim

When I need to understand code I usually print it and printed code is easier to understand if the code syntax highlighted. Before I learned this vim trick I usually either used vim built-in :TOhtml function and opened the syntax highlighted code in a web browser but it turned out that vim has another tric up the sleeve. The :hardcopy or :ha command.


First I need to set the printer in my .vimrc file:

set pdev=cp01
set printoptions=paper:A4,syntax:y,wrap:y, duplex:long

Now I can just use the :ha command print the highlighted document directly to the printer cp01.

Print to PDF
In the recent versions of Ubuntu Linux the Cups installation have had PDF printer device which basically just wrote the output to PDF file an put it in /home/username folder. So by using the follwing code I can make vim make a nice PDF version of the text.

set pdev=pdf
set printoptions=paper:A4,syntax:y,wrap:y, duplex:long

HP photosmart C7280 review – works great under Linux

Introduction
After researching the web for quite a while I finally bought a new multifunction printer for my girlfriend. It is a HP photosmart C7280.

While researching I had the following prioritized demands for the new printer:

  • Linux and Mac support
  • Standalone copying
  • Scanner
  • Build-in duplexing unit
  • Build-in network
  • Reasonable performance/price
  • Cheap running costs

Continue reading HP photosmart C7280 review – works great under Linux

Using Xming, a free X-server for Windows, to connect via SSH tunnels

For those of you who are not interested in paying license fees for the proprietary Windows X-server, X-win32 there is a free alternative called Xming. I can be used for the same purposes such as running graphical programs on remote Unix or Linux servers.

Installation
The first thing to do is to download the xming x-server from the site sourceforge.net/projects/xming. Select the “Download” fan and the get the file called xming. You can also chose to instal the extras such as “Xming-fonts”, “Xming-mesa”, “Xming-portable-PuTTY” and “Xming-tools-and-clients” but these are not needed for normal operation.

The installation is pretty straight forward and the first thing to after installation is to start the X-server by double clicking the Xming icon. Now the X-server will be running in the background waiting for incoming connections.




To send some data to X-server from a remote Unix/Linux system we need to enable X-forwarding in putty. Putty can be downloaded from the site
www.chiark.greenend.org.uk/~sgtatham/putty/download.html

After starting putty one additional setting has to made. The X11 forwarding flag has to be enabled and point to the local X-server often localhost:0, where 0 is the display number.




After connecting to the server we should be able to watch graphical programs such xclock through the SSH connection.