Updating vim confs

My vimrc goes back to 1995, and it looks like it. Stuff pasted everywhere, and probably full of outdated settings.

After stumbing across Amix's vimrc file I was inspired to update my confs and take a look at some of the more recent vim plugins.

Some of the plugins I want to try are Command-T and YankRing.

Command-T looks like the FuzzyFinder-textmate done better. It interacts badly with my

autocmd BufEnter * lcd %:p:h

setting, but I think I can write a patch to update the stored path only on flush.

YankRing has been around for a while, but I guess I never paid much attention. Lately I've been reading about Emacs Lisp, and the Land of Lisp book, so I'm interested to try out a killring in vim.

In any case, thank you amix for posting your awesome vimrc and inspiring me to update myself!

posted: Nov 13 2010
tags: vim

Ruby from version 1.6 to 1.9

Back in 2002, Ian Macdonald invited Dave Thomas to the Googleplex to give a talk about Ruby. I bought the first version of the Pickaxe book (for Ruby 1.6) and had it autographed for the visit. After the talk, I read the book, slurped the language right up, and started using it in a few projects there. Alas, I had to do it secretly - Google has always been a Python shop - but I had fun with it.

Since then, I've followed the Ruby and Rails crowd, but haven't done much with either besides dabble.

Last week, however, I finally finished reading the ruby 1.9 version of the book. The core of the language is still there, but they have done little improvements here and there to make it more elegant and interesting.

There are too many to list them all, but the most interesting to me are:

  1. Enumerators. You can convert most collections to an Enumerator object with the to_enum method. This allows you to simultaneously iterate through two collections at the same time, or for those other occasions where ruby's built-in interation blocks aren't a good fit.

  2. Encodings. The language now supports separately manipulable encodings for the source code, IO, as well as internal objects.

  3. "Splatting" (expanding a collection in a method call or during parallel assignment) is much cleaner now. Previous versions had too many rules, and weren't intuitive.

  4. Block local variables. One of the gotchas was that "local variables" in a block weren't local if they were defined outside the block. Well, that's still true, but now you can explicitly list block local variables so there is no more accidental overwriting of block external variables.

  5. require_relative. No more "require File.dirname(FILE) + '/../../blah' garbage.

I think Ruby is an interesting language and think it deserves more respect than it gets in some circles. I hope its development community matures and the world's perception of it improves.

posted: Nov 1 2010
tags: ruby

Purge old configuration files for removed packages in Debian

I saw a good tip today at Debian Administration. Sometimes when upgrading, a dependent package will be removed, but its config files will stay around. One way to list and purge those packages is with:

aptitude search ~c
aptitude purge ~c
posted: Sep 23 2010
tags: debian

Fix for xmledit plugin

I've used the vim xmledit plugin for a long time, and for a long time I've had trouble with self-closing tags in xhtml (for instance, br). The plugin would add the trailing "/" automatically, but leave the editing cursor in the wrong place.

This past Friday, I finally took the time to open the plugin and track down the problem. The fix was fairly simple, and I sent a patch to the author for inclusion. He was very enthusiastic and encouraging about my patch. Overall it was a very satisfying experience.

Hurray for me and for open source, but I can't help kicking myself for not doing this years earlier. The idea behind open source is to look at the code and help improve things. Somehow I have to encourage myself to do this kind of thing more.

posted: Sep 12 2010
tags: vim

Gnubiff Tips

I use gnubiff for a message notifier, but the popup window for new messages sometimes gets hidden underneath other windows. If you enable the expert options to be shown, there is a "popup/popup_keep_above" option which can be set to true to prevent this problem.

posted: Sep 8 2010
tags: tips

Removing Linux from a Laptop

A while ago, I swapped laptops with my wife. She was running Windows XP, which was easy enough to reformat and install Debian onto. My laptop was running a dual boot Windows 7 / Debian setup. I wanted to keep the same Windows 7 on there (it was a Thinkpad with all sorts of utilities I didn't want to have to reinstall). So I needed a way to remove the Debian and resize the Windows 7 partition.

My first step was to remove the Grub bootloader. After a few quick searches, I discovered booting into the Windows 7 installer and running the command:

bootsect /nt60 SYS /mbr

was supposed to do the trick.

Unfortunately, after running the command, the laptop would no longer boot. I booted a GRML CD and restored the Grub mbr by running:

grub-install --root-directory=/mnt/sda3 /dev/sda

Afterwards I could once again boot Windows and Debian using grub.

After much head scratching, I finally found out the 'boot' flag for the windows partition was not set. Apparently this doesn't bother Grub, but prevented Windows from booting by itself.

After that, the rest was easy. I used GParted to remove the Debian partitions and resize the Windows 7 partition to be the whole drive, and everything just worked.

posted: Aug 21 2010
tags: computers

Setting up Chinese Input Under Debian

I just got Traditional Chinese input working under Linux. It's actually more straight forward than I thought.

First, install the package scim-chewing. It will pull in all the necessary dependencies.

Next, set up a few environment variables (I put these in my .zshenv file):

export XMODIFIERS="@im=SCIM"
export GTK_IM_MODULE="xim"

Finally, launch scim. An icon will appear in the status bar, where you can configure things.

Update: To enable it in gnome, you need to run

im-switch -s scim

and then reboot.

Update 2011-05-11: You probably want to instead use:

im-switch -s scim-bridge

I discovered that scim mode causes problems with rxvt and other C++ applications.

posted: Mar 4 2009
tags: debian chinese

Converting text to PDF

Here's a quick way to create PDF files with some text in them:

echo "contents for PDF" enscript -p - ps2pdf - file.pdf
posted: Feb 4 2009
tags: tips

Previous page Page 4 of 4