ttf-dejavu 2.37 forced update

So I just got back from my trip to Belgium and the Netherlands and I had a whale of a time.

Upon my return to my faitful linux desktop though (by the way, did you know that Linux distros have surpassed 2% of total market share for four consecutive months now? itshappening.gif), I was greeted by this Arch Linux News article and this blog post. A simple sudo pacman -Syu wasn’t going to cut it this time.

So most of you probably already fixed the issue, but there might be people out there who don’t have pacman helpers installed to automatically check relevant news updates (I use pacnanny by the way, but there are others). In such cases, a regular -Syu update which contains the ttf-dejavu v2.37 patch will cause this set (or a very similar one) of pacman errors:

error: failed to commit transaction (conflicting files)
ttf-dejavu: /etc/fonts/conf.d/20-unhint-small-dejavu-sans-mono.conf exists in filesystem
ttf-dejavu: /etc/fonts/conf.d/20-unhint-small-dejavu-sans.conf exists in filesystem
ttf-dejavu: /etc/fonts/conf.d/20-unhint-small-dejavu-serif.conf exists in filesystem
ttf-dejavu: /etc/fonts/conf.d/57-dejavu-sans-mono.conf exists in filesystem
ttf-dejavu: /etc/fonts/conf.d/57-dejavu-sans.conf exists in filesystem
ttf-dejavu: /etc/fonts/conf.d/57-dejavu-serif.conf exists in filesystem
Errors occurred, no packages were upgraded.

Read the linked news and blog articles above for more information, but if you’re in a hurry, what you need to do is force-upgrade the ttf-dejavu package separately - either before or after updating the other packages. Here’s what you need to know:

  • to upgrade everything except for the ttf-dejavu package, do pacman -Syu --ignore ttf-dejavu
  • to force-upgrade the ttf-dejavu package separately, do pacman -S --force ttf-dejavu

There you go, hope I saved someone out there a few minutes ;-)

Window management in vim (+ vim as a translation tool)

Everyone’s favorite text editor (vim) adheres nicely to the UNIX philosophy of doing one thing well. That one thing that vim does exceedingly well is of course editing plaintext. A corollary of this is that vim users tend to keep things comparatively simple when editing text (the key word here is comparatively, as in compared to users of other editors and IDEs – I know your vim config is hundreds of lines long, but you’re still just editing plaintext).

For example, 90% of my own time in a vim instance is spent inside a single window, as I edit just a few buffers, then open and close more as I go along. Of course, I tend to have at least half a dozen such vim instances open at any given time and have delegated a lot of what IDEs usually do to my window manager and UNIX environment, but this is par for the course and I digress.

Still, if 90% of my vim time is “vanilla”, that leaves 10% of it for occasional fanciful flights into the spectacular. Sometimes you want to do a little more than just opening a buffer, editing it and writing to it. Sometimes it just doesn’t cut it to have several terminal windows open, each running vim.

scroll-locking two buffer windows

It doesn’t happen terribly often, but sometimes you need multiple windows. And vim actually has pretty good window management, allow me to show you.

Read More

kbwarrior 0.4.0: more shortcuts and eye candy

Just a quick update about kbwarrior, my keyboard-browsing extension for chrome/chromium. I know most of my readers (well, more like all of you who get here by googling for JavaScript, vim or linux stuff) prefer my tutorial-style articles, and I’ll do some more soon enough, but I just really enjoy posting my changelogs here.

kbwarrior screenshot

So, since last week’s changes, here’s what’s new:

  • A nicer and more consistent look for the hints
  • g and G shortcuts to scroll to the top and bottom of the page
  • Shift + backspace for going forward in history (it is a little strange, but I feel like it makes sense if backspace is a backward jump)
  • q to close the current tab
  • Better detection of input fields so the shortcuts should interfere much less often
  • Link hint mode now includes clickable buttons
  • Holding shift when typing the hints opens links in a new window
  • You can now also cancel hint or insert mode with the ESC key or, my personal favorite, Ctrl+[
  • YouTube was added to the disabled sites list

The one thing that’s still bothering me is how some of the keys interfere with page-specific shortcuts. My non-solution of disabling them on such websites is clearly unsatisfactory but I’m not sure how to handle it without greatly increasing the complexity, which would run diametrically against the whole reason for why I made this in the first place. I’ll be focusing on some other things for now, but I hope it’s useful for someone out there. I know it is for me ;-)

kbwarrior: yet another chrome extension for keyboard-based, vim-style web browsing

I like vim. No really, I like like vim. I like it so much I want my web browsing experience to be more like it. Quite a few people feel the same way it seems, because there are a lot of options when it comes to Chrome/Chromium extensions that add some vim-like features to the browser (not to mention conkeror, Vimperator or Pentadactyl, the Firefox add-ons that started it all):

And my apologies to the authors of the other extensions out there with similar feature sets.

So with all this out there, why the hell did I go and write my own? Well, for one I just wanted to try my hand at writing an extension. But also, while a lot of great work has gone into the above tools, I always felt like either something was lacking or too much was going on. Either it didn’t have a certain feature I wanted, or something kept getting in my way while browsing (or, horror, it forcibly implemented smooth scrolling everywhere).

Thus was born my own addition to the chromiverse: kbwarrior. I’m not sure what I was thinking when I came up with the name but hell, I’m sticking with it since Google made me design a logo for it to put in the web store and, considering my GIMP skills or lack thereof, I’m not exactly jumping to do that again.

kbwarrior logo

kbwarrior is limited in its feature set but does exactly what I want it to and nothing more (or, at least, it will once I’m done building it). This is what it does for me and what it could do for you as well:

Read More

Upgrade your terminal with bash functions for matching text in filenames or contents

Everyone knows about aliases, but what about bash functions? In this article, I’ll explain how to make and source your own bash functions and show you how they can increase the versatility of your terminal.

The problem we’ll solve here is a threefold one and concerns finding files in a certain directory, and doing things with said files. In particular, we would like to:

  1. get a list of files, the filenames of which match a given text pattern
  2. get a list of files, the contents of which match a given text pattern
  3. do things with the above lists of files

Now, if you’re bash (or zsh or fish or whatever) savvy, you might know how to do these things on the command line already using the tools that come with any bash or bash-compatible shell environment:

# 1. match "potato" (case insensitive) in filenames within the current dir
find ./ -iname "*potato*" -print
# 2. match "potato" (case insensitive regex) in file contents within the current dir
grep -Ri ./ -e "potato"
# 3. match and run `ls -l` on results
find ./ -iname "*potato*" -exec ls -l '{}' +
find ./ -name "*potato*" -print0 | xargs -0 ls -l # a very common variation of the above, works just in case your `find` doesn't have the `-exec` option
grep -Ri "$1" -e "potato" -lZ | xargs -0 ls -l

Read More