2011w40

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

Identi.ca

It saddens me to say this, but identi.ca, having upgraded to version 1.0 of status.net (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 identi.ca, 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 identi.ca.

Yes, a crashing client is probably not identi.ca’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”.

Vim

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:

bve"ay:s/<CTRL>ra/"<CTRL>ra"/<ENTER>

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:

:s/<CTRL>r<CTRL>w/"<CTRL>r<CTRL>w"/<ENTER>

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

qq:s/<CTRL>r<CTRL>w/"<CTRL>r<CTRL>w"/<ENTER>q

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

Links

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.

Tags: , , ,

6 Responses to “2011w40”

  1. I don’t think it was offlineimap, it is actively maintained.

  2. Patrik says:

    It might not have been maintained when I first looked at it, but given my memory, it might just as well have been something else, but thank you for keeping the record straight :)

  3. Regarding vim and how to extract the value from a search, that’s register ‘/’ the last search pattern.

    More information:

    ;help c_CTRL-R

    Usage:

    Ctrl-R /

    And thanks for your post. Did not know of these CTRL-R tricks before seeing your post, but somehow found the / register before CTRL-W when trying to find more information on how it actually works. Very useful stuff. One note is that CTRL-A is probably better for most people instead of CTRL-W.

  4. Patrik says:

    *smacks forehead* You make it sound so obvious (which it is now that I see it) that the register is named “/”. This is what I love about vim. Once you see it, it is logical. And now that I know about it, it’ll just be natural, I can forget it and still know how to do it the next time I need it. Thank you for that tip (and :help c_CTRL-R)

    And oh yeah, welcome and thank you for posting :)

    I’ll have to read up on C^A — a quick and dirty cursory test in vim didn’t give me a real sense about what the difference between C^A and C^W was.

    Thanks for stopping by, and welcome back :)

  5. Well, I know you’ve got a damn lot more experience with Vim then I do, but isn’t there a plugin called Surround to do exactly that (and more)?

    http://www.vim.org/scripts/script.php?script_id=1697

  6. Patrik says:

    Hi Matija :D

    There is (as evidenced by the link you provided) such a plugin. At work, however, it isn’t always practical to rely on plugins.

    During these first months, when most of my energy and time is spent getting into the flow of the job, these summary blogposts will probably be mostly inspired by stuff I’ve (re-)discovered while working, and which is still generic enough to be worth sharing with people outside work ;)