Our own Jason Hansen interviews Vimcasts' Drew Neil about getting started with Vim, writing his book and playing VimGolf.
- 0:30 All about Drew
- 1:00 Collective Nouns
- 3:15 How Drew got involved with Vim
- 9:50 Writing the book
- 12:20 Honing your Vim craft, mastering the dot command
- 18:30 Other tools in Drew's toolkit
- 20:45 Advice for Vim users
- 23:20 The driving interest in Vim
Drew's website: http://drewneil.com/ Drew on Twitter: https://twitter.com/nelstrom Drew on GitHub: https://github.com/nelstrom
Links Collective Nouns: http://all-sorts.org/ Vimcasts: http://vimcasts.org/ TextMate: http://macromates.com/ Sublime Text: http://www.sublimetext.com/ VimGolf: http://vimgolf.com/ Angular.js: http://angularjs.org/ Practical Vim (Drew's book): http://pragprog.com/book/dnvim/practical-vim
Jason Hansen: Hello, this is Jason Hansen:, and welcome to Cloud Out Loud. Drew Neil:, @nelstrom on Twitter, is joining us from London to talk about all things Vim. Drew is the author of The Pragmatic Bookshelf’s title, Practical Vim: Edit Text at the Speed of Thought, as well as the voice of Vimcasts and Collective Nouns, @collectivenouns on Twitter. Thanks for taking some time out today.
Drew Neil: Oh, you’re welcome. It’s my pleasure.
Jason Hansen: Excellent. Why don’t you tell us a little bit about yourself?
Drew Neil: Well, as you say, my name is Drew Neil:. I started running the Vimcasts videocast in 2010. It was kinda a regular series for a little while, and then, I decided to write a book about Vim, and when I started doing that, I found that it was difficult to keep the screencasts coming regularly. So, Vimcasts has died off a little since I started writing the book, but now that I’ve finished the book, I’m hoping to bring that back to life again.
Jason Hansen: Before we get into all things Vim, I noticed you are the curator of Collective Nouns.
Drew Neil: That’s right.
Jason Hansen: – Tell me. How did you get involved in that?
Drew Neil: Well, I was always fascinated by collective nouns. It seems to be a sorta unique thing in the English language where – well, just in case anyone doesn’t know what we’re talking about – for example, if you’re referring to a group of sheep, it would be a flock of sheep. Or if it was whales, I think it’s a pod of whales.
Jason Hansen: Yeah, I think that’s right.
Drew Neil: So, it’s a longstanding tradition; it’s kinda a game to come up with a word that encapsulates the thing that you’re describing as a collective group. And so, I noticed that, you know, there’s these lovely lists of old traditional collective nouns, and I was looking at one of those, and I was thinking, “Gosh, there’s so many sorta modern things that aren’t covered by the existing terminology.” And, at the time, I was looking for an excuse to build a fun little Twitter app. So, I thought, “Well, how about, you know, just create a little app that searches for the #collectivenouns hashtag, and just throw the question out there, and invite anyone on Twitter to suggest something?” That’s what I built. It’s called AllSorts.org and, yeah, it just listens for the #collectivenouns hashtag, and people have been participating in this – whoa – I think it was 2009 when I set it up. So, there was a lot of activity early on and I don’t really curate it; it’s – if you see something you like, you can retweet it, and then, that counts as a vote. So –
Jason Hansen: – Oh, okay. So, you have a voting system, right?
Drew Neil: – Yeah, that’s right. So, yeah, there’s a popular leader board and some of the ones on there are hilarious – very clever.
Jason Hansen: What’s your favorite collective noun?
Drew Neil: The one I keep coming back to, I think, is a seemingly empty room of ninjas.
Jason Hansen: Ah, that is good. I like that. One of my favorites is a fixie of hipsters.
Drew Neil: Mm, yes, that’s spot on.
Jason Hansen: We were talking about this earlier, but a collective noun for a set of Vim users? I came up with a mode of Vim users.
Drew Neil: Ooh, yeah, that’s hard to beat that one. I think the only sorta different take would maybe be for newbie Vim users, which would be some sorta expletive, I think.
Jason Hansen: A deleted file of newbie Vim users.
Drew Neil: – Exactly.
Jason Hansen: Yeah, excellent. I’ll have to tweet that @collectivenouns. See if we can get that – get some votes for that.
Drew Neil: Yeah, grab the credit.
Jason Hansen: Yeah, awesome. So, how did you get involved or Vim or interested in Vim?
Drew Neil: It goes back some time. I mean, like everyone, I used Vim without ever really thinking about it, whenever I needed to – when it was the only thing there, if I was on a remote machine on an SSH session. And I was always aware that there was much more power to it than I was using. And so, a while back, I read the book by Steve Oualline, the Vim book, and it gave me – it got me – it piqued my interest, basically, and I was always aware; from that moment on, I was always aware that I could be doing things better in Vim. And I could never really take the time out to learn it until, one day, I switched jobs, and I went from a job where I was using a Mac, and I was using TextMate as were everyone at that job. I moved to a place where I was using a Linux workstation, and so, I had to choose another editor. And, looking at what my other colleagues at this new job were working with, some of them were gedit users; about half of them were gedit users and about half were Vim, and I felt as though gedit would be a step back from TextMate, whereas I felt that this was maybe an opportunity for me to dive into Vim. So, it was by necessity. I found myself in a new job and having to learn a new editor. So, I decided to go all in Vim.
Jason Hansen: Excellent. That’s quite on-the-job training.
Drew Neil: Yeah, yeah, that’s right.
Jason Hansen: Install yourself in Vim. Let’s look at all of the things.
Drew Neil: – Yeah, yeah, that’s right.
Jason Hansen: So, what led to Vimcasts, then?
Drew Neil: Well, I felt TextMate is a good editor and it teaches you a lot of good editing habits, I think. And the way it teaches you is by having such easily-discoverable functionality. I think there are patterns to good text editing use and TextMate supports some of these. And so, I found myself, when I switched to Vim, I wanted to be able to do the things that I did habitually – I did constantly – inside of TextMate. I always knew that Vim was powerful enough to be able to do these things, but the functionality was less discoverable.
And so, I had to dig deep. I had to search the Web and find all sorts of tips, which are all out there, but it seemed like everything was spread all across the Internet. I felt like it would be good if stuff was unified in one place. Well, I guess I was inspired by Ryan Bates’ RailsCasts, which I’ve been a longtime fan of. I thought, “Oh, well, this would be a great topic for a series of screencasts,” especially because there are some things that I’ve covered in Vimcasts that are very, very difficult to cover with the written word because, in the course of making an edit, you go through several intermediate stages. And, you know, to take a screenshot of each one of those intermediate stages is a very slow process.
Jason Hansen: Right.
Drew Neil: It’s quite boring to read. And I think the fact that, on video, you can just capture that as a workflow – I just felt as though the video format was a very good way to teach Vim. So, I dived into it. It took me a few months to get it ready, but, yeah, I launched in January of 2010 with that.
Jason Hansen: Cool. Yeah, that actually brings us to the book that you’ve – how long ago was this published?
Drew Neil: Oh, well, there are many publishing dates, but the most recent one is the final one, which was for the paper edition. We’re now shipping paper books and that was as of about two weeks ago. So, early October that would have been.
Jason Hansen: And that’s Practical Vim: Text at the Speed of Thought. It brings us to – I grabbed that book in preparation for this, and I was like, “I’ve been a longtime Vim user myself,” mainly as a systems administrator, working on remote systems. And, now, more recently, as a developer, and have been using it for a long time – feel very comfortable. I was like, “I’ll grab the book and I’ll skim it,” you know, just kinda get a lay of the land, and I made the terrible mistake of reading every sentence, and I was like – keep learning new, little things, and like discovering the way that I was using Vim, and different ways to use it, and I was like, “Oh, damn it. Now I’m gonna have to read the whole thing.” So, it’s become a project for me. But one of the interesting things is the way that you show those – the progression of an edit in text.
Drew Neil: Yeah, yeah.
Jason Hansen: How did you come upon that? And contrast that with doing the podcast.
Drew Neil: Yeah, okay. Well, so, to be honest, I saw it in the O’Reilly book. They do something quite similar. So, just to describe it for anyone who hasn’t seen it, what we do is we use a table, and on the left column, we show the keystrokes as they’re typed into Vim. And, in the right column, we start off by showing the contents of the buffer – the text buffer – at the start of the editing series. And then, after each command is invoked, we show a word being deleted, and we always show the cursor position. So, it’s very easy to follow along. And, effectively, this – you know, each table maybe shows, like, four or five commands going from a starting document to the document, as it looks, after making this sequence of changes. It took us a while to figure out how to typeset that and, thankfully, the Pragmatic Programmers have – they have people on staff who can make it work, not just in PDF, but in other e-book formats. So, I’m glad that I didn’t have to solve those problems myself. But I found, before I had that – that kinda a visualization on the page, I found it – very, very difficult to write and to describe these changes because – well, first of all, it would be boring for me to write it, to write, “We press this and it deletes this word,” and so on. It was boring for me to write, and then, I’d read it back, and I’d just fall asleep reading my own writing. It was just, “Ugh, this is horrible.” And, as soon as we had this sorta visualization, everything just became so much easier and I was able to churn out the tips much faster. So –
Jason Hansen: Nice. Were you able to work in Vim as you wrote the book?
Drew Neil: – Yes.
Jason Hansen: Or what was the toolset around it?
Drew Neil: Yeah, well, it’s highly confidential. The Pragmatic Programmers consider it a competitive advantage, but – Jason Hansen: – Fair enough.
Drew Neil: – I don’t think it’s – they don’t make us write in Microsoft Word.
Jason Hansen: Oh, that’s good.
Drew Neil: You can tell that they’ve built a tool chain, you know, by programmers for programmers. And, yes, I mean, we write in a plain text format and we can keep everything in source control. So, it – as a technical writer – well, becoming a technical writer, it’s an easy transition from being a programmer.
Jason Hansen: Oh, that’s good.
Drew Neil: Yeah, so, the answer is yes. I wrote the book in Vim on Vim.
Jason Hansen: On Vim.
Drew Neil: Yes! Yes.
Jason Hansen: – Yeah. And so, how was your experience of writing the book overall?
Drew Neil: – Well, I’m sure there’s times when I’ve said, “If I ever say I’m gonna write a book, remind me of how I’m feeling now.” It’s harder than – harder than you think it’s going to be, even when everyone tells you it’s gonna be harder than you think it’s gonna be. It’s – yeah, it wasn’t easy. I launched into the project thinking I could have it written in three or four months, and well, in the end, it took about 18, I think. So, that’s not full-time, but I did set aside a couple of months at a time to really focus on it. So, it’s really hard work. And, during that time, I have found that I’ve missed working on code, but at the same time, I definitely feel as though my writing has improved, even if my coding ability is slightly rusted. But I do also feel as though I’ve learned things – I mean, whether you’re writing code or prose, you’re basically communicating, and I think there are things that are common to both formats. It’s been interesting for me to see how becoming a better writer – some of the ideas from there, I can use to become a better coder as well, I think.
Jason Hansen: Communicating clearly with your code as you would with prose.
Drew Neil: – Exactly, yeah.
Jason Hansen: – Excellent. Let’s see. What Vim commands could you not live without?
Drew Neil: – Oh, that’s – that’s easy. The dot command.
Jason Hansen: Uh-huh, yes.
Drew Neil: It’s this slippery little devil and, in fact, I spend the entire first chapter of my book talking about the dot command because it’s such a difficult one to pin down. It repeats the last change and, because every time you make a change – well, the last change is something different – it means the dot command always does something different. But if you can compose your changes in such a way that the dot command does something that’s useful, then you can really – if you have a repetitive series of changes to make, it’s much quicker than recording a macro; it’s – you know, with a macro, you can record several changes and replay them back. But the dot command just does one change, and if you can train yourself to make the most of that one bullet, then the dot command is just – it makes Vim just read your mind; it’s a fabulous one if you can just master it. So –
Jason Hansen: Um-hum, what do you think the balance is between sorta honing your Vim craft and being obsessed with being able to edit text with the fewest number of changes as – you know, versus getting something done? Like what’s the breakeven there?
Drew Neil: Oh, yeah. I must admit; I am kinda obsessive. Yeah, I – I mean, I think when you’re learning Vim, I mean, there’s such a vast command set. Sometimes, the way to learn something is just to know that it exists, and then, as you’re going about your regular daily work, you notice that, “Oh, maybe – maybe that was a place where I could have used that thing that I read about the other day.” And, maybe, if you’re really curious, you’ll maybe sorta undo that change, and then, try and use the thing that you just learned about. But, you know, sometimes – well, if you’re working to a deadline, that’s not always possible, but even just noticing that that was a chance that you could have used it, even though – well, now you know that it exists and you’ve maybe forgotten the keystrokes that invoke that thing, but just knowing that it exists, you can then sorta, next time you come across that in the documentation, you can remember the keystrokes. And then, next time, you come across that scenario in your work, you can use those keystrokes, you know? It’s a kinda – I think just knowing that stuff is out there can really help.
Jason Hansen: Um-hum, continuously planting the seeds for new stuff, and then, figuring out when to use it.
Drew Neil: – Yes, exactly, because it’s not always obvious when to use something, I think.
Jason Hansen: So, that actually brings up – I think Avdi tweeted about this in teaching – or not recommending complex text editors, I think Emacs in his specific case, but I think it applies very well to Vim, for beginning programmers – people who are just coming to a language. What’s your opinion on that?
Drew Neil: Oh, yeah, I agree with Avdi, definitely. Definitely. I think Vim is kinda a luxury skill, to be honest. It’s – you know, there are so many other things that are more important. I think it would be kinda strange if you put that you’re a Vim user on your résumé, for example. It’s not really something that’s gonna get you a job. You know, it’s much more important that you know your language, that you know your source control. Those things, really, you know, a team is really gonna want to know that you know get, for example.
Jason Hansen: Sure.
Drew Neil: And those workflows, whereas, you know, which editor you use – it doesn’t really leave any trace. So long as you can get the job done, then you’re getting the job done. But, yeah, I mean, I reached a stage with TextMate where I was frustrated. I felt – I mean, this was partly because it wasn’t really seeing active development at the time, but I – like I say, I kinda became aware that, in Vim, it was possible to move your cursor to, you know, just to look at part of the document, and with three keystrokes, have your cursor there. And I found, as soon as I knew that, every time I was having to use the cursor keys, and maybe hold down Shift, or Alt to make it move faster, like Word-wise, or Lane-wise, or something, but I just sorta started thinking, “Oh, if this was Vim, my cursor would be there already.” And so, I started – I guess I was at the stage where I was comfortable enough with my tools, as a Ruby developer and a Rails developer, I could get the job done. And then, I had the luxury of – well, and in my case, also the necessity whilst changing jobs, of – being able to learn Vim.
Jason Hansen: Um-hum. So, what’s your opinion on plug-ins versus the naked Vim?
Drew Neil: Mm, good question. Well, in my book, I’ve decided to write just about the core functionality and I don’t mean to say that you shouldn’t use plug-ins; I just want to stress the fact that Vim’s core functionality is vast. Once again, to bang on TextMate, I mean, if you took away all of the functionality provided by bundles, there’s almost nothing left of TextMate. There’s very, very little editor – very little core functionality. I mean, that’s kinda a false claim because, when you download TextMate for the first time, it has bundles included. And, likewise, Vim has plug-ins included with the distribution, but really, just focusing on that core functionality, there’s an entire book’s worth in there. So, I – another thing that kinda bothers me is when I see people installing a plug-in that adds a functionality that Vim already supports out-of-the-box. And it’s kinda sad that someone has written a plug-in – they’ve gone to the lengths of learning VimScript so that they can add functionality that already exists.
Jason Hansen: Already exists, yeah.
Drew Neil: You know? It’s a terrific waste of time. So, I really think learning the core functionality is vital and there are places where Vim is really designed to be extended. And I love the plug-ins that extend Vim in those ways, you know? There are really sorta interfaces that are pluggable within Vim. So, I’m all about extending Vim in ways that it’s meant to be extended.
Jason Hansen: That said, do you have a list of “I can’t live without” plug-ins?
Drew Neil: Oh, yes. Gosh. I actually have quite a lot of them and I would struggle to think of them off the top of my head. Let’s see. Well, I love Surround. I think that’s a beautiful extension of Vim’s text objects. So, that’s the one that allows you to, you know, delete opening and closing brackets, or change between one style of parentheses and another, and so on. And it’s a lovely – it feels very Vim-ish when you use it. Probably my favorite feature in Vim, actually, is the text objects.
Jason Hansen: Ah, yes.
Drew Neil: But it doesn’t quite have enough of them. I find myself reaching for a text object that doesn’t exist. And so, I’ve got a few plug-ins that are custom text objects, and I really love that kinda thing as well. There’s a developer in Japan called Kano Natsuo, and he’s written a lot of custom text objects, and I think they’re some of the best extensions for Vim that are out there.
Jason Hansen: Yeah, text objects are one of my favorite features in Vim. It just – it feels natural when it works the way that you expect it. It gives you more power for moving things around and changing things.
Drew Neil: – Yeah, that’s right.
Jason Hansen: So, Vim obviously features front and center in your workflow. What other tools do you have in your toolkit that you can’t live without?
Drew Neil: Well, the Terminal, naturally.
Jason Hansen: And are you an OSX user?
Drew Neil: I am, yes.
Jason Hansen: And iTerm or do you use Basic Terminal?
Drew Neil: I use iTerm, yep. Well, the Basic Terminal – I’m not sure if this has changed, but yeah, it only had 16 colors last time I checked, which is – I don’t wanna spend my whole day in 16 colors.
Jason Hansen: Insufficient. Insufficient number of colors.
Drew Neil: – Yeah, yeah. Are there other tools? Well, I don’t need it yet, but tmux is definitely on my radar. I’m trying to incorporate and I’ve got a couple of things planned for which I think tmux is really gonna make things easy – I mean, remote pair programming. And I’d quite like to do some in that way, so I think tmux is going to become an important part of my tool chain. It’s not quite there yet, just because I haven’t needed to do those things yet. But that’s on my sorta to-learn list, definitely.
Jason Hansen: Yeah, I do enjoy tmux, especially when paired with Vim for that remote pairing. It’s probably one of the lowest-friction remote pairing setups that we’ve come up with here at Engine Yard.
Drew Neil: Yeah.
Jason Hansen: So, if you do do that, and you are a Vimist – or, you know, Emacs works as well, but tmux plus an SSH box is pretty ideal for remote pairing.
Drew Neil: Yeah, sure.
Jason Hansen: So, plus one for that.
Drew Neil: Yeah.
Jason Hansen: Do you play any VimGolf?
Drew Neil: Haha! Well, to be honest, I’m not very good at it. I don’t like things that I’m not good at. So, yeah, I tried it and I think it’s a really clever site. I love the way it’s – the way it works. And I’ve found – wow – I couldn’t believe how few keystrokes people were able to do things. And, when I looked at their solutions, I just thought, “That’s mental!” You’d never do that! So, yeah, I mean, it’s a great way to learn the obscure stuff in Vim, but I feel as though it’s kinda slightly contrived, shall we say.
Jason Hansen: You end up playing to the game, rather than using your skills entirely.
Drew Neil: – Yeah, that’s right.
Jason Hansen: Interesting. Let’s see. Oh, so, if you had advice for an intermediate Vim user, perhaps other than the dot command and mastering the dot command, what advice would you have?
Drew Neil: Woo, well, other than mastering the dot command? That’s difficult. I think mastering the dot command teaches you so much. So, I’d like to sorta open that up. I mean, I mentioned earlier that it repeats the last change and it takes a bit of practice to be able to do that last change well, and I’ve just found by always trying to make – well, particularly this is if I’ve got a series of repetitive changes, trying to solve that using the dot command teaches me to make changes in a way that are repeatable, and that’s always a good thing. One of the sorta more obscure things that I realized helps you to use the dot command, not to use visual mode. So, often in Vim, there’s two ways of doing things. You can either go into visual mode and select all the text you want to change, and then, make the change, whether that’s pressing D to delete, or C to change, or whatever. Or the other thing you can do is you can start with the operation; let’s say start by saying D to delete, and then, you provide a motion to specify the range of text you want to change. Vim has got a vast array of motions and there’s almost always one that will do the thing you want to do. And so, if you can prefer to do it this sorta old-fashioned vi way without using visual mode, that is what will make the dot command play to your strengths, I think. So, that’s – it’s sorta an obscure thing. It’s difficult to explain without giving examples, but that’s one of the top tips, I think, from the book is prefer operator commands to visual commands.
Jason Hansen: And as far as examples, for anyone listening who hasn’t checked out at least the example chapter on Pragmatic Programmers’ website for Drew Neil:’s book, I highly recommend it. It is page, after page, after page of awesome stuff.
Drew Neil: Oh, thank you.
Jason Hansen: So, I highly recommend it. And the reviews rolling in on Twitter seem to be good. Everybody seems pretty stoked. A lot of old-time Vim users who are learning new stuff –
Drew Neil: Yeah, it’s been great for me to see that.
Jason Hansen: Probably happy to have your 18 months’ hard work be so well-received.
Drew Neil: Well, yeah, it’s been a thrill. I mean, it’s – in this age of so much instant feedback, it’s quite strange to work on a project where you’re on your own in a vacuum for so long. It’s lovely to see that it’s being well-received.
Jason Hansen: What do you think – just kinda popped up. What do you think is driving the – or do you think there is a resurgent – interest in Vim these days?
Drew Neil: Hmm, yeah. Well, back when I started Vimcasts in 2010 – well, TextMate was looking more and more stale, and for a long time, TextMate had been the favorite editor in the Rails community. And so, a lot of people were getting fed up back then. Now, it’s 2012 now, and TextMate is – you know, it’s now open-source, and it’s seen a lot more progress, but I think the other thing, actually, is just – as I was saying earlier, you kinda have to learn all of your other tools before you can have the luxury of learning Vim as a developer. And I think people who had been using TextMate from, let’s say, 2006, 2007, a lot of them just sorta felt ready; a lot of them felt they had luxury right about the same time. I think that’s maybe why there was a big uptick in Vim usage, in the Rails community in particular, a couple of years ago. I’ve not been following too closely how those trends are playing out. I think Ryan Bates did a poll a few months back and it seemed as though Vim was top of the list, with Sublime fast catching up, and TextMate dwindling. That was the last figures I saw, but that was a few months ago. I’m not sure what the status is these days.
Jason Hansen: Have you spent any time using Sublime Text?
Drew Neil: I’ve not actually – I’ve – no. It sounds interesting. I’m sure there’s some good stuff in there, but while I was writing my book, I certainly felt I should be eating my own dog food.
Jason Hansen: – Heads down on Vim?
Drew Neil: Yeah, yeah. So, I’ve – I felt I couldn’t afford the luxury to try another text editor while I was on that – on that project. So – Jason Hansen: I’m kinda interested to see. I mean, they have the vi command mode. I’m wondering to what extent it would feel like Uncanny Valley. It’s just enough to make you feel comfortable, but not enough to actually be comfortable.
Drew Neil: Yeah, I think vi emulators often have that problem. I’ve rarely found one that didn’t drive me crazy within two minutes.
Jason Hansen: So, aside from your book, obviously, what things are kinda turning your crank in the tech world these days?
Jason Hansen: Excellent. Well, now that the book is done, you can go about the code side of things.
Drew Neil: Yeah, that’s right.
Jason Hansen: All right. Well, I appreciate you taking time out of your day.
Drew Neil: Oh, it’s been a pleasure.
Jason Hansen: Let you to your evening. For everyone out there, the book is Practical Vim: Edit Text at the Speed of Thought and it can be bought in all sorts of forms at The Pragmatic Bookshelf. So, thanks again, Drew.
Drew Neil: You’re welcome. Thank you.