Seems it’s quite easy to make my iPod touth 4 (iOS 5.0.1) work. 2 packages need update using PPA here. Or you can simply download them and install:

Now your audios/videos in your iOS devices are recognized in Rhythmbox :).

Ubuntu Lucid(10.04) originally ships with 2.6.32 kernel. But on my T420 thinkpad, the wireless card is not recognized and graphics card is not functional well. Then I switched to 2.6.38 backport kernel, and installed bumblebee package to utilize the Nvidia Optimus Technology. Now the 3.0.0-16 backport kernel is out, it contains the fix for “rework ASPM disable code”, and it should do a better job in power saving even using the discrete Nvidia card. Moreover, it’s the new LTS kernel, so I decided to update to the 3.0 kernel. Please follow the steps if you are interested:

1. Add X-Updates PPA

These commands install official nvidia driver. Currently, it’s the 295.20 version.

2. Enable Nvidia Driver

This will let you to choose opengl engines. Select nvidia over mesa. This will also enable nvidia Xorg drivers, blacklist nouveau driver and add nvidia-xconfig into /usr/bin. You may find warnings like:

Just ignore them, seems to be safe.

This will generate new /etc/X11/xorg.conf file for your Nvidia card. If you cannot find the command, the original location is: /usr/lib/nvidia-current/bin/nvidia-xconfig

3. Fix ld Bindings

This just add an ld path into /etc/, otherwise, glx module cannot be loaded correctly. Here’s the /etc/log/Xorg.0.log segments:

Now, update ld runtime bindings and reboot.

4. Verify

If your installation is successful, the output looks like:

After installing the driver, hedgewars shows 120fps. While it used to show 4fps. It’s a great improvement. 🙂


By default, You need to guide Vim to decode double-byte encodings like GBK and Big5. The default Vim configuration only works well with Unicode encodings including utf-8, utf-16, utf-16be etc..Edit your .vimrc file, add line like:

Now Vim is able to detect and decode GBK and Big5 encodings automatically. And according my experience, Vim respects utf-16 and utf-16be files only they have BOM byes. Otherwise, these files are wrongly decoded. In this case, you may want to manually reopen the file using a correct encoding. The Vim command like:

And Vim does not store BOM when saving by default. To enable/disable BOM saving, use:

I’ve attached a series of text files to learn the usage. These text file all contains string “123你好”, but saved in different encodings. Let’s list their code points first:

1 2 3
GBK 0x31 0x32 0x33 0xc4e3 0xbac3
Big5 0x31 0x32 0x33 0xa741 0xa66e
Unicode 0x31 0x32 0x33 0x4f60 0x597d
UTF-8 encoded 0x31 0x32 0x33 0xe4bda0 0xe5a5bd

And our hexdump’s here, note the byte order:

My test text files are here. More info:

The objective of this article is to make Vim your programmer’s editor.

First, a normal version of Vim should be installed to enable syntax highlighting. The default installation of Ubuntu 10.04 only contains a compact version “vim-tiny”:

Then copy a local vim configure file:

1. Line Number

Add line into the .vimrc file:

A similar command can be used to show/hide line number when editing on the fly:

Related help:

2. Tab-space Conversion

From the Vim help:

'tabstop' 'ts'          number  (default 8)
                        local to buffer
        Number of spaces that a  in the file counts for.  Also see
        |:retab| command, and 'softtabstop' option.

        Note: Setting 'tabstop' to any other value than 8 can make your file
        appear wrong in many places (e.g., when printing it).

        There are four main ways to use tabs in Vim:
        1. Always keep 'tabstop' at 8, set 'softtabstop' and 'shiftwidth' to 4
           (or 3 or whatever you prefer) and use 'noexpandtab'.  Then Vim
           will use a mix of tabs and spaces, but typing  and  will
           behave like a tab appears every 4 (or 3) characters.
        2. Set 'tabstop' and 'shiftwidth' to whatever you prefer and use
           'expandtab'.  This way you will always insert spaces.  The
           formatting will never be messed up when 'tabstop' is changed.
        3. Set 'tabstop' and 'shiftwidth' to whatever you prefer and use a
           |modeline| to set these values when editing the file again.  Only
           works when using Vim to edit the file.
        4. Always set 'tabstop' and 'shiftwidth' to the same value, and
           'noexpandtab'.  This should then work (for initial indents only)
           for any tabstop setting that people use.  It might be nice to have
           tabs after the first non-blank inserted as spaces if you do this
           though.  Otherwise aligned comments will be wrong when 'tabstop' is

I will choose to use the 2nd approach, so add:

The auto-indent feature is also useful:

When setting expandtab, a real tab can be input by <Ctrl-v>_<Tab>

Related help:

3. Option ‘modeline’:

If you start editing a new file, and the ‘modeline’ option is on, a number of lines at the beginning and end of the file are checked for modelines. This is simply enabled by adding:

Your C/C++ comment may look like one of the following:

And likely, the Python comments:

Here, ai, et, ts and sw are just abbreviations. And expandtab is an option only in Vim, not Vi.

Read related help by typing:

4. Using Taglist:

There are lots of useful scripts in the Vim website that we can use. But Actually, Ubuntu repository also has some of them included:

After installation, these scripts are just downloaded, but not installed for your Vim. We list available script by typing:

Output on Lucid 10.04:

The Taglist plugin is described here, while OmniCppComplete plugin in next section. Both of them make use of ctags utility. Install it first:

Now install the Taglist plugin to your Vim:

When editing a supported file type, Show the taglist window can be opened by one of the following:

Move your cursor between windows by <Ctrl-w>_w as usual. You may want to add a shortcut to toggle this feature. Add lines to your .vimrc file per official document:

When your cursor hovers on a function, <Ctrl-]> takes you to its declaration, while <Ctrl-t> takes you back.

More help:

5. Using OmniCppComplete:

Vim include basic support for code completion. The simplest way is to use <Ctrl-p>. Vim will search your include headers and do insertion. See the screenshot:


The include search path can be set by:

More help info:

Next, Vim provides basic C language completion using ctags. No C++ is supported. Additional languages script can be found in Vim’s autoload directory, say /usr/share/vim/vim72/autoload. But you should generate necessary ctags index files first. For libc6 header files:

And add lines to .vimrc file:

Omni completion can be issued by <Ctrl-x>_<Ctrl-o>.

Screenshot showing function prototype:


Screenshot showing struct member completion:


More help info:

Note, the ccomplete does not work well in C++ completion. So we need to install OmniCppComplete plugin:

Generate ctags index for libstdc++ and qt4:

And add lines to .vimrc file:

You may encounter problems when completing STL functions. Refer to :help omnicpp-faq and find the solution. Anyway, it works all good for me. Here’re screenshots showing STL and Qt code completion:



!!!NOTE!!! : The tags file for current file must be generated for OmniCppComplete to work. I’ve set Ctrl+F12 as the accelerate key. Otherwise, you’ll get “Pattern not found” error. More help:

Finally, the list of lines adding to my .vimrc file:

I read this article when Lucid was just released. It works good, but there’s no window icon in the title bar(See my previous screen-shots).

Then I tried to modify the theme files. Take “Radiance” theme as example:

Change the last line into:

This will set your window button order. And every time you switch to “Radiance” theme, no confirm dialog will prompt to tell that the button order will be changed. Then:

Search “menu_focused_normal”, there are four lines regarding graphics drawing of menu: “menu_focused_normal”, “menu_focused_prelight”, “menu_unfocused_prelight”, “menu_unfocused_prelight”. Add first line into “menu_focused_*” and remove the image tag, and use second line to replace the image tag in “menu_unfocused_*” too.

OK, you’re done.


Update Feb 17, 2012: You can simply run: