Vim and long lines
4 December 2013 18:29:11
highlight LongLines ctermbg=red ctermfg=white
match LongLines /.\\%>81v/"
Some months ago I switched to i3 window manager
after discovering a Vim option to highlight column 81. As silly as it may
sound, not easily spotting long lines was one of the biggest reason for not
switching earlier. However, colorcolumn option wasn't perfect. It messed up
using X11 to paste text from Vim.
When I first grew tired to colorcolumn and loads and loads of unwanted
whitespaces in pasted text, I figured I'd use X resources to configure rxvt to
draw column markers. These markers would obviously be completely separate from
actual text buffer. After struggling to introduce X resources in rxvt, I
realised my plan also was flawed; this wouldn't work properly with Vim's
When the time to have a Christmas party at work arrived, I realised I'd have
quality time to work on this again. I patched rxvt with a private set of VT
escape sequences to manage a list of column markers. Adding this functionality
was surprisingly simple and the unminimised patch (without partially
implemented X resources) was just 145 lines. The next step would be to create a
Vim script, or in worst case scenario, patch Vim to send required sequences to
set the markers.
When I was testing my fancy little patch, I came across some settings in Vim
configuration file I had added for highlighting redundant whitespaces a decade
earlier. That's when I realised I could use exactly same thing for highlighting
long lines. It wouldn't be exactly as pretty as my fancy little patch, but
there would be no patching and no compiling.
The next time I think I need to patch some piece of software, I really need to
sit on my hands and think if it's really the only way. That would have a lot of
Permalink | Comments (0)
Linux, SD card readers and HAL
4 September 2013 17:59:31
for future reference, Linux
If your copy of GNU/Linux can't find your SD card in a reader, try running
lshal (which can be found in package hal in Debian) and then
Earlier today I was trying to copy the stuff from an micro SD card, but failed
miserably as the kernel log didn't mention a thing about the card when it was
inserted. Puzzeled, I inserted the card in my cheap Chinese Android tablet and
behold, the stuff was there. I then tried the same card with a Linux laptop
with no success. Baffled, I also tried other SD cards (regular and micro) with
my desktop. None of the cards worked. The card reader appeared as
/dev/sdg and that's all there was for it. At the same time using an
USB adapter for the micro SD card worked perfectly fine.
After asking the almighty Google about this, someone suggested running
lshal as a mean to investigate remotely similar problem. After
installing HAL, running it and grepping the output I saw the card was now
available through /dev/sdg1. dmesg now also mentioned this
"newly" attached device.
Obviouly I've fallen behind after introduction of DEVFS and udev, as I didn't
even think of HAL. In fact, I don't even really know what HAL is. I've known
what it stands for, I've known that for quite some time, but that's about it. I
still find it odd that dmesg didn't list the device until
hald was started (upon running lshal). Also, if HAL was so
crucial part of the system nowadays, why is it marked as optional in Debian? My
understanding here is rather limited, but why did things work so differently
for "plain" USB sticks?
Oh well, immediate problem solved. Perhaps I educate myself about all this
Permalink | Comments (4)
i3 window manager
6 June 2013 09:36:23
I'm in love with "i3, improved tiling
wm", my current window manager of choice. I can't understand how I
managed to live without it for so long.
When I first started using GNU/Linux back in 2000, one of the first choices I
made was picking a window manager. I tried an early version Sawmill (Sawfish),
Enlightenment, Fvwm and others. Eventually I settled with Fvwm which could be
configured to be near-perfect match for me. Even though I had come from Amiga
and Workbench, I absolutely loved focus-follows-mouse, virtual desktops and the
pager, the ability to bring windows to front and sending them background by
simply clicking the frame and so on. As time went by, I added more obscure
commands to move and resize windows and removed all but one widget from the
Even though I was mostly happy with Fvwm and Fvwm2, I often ended up opening
far too many terminals for tasks that were only supposed to take seconds. My
usual workflow to use several desktops and organise stuff accordinly usually
worked well because I only had one or two overlapping windows on each desktop.
With one-shot windows, however, I sometimes had to hunt for that one terminal
with Vim put in the background. Furthermore, this helped me to form a habit of
typing "fg" whenever there was no Vim running on that terminal.
Clearly there was something wrong.
Eventually I was introduced to tiling window managers. I loved the idea and
tried a few, namely xmonad and wmii. I decided to skip awesome for naming
reasons and ion because of the author's attitude. These experiments confirmed
that I liked the concept, but could not switch because I was so fixed
with having a terminal window limited to exactly 80 columns. This was because I
believed (and still do) that no line of code should have to be wider than 80
columns or there was something wrong with it. Yes, even with 8-column
indentation. If there wasn't an option to force certain windows to certain
size, this would be a showstopper.
As time passed, I came across a Vim option (colorcolumn) to highlight given
column. Even though the option made pasting stuff over X a bit more cumbersome
(as each line would have whitespaces at the end of each line), I started using
this option. Some time later I heard about i3 and decided to give it a go on my
home computer. Configuring i3 took almost no time and with this newly
discovered Vim option, I was happy. When I realised that I could make certain
window classes to always be floating I was even happier. These always floating
windows would only be used to very temporary stuff such as showing feedback for
keyboard shortcuts that controlled command line applications.
Point of no return
After a few months of running i3 on my home computer, I started using i3 on my
work computer as well. This was one of the best choices I had made for quite
some time. i3 on dual screen setup was even better than i3 on a single screen.
It wasn't just good, it was absolutely brilliant. I could easily change focus
between two screens, change the content of either screen without touching the
other, move focus between windows intuitively and efficiently, open a persistent
"scratch" terminal anywhere and hide it again - all with a single
keyboard shortcut. I could still sends number of Vims in the background, but
now there was little need to do so. Right now my only regret is not trying this
I'm sure my honeymoon period with i3 will have to come to an end, but right now
I couldn't be happer with my decision. Much like with Ruby, all the pros easily
outweight the cons. Do yourself a favour, have an open mind and give i3 a go.
Permalink | Comments (0)
SID of the day: Good Enough? by Stellan Andersson (Dane)
7 April 2013 20:08:18
SID of the day
Good Enough? by Stellan Andersson (Dane)
Stellan Andersson (Dane) is my new hero. Seems that every time I go through new stuff on
HVSC, I find something new from Dane
that I love. Similarly, much of the time when I listen to my favourite SIDs,
these gems by Dane really get my attention. Enjoy.
Permalink | Comments (0)
ruutu-dl - Tool for downloading video from ruutu.fi and jimtv.fi
7 April 2013 16:52:10
ruutu-dl is a tool for downloading video from ruutu.fi and jimtv.fi. It's a
Ruby script that implements ugly spawn-kill loop around flvstreamer. On
author's setup, flvstreamer would stall every few megatypes and rtmpdump would
produce large and broken video file. Read more or grab the latest version.
Permalink | Comments (0)