Archive for March, 2010
Ever find yourself in vi(m) with a piece of code that needs some editing, but to preserve your paste buffer you keep limping around first deleting the first part and pasting it through the file, and later doing it again but now for the second block of code?
Let’s use an example. Imagine this very simple piece of html:
Register example on some html text
Some more text
Now imagine we want to make it a bit more fancy, and want to add a hyperlink to a dictionary or something for all occurrences of the word ‘text’. Since we’re lazy, we only want to type the code for the link once.
Step by step:
- Add the link code on the first occurrence of the link, you’ll have to type it once anyway 😉
- We are going to use register ‘a’ for the first part of the link, the a href=”blabla” part. The end we put in buffer ‘e’. To yank the first bit into buffer a, yank as you always would, but start off by typing “a. So the total command could look like “ay/< to yank right from where your cursor is to the start of the next tag.
- Next, to make things fancy, we do the same with the end tag, except we yank to register b by using something like “b/< to yank.
- To make sure you yanked the correct stuff, type :reg to see the contents of your registers.
- Now paste the appropiate register at the right spots by using “ap and “bp. Isn’t that great? 😉
Show your what’s in vims buffers / registers:
Delete a line into buffer ‘a’:
Paste buffer q:
Some more advanced tricks:
Add something to a buffer by using the capitalized register name. :
Editing register a manually:
:let @a = "this text is now the new buffer content. Hihi."
Search and destroy using a regexp to replace stuff with the contents of your register:
Have fun 🙂
Windows and Ninite
So after the Adobe Cancer experience yesterday I still had to install a bunch of other things for the helpless windows user.
After I was done with most of that (of course, the good stuff always comes too late) I ran into this tool: Ninite.
They call it “The easiest way to get apps”. Well, from the screenshots it certainly looks that way. No cruft like toolbars and updaters and junk installed, just the application. (continue reading…)
They’ve managed to piss me off once more.
I had to do a windows reinstall (XP of course) for some idiots that fubar-ed their machine, so after the usual install, 5 million windows updates, service packs, reboots and firefox install I figured I should probably install flash for them.
How hard can it be to install Adobe Flash? (continue reading…)