Why VIM is not my favorite editor


UPDATE:
clang_complete is what the people want and what the doctor ordered:

let g:clang_snippets=1
let g:clang_conceal_snippets=1

C^X, C^U, profit. Another awesome development for LLVM!

VIM clang_complete


It sucks for C and C++ development.

Popup code completion (“IntelliSense”) is a godsend.  Instead of flipping back and forth between an API reference and your code, a non-invasive popup of available functions, method signature, struct members, instance variables, etc is right at your fingertips.  It’s especially useful when it contains the declaration’s comment/Doxygen/JavaDoc.

Building a ‘ctags’ file of my system libraries takes ten minutes and weighs 1.5GB for VIM’s integrated omnicomplete.  Any time the headers are updated, it has to be manually rebuilt. The project’s tags need to be rebuilt per change.  Unbearable.

I also can’t get inline function/method signatures or automatic struct member completion without a three year old script, omnicppcomplete.  Yes, this is true for plain old C too.

The one editor I’ve found that provides the level of introspection I expect yet otherwise stays out of the way is KDevelop 4.1.  It basically takes the Kate text editor, with awesome syntax highlighting and standard editing features, and adds some of the best auto-completion I’ve seen for C or C++.  It’s fast too, and doesn’t require a ridiculous manual scan or gigabyte symbol database.  It just works – automatically.

Well, editing from the console is pretty convenient, especially on slow remote SSH connections.  Lazyweb, am I missing something that VIM gurus know and I don’t?  Does emacs provide the level of completion I’m looking for on the console out of the box?

I know the llvm devs have some code brewing that uses llvm for syntax completion.  Maybe there’s light at the end of the tunnel.

My .vimrc looks like this if anyone has any suggestions: Continue reading

KDE SC 4.4 – Steady, Incremental Improvements

I haven’t noticed any killer features in KDE SC 4.4 and I’ve been running it since Beta 1. I’ve noticed a lot of subtle improvements.  Things like app stacking and selection in the task bar seem much more responsive.  All around, plasma looks subtly better and my favorite KDE apps seem to just keep getting better.

KSysGuard is really impressive and now has the ability to connect to remote hosts for monitoring.  However, the biggest change is in the greater ecosystem.  It seems all the external apps like Amarok, K3b, and digiKam are coming along to fruition.

Other than that, this is a smooth release and shows that the platform is starting to mature.  I think the Summer release distros will be able to do a good job delivering a nice desktop experience based on KDE 4.4.  I’ll end with my obligatory “try KDE 4.4 if you had previous bad KDE4 experiences”.

Getting Beautiful Fonts in Gentoo Linux

Here’s my easy and modern guide to getting pleasant looking fonts on Gentoo with minimal effort.

Wikipedia rendered with the end result of this guide

Wikipedia rendered with the end result of this guide

USE Flags

Enable the following USE flags:

euse --enable truetype type1 cleartype corefonts

and make sure everything is built with them enabled:

emerge -uDNa world

Emerge Fonts

X.org and other apps should pull in some common fonts.  Here are some additional fonts useful for OpenOffice and other programs.  Dejavu provides excellent default fonts which we will enable in the next section.

app-admin/eselect-fontconfig
media-fonts/corefonts
media-fonts/dejavu
media-fonts/font-bh-ttf
media-fonts/font-bh-type1
media-fonts/freefonts
media-fonts/ttf-bitstream-vera
media-fonts/unifont
media-fonts/artwiz-aleczapka-en

Enabling fontconfig options

Use ‘eselect fontconfig list‘ to see a list of available configuration options.

eselect fontconfig list

eselect fontconfig list

Try enabling the following with ‘eselect fontconfig enable <num from list above>’:

10-autohint.conf
10-sub-pixel-rgb.conf
20-unhint-small-dejavu-sans-mono.conf
20-unhint-small-dejavu-sans.conf
20-unhint-small-dejavu-serif.conf
25-unhint-nonlatin.conf
57-dejavu-sans-mono.conf
57-dejavu-sans.conf
57-dejavu-serif.conf

This will give you very nice hinted fonts suitable for the great majority of RGB LCD displays.

The 57- series rules enable dejavu fonts as the default Serif and Sans Serif fonts.  This will improve the look of your desktop environment and programs like Firefox immediately.

~/.fonts.conf

This file controls your user fontconfig settings.  We will reiterate RGB hinting and disable it for bold fonts so they are not overly bold.  There are plenty of other tricks you can perform in this file to get more Windows-like text, but I’m quite satisfied with the following and find it very easy to read.

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <match target="font">
 <edit mode="assign" name="rgba">
 <const>rgb</const>
 </edit>
 </match>
 <match target="font">
 <edit mode="assign" name="hinting">
 <bool>true</bool>
 </edit>
 </match>
 <match target="font">
 <edit mode="assign" name="hintstyle">
 <const>hintfull</const>
 </edit>
 </match>
 <match target="font">
 <edit mode="assign" name="antialias">
 <bool>true</bool>
 </edit>
 </match>
 <!-- Disable autohint for bold fonts so they are not overly bold -->
 <match target="font" >
 <test compare="more" name="weight" >
 <const>medium</const>
 </test>
 <edit mode="assign" name="autohint" >
 <bool>false</bool>
 </edit>
 </match>
</fontconfig>

Conclusion

Please share any thoughts and tips in the comments.  I recommend browsing the X.org Font Guide on Gentoo Wiki, though some of the information there is out of date or more complex than the method I just outlined.

El Reg Humor and Java in free software

The Register has a good article on Sphinx search with some entertaining pop-shots at Java and “enterprise software” that got a rise out of me:

Solr is popular with the enterprise crowd, who love its Java. Being a Java program, Solr includes no shortage of technology whose acronyms contain the letters J and X.

This tickles the enterprise pink, because these sorts of developers love nothing more than hanging out around a whiteboard drawing boxes and arrows and, from time to time, writing XML to make it look like they’re doing real work. Solr thrives in this environment, being an Apache Foundation project, the Apache Foundation, of course, widely known as a cruel experiment to see what happens when bureaucrats do open source.

Having a bit of experience with Java from academia and a few open source projects I make use of, I can’t help but laugh at how comically and concisely the editor summed it up.

By and large, successful open source projects tend to be written in languages other than Java. The entire GNU/Linux OS stack is primarily C, with some components using C++ like KDE, OpenOffice and Firefox.  On the ever popular web front, PHP, Ruby, and Python lead the pack.

I think it turned out this way for a multitude of reasons.  When working on the OS stack, the power and control of C and C++ are hard to beat.  The plethora of libraries and raw speed of these compiled languages set the bar high for any newcomers.  Java exists as a kludge, mildly useful for desktop apps and mildly useful for web apps while historically having a lot of problems.  Native look and feel have long been the layman’s complaint, though SWT has done a pretty good job there.  Of course, omnipresent Java in the Linux world is relatively new.  I think Java would have been the darling language of client apps had it been open sourced sooner, but this came about 7 years too late to have a large impact on shaping the common FOSS userland.

It is interesting how the open source projects built with Java tend to be highly bureaucratic and abstract.  I think the bottom line is that FOSS programmers do what they do because it is fun and demand pragmatism.  The “enterprise software” attitude/baggage that many Java apps and libraries carry are a big turn off to pragmatism and the hacking culture.  The barrier to entry for Java web programming is also much higher than its “scripting language” competitors, which carry light and simple frameworks that focus on results, not procedure.

Java itself isn’t that of a bad language.  I actually enjoy working with it in school (…though I think it really isn’t appropriate as an introductory teaching language, shielding important concepts from students.  Maybe a future post?..).  When it comes time for real work though, I consider Python, C,  C++ more pragmatic depending on the job at hand.  That, and the fact that most of the common scripting languages are gaining JIT compilers may accelerate Java toward status as a legacy language.

Your thoughts?

To users that miss xorg.conf and complain about it

I get requests from users and see questions all the time for “where did my xorg.conf go in the latest Ubuntu or Fedora?”, though it is usually a bit more of a flame.

The quick answer… press Ctrl+Alt+F2 or similar to log into a TTY console, or type ‘init 3′ into a root X terminal.

If you haven’t already, log in as root and  kill X or type ‘init 3′ if you want to be heavy handed.  Then run:

X -configure
mv ~/xorg.conf.new /etc/X11/xorg.conf

xorg.config in two commands.  Run the ‘init 5′ command to get back to your GUI login (or kdm or gdm or startx, etc if you know what you are doing.  Worst case remove the .conf and restart.)

If you are advanced enough to edit an xorg.conf, the above should be a cakewalk and you shouldn’t complain about it.

Regardless, you should investigate ‘xrandr’ which makes it simple to do runtime adjustments.

If you are a newbie, look into a gui.  KDE has KRandRTray which makes controlling outputs and resolutions a breeze.  Don’t forget to toggle the output on with the Fn key if you are a laptop user.

Needless to say, Xorg is moving in the right direction.  Stop complaining about it.

Arora, a refreshing new Qt/WebKit browser

The Gentoo Qt maintainers have been doing a fantastic job of getting cutting edge Qt software into shape with the qting-edge overlay.  I’ve been running Qt 4.5 since beta1 and am pleased with the direction it is going.  Recently the devs bumped the Arora ebuild to version 0.5.  Arora is a lightweight browser based on Qt and WebKit.

I must say, I am impressed.  This browser is lightning fast.  The interface is pleasing, yet minimalist.  You get all the benefits of recent WebKit, and the nice cross-platform nature of Qt.  It feels much faster than Konqueror4.2, and the recent WebKit engine means better compatibility.

It works with all the sites I’ve thrown at it so far and performs great on the Acid 3 test.

Arora 0.5 Acid3 Test - 100/100

Arora 0.5 Acid3 Test - 100/100

All in all it reminds me of Firefox’s early days.  Very mean and lean.  Firefox 3.1 beta2 has served me pretty well, so I don’t think I’ll abandon it yet, but WebKit browsers are becoming quite compelling.

The WebKit devs are also pushing some interesting new ideas out with CSS animation.  This example gives Flash-esque falling leaves.  Maybe we will see less reliance on Flash in the future with the new video/audio tags and work such as this.  It would be nice to move presentation back into structured [X]HTML and CSS, which is portable, easier to parse, and light weight.

Leaves CSS Animation

Leaves CSS Animation

If you are on Gentoo, bump to Qt 4.5rc1 and take a look easily (both are in portage):

emerge -av arora

I’ve seen it hit Fedora Rawhide recently as well.

Only one problem: icon is a bit conspicuous  :-P

Arora Icon

KDE 4.2 on Gentoo

KDE 4.2 is out officially.  The ebuilds for Gentoo have been ready for a while.  This is a truly fantastic release.  If you’ve ever made an opinion about KDE in the past, I encourage you to give it another go.

My beta1 review back in December sums up most of my thoughts on the release.  There isn’t anything significantly changed since, just lots of polish and bug fixing.  Everything has been stable and functional since I’ve been using it in the RC phase.   This is a worthy opponent to KDE 3.5, GNOME, Windows and OS X.

Thanks again to the Gentoo KDE team.  The ebuilds are in great shape!

One Small Step for QT, One Giant Leap for Free Software

QT Software, under the graces of Nokia, has released the superb QT cross-platform toolkit under the LGPL.

This. is. HUGE.

For the libre software purist, this still benefits you, if indirectly.  Companies that make changes to the toolkit must still submit patches.  More influential, GPL incompatible software may now readily use QT for free.  This will likely foster more QT centric developers, boost adoption of the underlying stack (Linux, etc), and lower the barrier for vendors to release cross-platform tools.

From a Nokia business perspective, it makes perfect sense and makes the whole thing that much more beautiful.  “QT Everywhere” is really a possibility now.  And, it’s beneficial to Nokia as well as the ecosystem they are enriching.  The more QT developers, the bigger the talent pool for Nokia software.  The more contributors, the better the toolkit.  Win.  A small company like Trolltech could not afford to do this, but to a big dog like Nokia, the revenue from commercial licensing is insignificant and unimportant compared to device sales.

I know the company I work for, Analog Rails, will be able to take advantage of the license switch.  Being previous commercial QT customers, it was expensive to juggle around machines to maintain compliance.  For a companies like VMWare that deploy cross-platform software and maintain their own cross-platform extensions, this surely must be compelling.  I say, the more the merrier!

What a great day for free software, computing, and life in general :-) .

Ars Technica has outstanding coverage of the news: http://arstechnica.com/news.ars/post/20090114-nokia-qt-lgpl-switch-huge-win-for-cross-platform-development.html

Political correctness in open source doesn’t matter

See: http://www.itwire.com/content/view/22467/1090/.  To answer the sensationalist title, no.

I can’t believe people are trying to make this an issue.  I guess it was only a matter of time before the crap that we deal with in the rest of the world met up with open source.

I have seen several prominent developers on just the kernel that just happen to be women.  Many more on large projects like KDE.  Great, big deal.  They shouldn’t receive special privileges, recognition, or anything because of it.

“The strange thing about this episode is that it looks like the FOSS community seemingly doesn’t want to know about it.”
No shit.  This kind of crybaby attitude is why governments and large corporations can’t get anything done, too worried about offending people.  Most of us FOSS people are here for the goods, not to set up bureaucracy, politics, and political correctness.

This Gentoo developer is spot on: http://steveno.wordpress.com/2008/12/17/mad-gnu-women/.  The existence of women’s only groups like Debian women are wrong in the first place and harmful.  In the same category as Richard Stallman – well intentioned but counter-productive.

Isn’t the goal to write and use good software?  Gender has nothing to do with that.  Neither does race, color, or being the stereotypical guy that spends countless hours hacking away in the parent’s basement.  Yet we think nothing about laughing at the last.  The world would be a better place if people just grew thicker skin.

How to upgrade to ext4 in place

Here’s how you upgrade to ext4.  The process is pretty easy, but requires an fsck which means unmounting or rebooting if the file system is in use.

Make sure you are using at least e2fstools 1.41.3 and kernel 2.6.28 (or a vendor kernel with latest ext4 patches applied)!  Also, its probably a good idea to have proper backups (really!).  ext4 has just been declared stable, but what that really means is that the battle hardening has just begun.  I’ve done several heavily used systems without fault so far though, so its probably good enough for your desktop.

WARNING: DON’T CONVERT YOUR /boot PARTITION. Right now, there is no stable version of grub with ext3 support.  Even if there was, it really won’t gain you anything  :-) .

Run tune2fs, e.g.:

tune2fs -I 256 -O sparse_super,filetype,resize_inode,dir_index,ext_attr,has_journal,\
extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize /dev/sd[x][n]

Those are the default options for an ext4 file system if you were to create it with mkfs.ext4 (e2fsprogs 1.41.3 – see /etc/mke2fs.conf).  I’m getting pretty damn good performance with this!  The ‘-I 256′ option sets 256 bit inodes, which most recent ext3 FSs use already. If this is the case, and you get a message telling you so, remove this option.  Note that extents will make the FS backwards INCOMPATIBLE with ext3.

Next, edit /etc/fstab, e.g.:

/dev/vg/home /home ext4 defaults 0 0

Either unmount and mount or reboot your system.  tune2fs marks the fs as dirty and performs a fsck and conversion.
NOTICE: distros with initrds may need to be regenerated or you won’t be able to mount your root file system.  In Fedora (replace kernel version with your own):

cd /boot
mv initrd-2.6.27.7-134.fc10.i686.img initrd-2.6.27.7-134.fc10.i686.img.old
mkinitrd initrd-2.6.27.7-134.fc10.i686.img initrd-2.6.27.7-134.fc10.i686.

That’s all there is to it.  Stay tuned for future ext4 developments like online defragmentation.

Also, ext{2,3,4} reserve 5% of space for root in case the drive fills up.  On large modern drives, this can be excessive (e.g: 50GB on a 1TB disk).  Consider running ‘tune2fs -m 1 /dev/sd[x][n]‘ to reduce this to 1%.

For more information and tweaking:

  1. Documentation/filesystems/ext4.txt from the latest kernel sources
  2. http://ext4.wiki.kernel.org/index.php/Main_Page
  3. man tune2fs
  4. http://e2fsprogs.sourceforge.net/