Posts Tagged ‘Vim’


Sunday, July 22nd, 2012

So apparently just looking at an (web)article of a newspaper (or any web page containing copyrighted content) could mean you are infringing on that publishers copyright… do newspapers actually want to commit that kind of suicide?

I couldn’t decide whether to put this post under “Copyright” or “Censorship” since it involves the MAFIAA using the DMCA to silence things… in this particular case, it would seem, their members own marketing campaigns… With friends like the MAFIAA, who need enemies? :)


Portable electronic device, method, and graphical user interface for displaying electronic lists and documents now, how could this not apply to every type smartphone, pad, dumb-phone or, for that matter, laptop, in existence? How can such a patent even be granted?


Censored by copyright for protesting being censored by copyright, somehow I don’t think that this was how laws were intended to be used when humanity first came up with the concept of rule of law…

Who would have thought that filtering the net may affect more than the specific group targeted by the filter? That’s impossible right?


Facebook is being creepy as hell as usual.

Apparently, Microsoft’s SkyDrive comes with some strings attached


The European Commission intends to make open access all research findings funded by Horizon 2020. This is nice :)
Dunno if EC or UK was first, but UK is thinking along the same lines.

On the other side of the spectrum, i.e. not so nice, if things really are as dire as President Obama would have people believe, wouldn’t the responsible thing to do then, be to secure the infrastructure the hell up, instead of passing laws which any would-be imaginary-or-real terrorist would ignore?

I mean, one of the most idiotic plots in “24” was that nuclear power plants could be remote controlled over the internet. Or in Die Hard 4, that with a couple of taps on a keyboard, the bad guy could redirect a whole bunch of gas to go to the same place at the same time, building pressure, making big badaboom…

Now, if the infrastructure in fact support doing this, remotely, then those who put that in the specification, and those who produced it, and those who installed it, should all be found and tried for dangerously criminal negligence.

Of course, if the end game is to hollow out personal privacy and spy on your own citizens, then it would be better to nibble away on their rights through more new and ineffective laws, which can always be extended later when proven (through a real enemy, someone just being curious, or a false flag operation) not to work.

Justice Department sues telco for daring to challenge its secret demands for private information.


Targeting Shell with a fake PR campaign. I wonder how long it will be until lobbyists have bought an amendment to some law labeling this sort of activism as terrorism…

Join the Internet Defense League and make sure the internet never loses. Ever. Or, put another way, Rescue the lolcats from the evil clutches of the internet hate league!


Blooie lets you chat online with people who like what you like I am just a tad bit sceptical about this one…

On the one hand, getting in touch with people who like what I like, Free Software, Programming, vim, etc. etc. Great! Buuuuut, how is this not willfully and intentionally putting yourself inside a filter bubble, and only exposing yourself for the types of opinions you yourself already hold? If two people say the same thing, isn’t one of them redundant? I remain a little unconvinced.

Command line

At work this week I needed to get a file from server1 to server3, and the only connection between the two was through an intermediary server, server2. Oh yeah, the only way to communicate between the servers where ssh. Sure, a three step approach was possible (scp file server2: ; ssh server2; scp file server3: ) but the file on server1 could get updated at times, which would mean yet another upload, so a simpler process was needed, a shell script with something along the lines of this:

cat $file | ssh user@server2 "ssh user@server3 \"cat > $file\""

Thanks go to pesa for coming up with the solution.


TMSU is a program which allows you to tag your files, and then perform queries on the tags, filtering out all files not tagged according to the queried constraints. Neat!

ownCloud is getting more interesting with every passing day.

I never really thought about the fact that you could do lots of things with locate such as adding flags, or configuring directories or files to disregard.

I found an expect-like utility named empty. Funnily enough I found it by checking out the examples of the Zenity fork: Yad.

Cuttlefish: Execute actions when specific events are triggered.

I am also currently trying out this vim statusline.

Throught this question I learnt about fold.


Really nice ELI5 article about how flood fill works, using Zombies and Cats, and Python.

Reading this post and seeing the example resume I agree that what catmoon ponders about would be pretty cool.

Of course, the program should know what skills I have, and only select the relevant out of that set, based on the skills extracted from the job listings. At least that’s how I’d design it, as there is no good reason to lie about what you know and don’t know.

And now I finally grasp how two create quines!

When you screw up, and commit sensitive data to a git repository, this seems like a rather good way to handle it.
Oh and of course, if that sensitive data was a password, CONSIDER THE PASSWORD COMPROMISED AND CHANGE IT!

I had heard about the “Rosetta Code” before, but never got around to checking it out until this weekend, which is when I found this rather intriguing piece of Perl code.

I have to admit to being rather impressed about what one can do with html/css/javascript and some javascript libraries these days.

And although very cool, I still have yet to find a personal use for PhantomJS :/

Text books used in education should be written like this.

Other news

RasPies can now be ordered in bulk.

Here’s to the misfits.

Dunno what it’s good for, but it is pretty.

Stochastic, nerdtastic restaurant bill splitting.

Astronomy Picture of the Day har a pretty sweet image this week.



Sunday, July 15th, 2012

This week just flew by like a chinchilla with a rocket strapped to its back, but I managed to squeeze in some good laughs and some programming so all in all not too shabby week at all.

Glenn Greenwald: How America’s surveillance state breeds conformity and fear A rather long text (likely due to it being a transcript of a speech) but none the less both fascinating and horrifying at the same time.

And Russia doesn’t seem to fare much better, as Russian Wikipedia goes on strike over censorship plans

(Please note that I’m not trying to single anyone out, I don’t believe for a second that Europe or Sweden is one bit better than their neighbours)

I found a rather depressing thread on reddit where the OP works for a research organization and they have just received a job from the US Gov to carry out a questionnaire (with apparently very directed and leading questions) with the perceived objective to make Americans answer that they are ok with the government collecting data, since, if you can just get statistics saying that others find it ok, you can get the masses on board with the idea as well… Also related: push polls

This is a textbook case of why anonymity still has a place in the world. There were no malice involved here. This was an accident, but if it hurts even one of the outed persons that’s still enough. And that’s why databases, unnecessary or not, should be kept to the bare minimum. Because databases will always leak.

It’s possible that some of the people whose identities were revealed in the email could face workplace sanctions for opposing ACTA (I know a lot of people in the entertainment industry who privately oppose many of their employers’ initiatives), so revealing their identities is a potential big deal.

This ties back to surveillance states breeding conformity (and fear, but in this case the fear of retaliation already existed) because fearing sanctions people may stop speaking up, leading to other people, hesitant, undecided, to think that there must be nothing wrong since no one is speaking up. Conformity.

Although we can always trust in Falkvinge to come up with sensationalist blog posts, in this case I fear he might be right on the money.

With Facebook scanning chats for potentially illegal activities, I wonder how they would react if someone wrote a facebook app which encrypted the conversations between people (preferably through a javascript so the communication is encrypted browser to browser).

I found a fairly decent guide to regular expressions (the only thing which would make it better was if it wasn’t a “cookbook recipes” kind of post, but instead a “learn regular expressions with examples” type of post. But the recipes are broken down into parts and explained and that is really nice, and that’s why I’m mentioning it. A for effort :)

A post about vim completions which I should take to heart and start using more than I already am.

And if you have a non-technical friend who wishes to understand more about UNIXy systems, but would get information overload by non-abstracted techno-babble, my suggestion would be to direct them to Unixmages.

I happened to do something stupid in vim the other day, I pressed C^s, and I think I pressed it believing it would save the contents… C^s in a terminal doesn’t save anything… It will however suspend scrolling (I guess scroll-lock is the most aptly named description) but for all intents and purposes, this the first time it happened to me, I thought the terminal had frozen and I ended up running an xkill on that terminal window.

Today I thought I’d investigate it a little further, and upon doing so I realized that it is an intended feature which could even work at bootup, which I will certainly test the next time I’m booting the system and seeing some weird error message flash by.

Oh, and to “restore” the terminal, make it responsive again, C^wC^q is your friend.

Finally, a vim story which isn’t exactly my story, but close enough that I recognize myself in there :)

Update: Thanks pesa for pointing out the typo, C^q is the correct one


Sunday, June 24th, 2012

Quite a while since I wrote a post now, I’ve not been sick or anything, but there has been a lot of work abound, and outside work I prioritized sleeping over writing. But now I’m back for the moment, so let’s get down to business :)

Since last time I’ve come up with new ways of abusing awk, such as having it find the highest value from a command outputting in the following syntax:

\t<characters, integers, fullstop>: <integer>\n

To make it a little more different, the command also spits out a header, as well as an additional newline after the end of output.

I just now, while writing this, came up with a different solution, which doesn’t use awk:

theCommand | grep -v '^[^ \t]\+' | tr -d ' ' | cut -d':' -f2 | sort -r | head -n 1

but what I ended up using was:

theCommand | awk 'BEGIN { highest = 0 } $0 ~ /^[ \t]/ { if ( $2 > highest ) { highest = $2 } } END { print highest }'

In this case, from what I can gather, awk is the more efficient solution. One process versus five.

Update: As Werner points out, the if statement isn’t really necessary (which also makes it possible to cut out the BEGIN statement as well):

theCommand | awk '/^[^ \t]/ && $2 > highest { highest = $2 } END { printf "%d\n", highest }'


  • ditaa (a.k.a DIagrams Through Ascii Art) makes it easy to generate nice-looking diagram images from… rather nice-looking ASCII diagrams
  • docopt, a command-line interface description language, which also seems to support generating the parser for the CLI being described
  • Peity for generating different types of charts using jQuery and <canvas>
  • interacting with web pages, programmatically

As of late I have been thinking a great deal about backups and the project which seems the most interesting to me is Duplicity.

Random tech stuff

Other random not-so-techy stuff

What I pass for humour



Sunday, March 18th, 2012

This week has been filled with all sorts of fun and challenging stuff.

For one, I used Wireshark to (successfully) diagnose a problem for the first time :D

The problem was an overly restrictive iptables rule on the system I was trying to connect to, but boy did it feel good to identify and solve that problem on my own.

I also managed to squeeze in time to write scripts to two work buddies so that they didn’t need to perform overly repetitive and very error-prone tasks by hand. The one script even needed a little bit of Expect-scripting, which I’ve been aching to hack some more.

I also found out about vim‘s :e # (to try it out, open a file in vim, then :e someOtherFile followed by :e #)

I found a very pedagogic explanation about how quicksort works, which made me start thinking and wondering about algorithms in general again, even to the point of investigating quicksort further.

I also found this post which makes a fair point: IFF you are going to rely on a web service (in other words, a SaaS you are probably better off getting hooked up with one charging money for it.

Not that I could ever conscionable recommend anyone using a SaaS as this is bound to lock you into dependence of that provider, but sure, I get that some (most?) would rather throw money at it than learning (learning is scary, and you don’t have the time right?) to set up your own service.

Furthermore, I can’t really decide whether the author is being disingenuous or illiterate in naming this stance an “anti-free-software movement”. It is unclear if s/he meant “anti-gratis-software movement” or if s/he is actually feeling threatened by free software. Had there been a comment field on that “blog” I probably would have spent the two minutes required to ask, but since there isn’t one, I won’t bother, and on pure principle, if I ever need a bookmarking-service, I’ll just make sure to stay clear of that one, just in case s/he actually was taking a jab against free software.

Yes, I am petty and vindictive at times, shit happens.

Whilst toying with the idea of modifying my homepage a bit, a site wide change, I realized that it might make a lot of sense to rewrite it so that it is, if not template-based, at least modularized. But I guess I’ll continue thinking about that before making any changes.

A funny thing I just thought of out of the blue the other day was that with some sites, like LinkedIn and probably Facebook and others, there are options for giving these services your email account username and password, so that they could log in, check your contact list, and hook you up with other people you know.

But I am pretty sure that most email providers license agreements state (no, I haven’t checked, but it would be foolish of these mail providers not to) that it would be a violation of said agreement for the user to disclose their account password to anyone else.

Then again, I don’t really understand people who would use those tools, but I guess there are even more people who wouldn’t understand why I chose not to…

A very interesting read about the Batman and the Joker. Those who know me can probably guess what character I voted for.

I’ve also been thinking about the prospect of storing binaries in some sort of version control, mostly because I have a friend who is into game development/modding, and doing so without version control. And that has bitten him in the ass more than once now.

And since I am nowadays a git convert I naturally started looking there, and found this, which lead me, among other places, here. Haven’t tried it yet, but it is definitively an interesting idea.

And now that I have begun working with Wireshark, tcpdump seems to be a good next step.

Finally, yet another reason why the patent industry needs to change.



Sunday, February 12th, 2012

Update: Ooops, I guess we gone incremented the year again… and no one thought to tell me :(


It’s comforting to know that the people we elect to rule us at least know what they’re doing… Oh… wait…

git and branches

Last week, for the first time, I think I groked branches. The headline mentions git branches, and if they are different from other VCS’ branches, then last week I think I groked git branches :P

I’ve known about branching for quite a while, but never gotten past anything other than a rudimentary understanding.

I think I understood how mercurial does it (simply clone the repository, name the root directory of that clone to whatever you want to call that branch, and presto. (And yes, I am aware that mercurial has a branch command as well, so my understanding on that point is probably incorrect).

Either way, what finally gave me an “aha”-moment was this blogpost.

And while one the subject: Other uses of git. I am going to take a closer look at especially Prophet.



No but seriously, frakking do it. Automation ftw.


Sunday, February 5th, 2012

Update: Ooops, I guess we gone incremented the year again… and no one thought to tell me :(

TPP (yet another ACTA-type thingy)

Here we go again…. But it seems there is at least one intelligent/regretful person to have realized the error of her ways from last time.

I am fearful however that we are going to have to suffer more shit like this until we eradicate the “entertainment industry” (peacefully of course, vote with your wallets people!)

Because really, would you want this to be the future?

I am not in any way, shape or form serious about the following suggestion: We could of course present the internets the way the “entertainment industry” wants it, to them at least, already today. But I do love this type of humor :)

And with all these new moronic laws running rampant and frakking up the internets, this begs the question: What happens to your files when a cloud service dies? — personally I would have replaced “files” with “data” but whatever, still a worthwhile read.

Before closing the book on the subject of copyright for this time… If you’re a photographer (well, I guess, as we’ve seen with Apple/Samsung, this applies if you are a hardware designer as well): don’t take photographs which are too similar to other photographs

Educational Games

This game was both fun and, at least to me, innovative. Just a wee bit too slow for my netbook, but a real treat if it could inspire someone to start programming :)

SEC — Simple Event Correlator

I don’t really remember what I was looking for when I find this, but I was almost immediately intrigued. Now, I had to read through that first paragraph on their web page a couple of times, and then still read the two excellent tutorials before I figured out what I could use it for, and I think I can express that shorter: look at logfiles, if X happens, execute command Y.

It is a little more complex than that, like if X happens, but A doesn’t happen within a specified time window following X etc.


This is an interesting initiative which seems to have it roots here and is now maintained on github.

I think the wording of the text regarding governments is a bit inflammatory and could probably be misconstrued, deliberately or otherwise, and turned into a weapon against the initiative itself.

Personally I’d have preferred either to have the wording changed, seeking instead to inspire and educate (yes I know, presumptuous of me to believe I hold the truth) our fellow citizens, or at the very least change the wording into something less misinterpretable.

We should hold those we have elected to govern us at higher standards, instead of not reacting at all, letting them off the hook as it were, whenever they err on the side of dishonesty and/or corruption.

I don’t feel I can really put my signature on that text as it currently stands, but I think I’ll remix it to something I can stand for.

If nothing else, the most interesting idea I got out of it, was the addition of “points of interests” links and IP addresses (see the github page for that). There are some services on there which further makes me unable to put my name on that document, but hoarding IP addresses, and mapping them to domain names, is interesting…

More on this later, when I have thought some more about it.



Sunday, January 1st, 2012

Merry belated christmas greetings everyone! And by the time this post is published I could extend it with Happy belated new years greetings as well ;)

vim + html5 syntax

I’ve been tinkering a lot with html5 during my vacation and vim just didn’t want to play nicely with the new html-tags.

Namely, as it wouldn’t recognise the new semantic structural tags (footer, header, article, section, nav, aside) it wouldn’t indent the source properly and it was a cause for both distraction, and the resulting frustration.

I was not the first to feel this frustration, and a quick search turned up this result which solved both the html and css syntax issues (check the comments for the css solution). Very elegant solution, and now I’ve also learned about vim’s .vim/after/ directory… That was pretty cool.

Learning html5

I’ve actually shied away from doing stuff with html5, as whenever I tried to wrap my head around the new tags and how they should be used, there were just a myriad of different sites interpreting the usage in subtle but differing ways, but I finally found a resource which makes sense to me, so until a definitive interpretation has been hammered out, that’s the one I’m going to stick with.

Also, for sticky footers using css, and html5, check out this page. I had no trouble getting that to work.


This question pretty much sums up why I like the command line so much

This looks interesting for synching (and deleting) without having to worry about doing “the right thing”

Nice list of things one could do with a home server

Doing it for teh lulz, 1903 style

EA, Nintendo and Sony now only covertly support SOPA (through their membership in various interest organizations). Wanting to eat the cake and still have it huh?

Tom’s Hardware not being amused by SOPA

Oh how I so hope that Wikipedia, Google, et al, will go down this path. (I do think there is a difference between companies lobbying, writing laws, and pressuring governments, and companies urging people to put pressure on governments, so yes, I think this is ok)

An interesting theory about why cinemas are having such a rough time

Haven’t had a chance to try this, but creating art using a written grammar does sound pretty neat, especially if you could get a script and /dev/random involved as well ;)

German police tracking people via silent SMS. I am beginning to think that rms is correct in his cellphone “usage”

Too much reading and constant information overload makes us pretty little passive consumers

My Software Stack 2011 edition

Saturday, December 31st, 2011

I realize that I haven’t written my customary “software stack” post for this year yet. But hey, from where I’m sitting, I still have … 36 minutes to spare ;)

I’ll be using the same categories as last year; system, communications, web, development, office suite, server, organization, and entertainment.


The OS of choice is still Archlinux, my window manager is still wmii, my terminal emulator is rxvt-unicode, upgraded by also installing urxvt-tabbedex.

My shell is still bash, my cron daemon is still fcron, and my network manager is wicd.

To this configuration I’ve added the terminal multiplexer tmux, and have lately found out just how useful mc can be. Oh, and qmv from the renameutils package is now a given part of the stack.


Not much change here, Thunderbird for email, Pidgin for instant messaging, irssi for IRC.

Heybuddy has been replaced by identicurse as my micro-blogging ( client. Heybuddy is very nice, but I can use identicurse from the commandline, and it has vim-like bindings.

For Pidgin I use OTR to encrypt conversations. For Thunderbird I use the enigmail addon along with GnuPG.

This means that Thunderbird still hasn’t been replaced by the “mutt-stack” (mutt, msmtp, offlineimap and mairix) and this is mostly due to me not having the energy to learn how to configure mutt.

I also considered trying to replace Pidgin with irssi and bitlbee but Pidgin + OTR works so well, and I have no idea about how well OTR works with bitlbee/irssi (well, actually, I’ve found irssi + OTR to be flaky at best.


Not much changed here either, Firefox dominates, and I haven’t looked further into uzbl although that is still on the TODO list, for some day.

I do some times also use w3m, elinks, wget, curl and perl-libwww.

My Firefox is customized with NoScript, RequestPolicy, some other stuff, and Pentadactyl.

Privoxy is nowadays also part of the loadout, to filter out ads and other undesirable web “resources”.


In this category there has actually been some changes:

  • gvim has been completely dropped
  • eclipse has been dropped, using vim instead
  • mercurial has been replaced by git

Thanks in no small part to my job, I have gotten more intimate knowledge of awk and expect, as well as beginning to learn Perl.

I still do some Python hacking, a whole lot of shell scripting, and for many of these hacks, SQLite is a faithful companion.

Doh! I completely forgot that I’ve been dabbling around with Erlang as well, and that mscgen has been immensely helpful in helping me visualize communication paths between various modules.

“Office suite”

I still use LaTeX for PDF creation (sorry hook, still haven’t gotten around to checking out ConTeXt), I haven’t really used sc at all, it was just too hard to learn the controls, and I had too few spreadsheets in need of creating. I use qalculate almost on a weekly basis, but for shell scripts I’ve started using bc instead.

A potential replacement for sc could be teapot, but again, I usually don’t create spreadsheets…


Since I’ve dropped mercurial, and since the mercurial-server package suddenly stopped working after a system update, I couldn’t be bothered to fix it, and it is now dropped.

screen and irssi is of course always a winning combination.

nginx and uwsgi has not been used to any extent, I haven’t tried setting up a VPN service, but I have a couple of ideas for the coming year (mumble, some VPN service, some nginx + Python/Perl thingies, bitlbee) and maybe replace the Ubuntu installation with Debian.


I still use both vimwiki and vim outliner, and my Important Dates Notifier script.

Still no TaskJuggler, and I haven’t gotten much use out of abook.

remind has completely replaced when, while I haven’t gotten any use what so ever out of wyrd.


For consuming stuff I use evince (PDF), mplayer (video), while for music, moc has had to step down from the throne, to leave place for mpd and ncmpcpp.

eog along with gthumb (replacing geeqie) handles viewing images.

For manipulation/creation needs I use LaTeX, or possibly Scribus, ffmpeg, audacity, imagemagick, inkscape, and gimp.

Bonus: Security

I thought I’d add another category, security, since I finally have something worthwhile to report here.

I’ve begun encrypting selected parts of my hard drive (mostly my email directory) using EncFS, and I use my passtore script for password management.

And sometimes (this was mostly relevant for when debugging passtore after having begun actively using it) when I have a sensitive file which I for a session need to store on the hard drive, in clear text, I use quixand to create an encrypted directory with a session key only stored in RAM. So once the session has ended, there is little chance of retrieving the key and decrypting the encrypted directory.

Ending notes

That’s about it. Some new stuff, mostly old stuff, only a few things getting kicked off the list. My stack is pretty stable for now. I wonder what cool stuff I will find in 2012 :D



Sunday, November 20th, 2011

First of all: this is really disturbing.

Commands and flags

I think I’ve already mentioned watch, and how that could be useful at time (e.g. $ watch -n 10 -d 'ls -l')

I just found out about a value which can optionally be appended to the -d flag: -d=cumulative

It has its own flag as well --cumulative, and quoting the man-page it makes highlighting “sticky”, presenting a running display of all positions that have ever changed.

Also, this week I learnt about sdiff, which seems neat if you’re on a system which doesn’t have vim (and thus vimdiff) installed.

Anoter nice flag I just found for grep is -m <int> which tells grep to stop looking after the INT first matches.

Scripting Vim

Ok, so I’ve been running into this problem where I am using my own .vimrc configuration in other places, in systems where the vim version isn’t the same as the one I use myself.

This has proven problematic as some of the configuration options I use (most notably set cul (which gives me a better indication about which line the cursor is on)) doesn’t exist in … say a vim version less than 7.

Which meant that if I loaded the same .vimrc config on a system running a vim version earlier than 7, I’d get a warning at startup, which I’d have to press enter to pass by. Irritating.

As luck would have it, it isn’t all that difficult to make a little conditional to check which version is currently loading the config and just ignore the settings which won’t work for that version, such as:

if v:version >= 700
    set cul


Finally, at this years FSCONS I was introduced to the site where people can go to either contribute CPU-cycles, or get CPU-cycles, (or both) to help speed up rendering.



Sunday, October 9th, 2011

This week I got to do some real work! Felt really good being able to start contributing back. :D

It saddens me to say this, but, having upgraded to version 1.0 of (or is it laconica? iunno *shrug*) more or less sucks.

Now, I know how extremely easy it is to jump on the hate bandwagon, to just do what everyone else is doing, and I admit, several others have brought forth some valid critique, e.g. the new incomprihensible threading crap, renewed incentive for spammers to be on, etc, but for my own part I’ve noticed it most prominently due to my third-party client being slowed to a crawl and crashing repeatedly while trying to use

Yes, a crashing client is probably not’s fault, but hey, it worked well enough before the so called “upgrade”.

Do we, as a society, really have such a raging hardon for “innovation” and “new shiny stuff” that we’d rather break something which is working, to have something new, than stay stable?

I remember looking at an email tool (could it have been offlineimap? Probably not as it is actively maintained, thank you Luke :)) and reading comments about it, someone stating that “oh, you can’t use that, development has ended, it is stagnant, abandoned.” I.e. there wouldn’t be any new versions… oh the horror. . .

If a software has met all the sought goals, the project can go down one of two paths:

  1. go into maintenance mode, only releasing updates upon discoveries of bugs or when something (a protocol or whatever) is updated, and the software needs to support that as well, or
  2. bloat up with new crap which it was never intended to handle

Yes, I am a huge supporter of the UNIX philosophy. Separation of responsibility is a good thing.

But anyway, I won’t be abandoning it, I might lower my usage of it, but I won’t increase my presence in some other “social media”.


For some reason or other, I found myself wanting to put quotes around a word which the cursor was presently centered on.

Now, the simple way (which is much quicker if you are just going to be quoting a few words) is of course just to use navigation commands to get to the front of the word, enter insert mode, input a quote, exit insert mode, move to end of word, enter append mode and insert a quote, rinse and repeat.

But I wanted to do it the the longer, more automated way (not that I had a whole lot of words in need of quoting, I just had one, but it was more about the learning principle than efficiency at that point).

So I thought up:


Basically, what you do is go to beginning of word, enter visual mode, go to end of word, copy the selection into a named buffer (a), enter command mode and issue a subsitution command in which the selection is pasted in both the find and replace fields, but in the replace field surrounded by quotes.

It works, you can record a macro to perform these steps so that you only need to place the cursor on the correct word and call the macro.

However, I started wondering if there wasn’t a way to extract the value from a search. I.e. if you put the cursor on a word, and hit * you’ll tell vim to find all occurrences of the word under the cursor. This must mean that vim somewhere stores the sought after word.

I never found a solution for that, but I did however find a shortcut:


This one simply takes the word presently under the cursor, and pastes that. This too, works with macros, i.e.:


This little “quotifier” is now stored in macro buffer q and can be accessed by pressing @q in command mode. :D


Node.js is cancer — whether or not you agree, it is still a thought-provoking read.

mscgen — I’m not sure how well I have been able to communicate that I like source code. I like being able to compile stuff or script stuff so that I can have reproduceable results. mscgen, I believe, uses graphviz to generate Message Sequence Charts, and I played around with it a bit this week when trying to outline how my little “brushing up on Erlang-project” should communicate internally.

All in all I have to say that it performed admirably.