News for the ‘vim’ Category

File under: notes to self

Note to self: Not everything has do be done as quickly as is humanly possible!

I tend to want to type as fast as i possibly can, all the time, and code as fast as my brain can do it. Learning Vim has been an excellent exercise in slowing down a bit, thinking of the best way to achieve the effect that i need, in as few keystrokes as possible. I am really loving Vim now. Been using it for about 3 weeks and have no intention of going back to TextMate now. The best thing was when i did some coding at home at the weekend and was just so happy to have the exact same coding environment to work with at home.

Another lesson in slowing down is when coding with someone else. I tend to find my brain goes much faster than i can form words to explain what's going through my head. It can be a frustrating experience at times. But today i made the effort to slow down, take the time to ensure that my colleague was still following my train of thought, rather than rushing ahead at full speed. It actually was quite a calming thing to do, like an exercise in mindfulness.

I have mentally renamed the toilet as the prayer room. Turns out it's a great place to say a quick prayer, assess how i'm feeling, recenter myself, pray for peace and mental inspiration, wish blessings upon my colleagues … I have been wanting to be more aware of God in my everyday life, and this is a great way to do it.

I'm feeling great at the moment – really happy! People say that God makes a positive difference in their lives. Whether a divine being is really at work in my personal daily activities, or whether it's my enhanced state of mind that comes from focus and prayer, i don't know and i don't really care. I just know that it's working out well for me at the moment! :)

Posted: February 17th, 2009
Categories: spirituality, vim, work
Comments: View Comments.

On learning Vim

I'm sure Vim is going to be a wonderful thing for me to have learnt – a skill that will stay with me and benefit me for the rest of my life. It's just getting there that's so hard!

I started using Vim in earnest this week. On Monday i used Vim in the morning, and switched to TextMate when i got too frustrated. Tuesday was periodic switching between the two. TextMate when Vim got on my nerves, and back to Vim when i found myself missing Vim features. Yesterday and today i have been entirely on Vim.

Yesterday was great – i really felt i was getting somewhere, and gaining speed. It started to be less about me getting around Vim, and more about me doing my work. Today has been a bit more frustrating, as i know it is slowing me down significantly in the short-term, but i'm sure it will be worth it!

I keep finding myself smiling at Vim when i have elegantly told it to do something quite complex. It's like "Wow, Vim, you're so clever!" Selecting a block of text and duplicating it, going five words in and changing the text to the end of the quote marks: vapyP5wct" – said as "visual a paragraph, yank, Paste above, 5 words, change till quote marks.

It's so cool to have Git integration right within Vim, and now that i've got the hang of the NERD Tree, and manipulating windows and buffers, i'm coming along a treat! I've discovered i have quite a strong perception of the layout of a project – without a project drawer i just couldn't think what to do or where to find anything! I've also decided i really like side-by-side windows so that i can see code and spec at the same time. I'll do a screenshot when i'm on my big computer.

The biggest problem in fact is not the super-amazing-cleverness of Vim and its plugins. I'm getting the hang of them pretty fast. The hardest thing is just learning the basic commands – like – moving around! I still get j and k mixed up, and it requires so much brain energy to remember whether i want to type a or i, o or capital O … even to remember to press <Esc> to come out of insert mode. Invariably i get it wrong and have to undo all the time. Either that or i'm undoing when i don't want to, because i think u is for up. Fortuately i discovered on a Dvorak keyboard, k is underneath u so that sort of reminds me that k is up.

I just hope it is not my dyslexia making it hard to learn the basic movements. Most of Vim makes a lot of sense to me. I like that it uses mnemonics and mostly pressing one key at a time. I love how you can combine keystrokes in sequences to achieve really powerful effects. I hear that when you get really good at Vim you're not even aware of exactly which keys you're pressing. You just think about what you want to do, and your fingers do it automatically. I'm sure i can get to that level of proficiency … it's just a case of being patient with myself whilst i'm still learning.

It was like this when i was learning Dvorak, but i'm glad i did, and my fingers do just type without my having to think about where the letters are. I type at around 80 words per minute, which is pretty nice, so i'm sure with the power of Vim, i could be truly awesome!

Posted: February 5th, 2009
Categories: dvorak, geeky, vim, work
Comments: View Comments.

Loving the vimtutor

A couple of times recently i've found myself doing <ESC>:wq in the internet instead of pressing the submit button. I don't use Vim very much at the moment – really only to make Git commits – but i've had enough of a taste that i feel it's something i want to learn properly.

For a few months i've been searching for a text editor that i can use both on the Mac at work, and Linux on my netbook and PC at home. TextMate is a wonderful thing, but there is no decent Linux equivalent. A colleague and i started writing OpenMate – an open source cross platform equivalent to TextMate … but it's hard! I enjoy gedit but failed to get gedit installed at work. I've tried NetBeans and jEdit but didn't like them much, and they feel too big and clunky for a netbook.

After a little bit of reading about Vim i have become very excited. More excited that i've ever felt about a text editor before! I've realised that my conception of Vim has been wrong. I used to press i straight away to get into Insert mode, and stay there until i wanted to perform a command, in which case i'd press <ESC> followed by the command. Now i realise that a better way to use it is to be in 'Normal' mode most of the time, press i to enter Insert mode very briefly, and press <ESC> as soon as i've finished inserting.

This afternoon i discovered vimtutor and have been really enjoying it! You can run it on any Unix/Linux based system; just type vimtutor at the command line. It takes you through every command, at your own pace. It gives you samples of text to correct, using the commands you have just learnt. It's actually quite fun and demonstrates the power of Vim very effectively!

At the moment i'm still muttering everything as i go, like "delete … 3 … words" as i very slowly type d3w and i'm exclaiming in delight at almost everything i learn – like – "Wow! That's so clever!" I'm sure soon enough i'll be able to use it effectively without making a lot of noise about it!

It is interesting learning it for Dvorak, but not too difficult. The up and down keys are in my left hand, and the left and right keys are in my right hand. They all actually fit rather neatly under my hands and feel intuitive even though they are not all in a line together. To be honest, i think i probably prefer it to the way it works under Qwerty.

Here is a helpful Vim cheatsheet laid out for Dvorak. Thanks, Mark Schoonover!
Here is an excellent article about the wonders of Vi/Vim.

It's ridiculous how exciting this feels to me! Perhaps it's the sense of moving up another level in the geek hierarchy! :D

Posted: January 29th, 2009
Categories: dvorak, geeky, linux, vim
Comments: View Comments.