Tuesday, July 29, 2008

Tweaking Vim For Fun and Profit

Vim, to certain extent, amazes me. It can be tweaked in any number of ways. To start with, set your xterm or whatever terminal you use to 256 color palette, as long as it supports 256 color palette. You can check this in your terminfo installation--never thought of what the h*** terminfo and ncurses are for until this point--which for xterm, placed in /usr/share/terminfo/x/*. The file named xterm-256color in that path represents 256-color-xterm. Use the tput command to check if your terminal in X supports 256 color palette, as follows:

tput colors

The output will be similar to:

darmawan@opunaga:~/_Projects/******/svn_checkout/trunk$ tput colors
256

notice the 256 which means it supports 256 colors. If you're using Xfterm4 in XFCE you can easily convert its setting to 256 colors by entering "xterm-256color" to the "$TERM setting" in its Edit|Preferences, akin to this:


Once you get the 256-color terminal, it's the time to tinker with Vim. First, download a good colorscheme for Vim. I recommend zenburn. Then place it in the system-wide vim color setting, which in my case placed in /usr/share/vim/vim71/colors directory. Then do some editing to your ~/.vimrc. Add the following lines:

set nobackup " This line is not related to vim visual tuning, it can be omitted
set writebackup " This line is not related to vim visual tuning, it can be omitted
set number " Show numbers on the left of each line
:colorscheme zenburn " Set the colorscheme to zenburn

Now, with some vim command combination, e.g. '0 (recall last buffer), '1 (recall next to last buffer), split (^Ws), vsplit (^Wv), exchange window (^Wx). You will get something like this:




And by using DejaVu Sans Mono (7 pitch) in Gvim, this is what you'll get:



All in all, Read The Friendly Manual with ":help history" or other topics. It helps a lot to get you up to speed.

Monday, July 28, 2008

Get Ready for World Domination



Starting to make junk post =))

ATI Propietary Linux Driver - Xine - Video Overlay

With the Slamd64 up and running, I noticed a problem when using Xine to play Videos. I cannot zoom the video scene correctly and the video control panel is not shown in fullscreen mode. I have to force Xine to close in fullscreen mode with Alt+F4.
I found that this is something to do with a "miscommunication" between the ATI Propietary Linux Driver a.k.a ATI Catalyst for Linux and the X server that handles image buffering. I'm using ATI Catalyst for Linux X86_64 version 8.50.3 (filename: ati-driver-installer-8-6-x86.x86_64.run) and the default X server that comes with Slamd64 12.1. It turns out the the video overlay mechanism is not set correctly. So, I have to set it manually with aticonfig. This is the snippet of aticonfig options for video overlay:


darmawan@opunaga:~/test $ aticonfig --help | less

Screen-Related Options:
--ovt, --overlay-type=STRING
Change the overlay for the X server. STRING can be one of:
opengl
Xv
disable



I set the driver setting (as root) with aticonfig:


aticonfig --ovt=Xv

This is because OpenGL is not working nicely with Xine yet in my machine. Note that I'm using Xinelib 1.11 and Xine UI 0.99.5 on system with Turion64 1.8GHz, 1GB RAM and ATI X200M (RS480 northbridge and SB400 southbridge chipset). After trying to force video overlay with opengl and do some tests, I confirm that none of the ATI Catalyst for Linux works. Neither Catalyst version 8.50.3 nor 8.51.3 can work correctly when I used Xine with video overlay set to opengl. Only Xvideo a.k.a Xv extension can work correctly with Xine in my RS480-based system.



Helpful links:
http://ati.amd.com/support/drivers/linux64/linux64-radeon.html
http://wiki.cchtml.com/index.php/Main_Page

Xfterm4 Problem (Solved)

I got this warning in Xfterm4 due to unknown reason:

WARNING: terminal is not fully functional (press RETURN)

when I run more, less or CTRL-L and some other commands in Xfterm4. With some googling effort, I don't seem to find the solution. All I know that this must be terminal setting problem. I went to check every terminal related setting and I found that by replacing
~/.config/Terminal/terminalrc
with one from the other login, everything back to normal again.