Jul 16 2009

VIM as a syntax highlighting pager

Éverton Arruda

I’ve been looking for a way to use less with syntax highlight and ended up in a page of Ubuntu Tutorials[0] website with a very good tip: Using VIM as a syntax highlighting pager[1].

All you’ll need is the package vim-full, só, in Debian-like systems, you’ll need to execute:

1
# aptitude install vim-full

Then, you’ll have to execute:

1
$ vim -u /usr/share/vim/vim72/macros/less.vim <FILE>

And you have it working!
NOTE: Depending on the version of your VIM, the path to less.vim might be different.

You can make this command simpler by creating an alias and adding it to your .bashrc file:

1
$ echo "alias vless=\"vim -u /usr/share/vim/vim72/macros/less.vim\"" >> ~/.bashrc

Now the system will need to re-read your .bashrc file, so the changes may be applied:

1
$ . ~/.bashrc

And after this you can test vless:

1
$ vless <FILE>

[0] http://ubuntu-tutorials.com
[1] http://ubuntu-tutorials.com/2008/07/14/use-vim-as-a-syntax-highlighting-pager/

:wq


Apr 30 2009

Adding a codebox to your wordpress

Éverton Arruda

Adding a codebox to your wordpress blog is really simple, all you have to do is download the one you want, upload it to wp-content/plugins directory in your blog, then you’ll have to access the admin page of your blog and activate it in the plugins section. Just as any other plugin.

I recommend CodeColorer plugin, the one i use here in my blog. CodeColorer is developed by Dmytro Shteflyuk, you can find it at it’s homepage: http://kpumuk.info/projects/wordpress-plugins/codecolorer. This plugins supports more than 100 languages.

After some customizations, my codebox is like this:

1
2
3
4
5
6
7
#include <stdio.h>
/* Hello World in C */
int main()
{
    printf("Hello World!\n");
    return 0;
}

If you want to look for other highlight plugins you can find more at http://wordpress.org/extend/plugins/search.php?q=code+highlight.

:wq