Improving Vim auto complete for CSS class names

Just a quick tip about Vim autocompletion.

I’ve been using the excellent SuperTab Vim Plugin for a couple years, it works reasonably well (autocompletes based on words from all buffers, file names, tags, context, etc…) but it doesn’t work really well for text that is split by dashes - CSS contains lots of these… - so I started to get frustrated with it.

You can change the auto complete behavior with set iskeyword which also changes the behavior of standard motion commands like w, e, b (it changes the word delimiters) – which a find a PITA since I got used to these motions. My quick and dirty solution to the problem was to keep iskeyword with the minimal value as possible and only change it during InsertEnter. That way I can still use cw, ve, db to edit each fragment, autocomplete will work properly for words like foo-bar__baz, and you can still use W, B and E if you want to quickly jump around. For me that’s the best of both worlds!

Read more…

Tags: , ,


statline : Improved Vim statusline

I switched to Vim a few months ago and been reading other peoples’ settings and trying to customize it to my needs since then. Yesterday I couldn’t sleep so I decided to write my first simple “plugin” (not really a plugin, just a few settings..), it adds some cool/useful features to the vim statusline.

Here is a basic screenshot:

One of the advantages is that it adapts to the color scheme without needing any extra settings (but you can customize it easily if needed). The source code have enough comments and is split into individual blocks making it easy to add/remove things if you need. It also checks for trailing white spaces and mixed indention. (optional)

For more info check the project repository on Github and read the documentation. Please report bugs and feature requests though github issues.

That’s it!