Skip to content

Archive

Category: Vim

So there’s been some scuttlebutt on the Twitters recently regarding this “Pathogen” script for Vim and I decided to have a look. In a word? “Sweet”. In a few words? Tim Pope is the absolute man.

This is an extremely simple and elegant script. All it does is manipulate the ‘runtimepath’ but it has a nice focus on allowing you to componentize your Vim extensions into their own, private ‘runtimepath’ tree segments. So what? So what?!? Now you can easily upgrade your extensions by just deleting the old tree, downloading the package and exploding it in place.

This would have saved my ass when xptemplate went through a revision that deleted files, and I didn’t notice. Having unwanted, autoloaded files in place was not a good thing.

And you can also just toss git suppositories straight into this as well – perfect updating.

Check out Tammer Saleh‘s post called The Modern Vim Config with Pathogen for a concise description on how to get it into your vimrc.

Rick over at Lococast.Net has some great screencasts up for Vim. I’ve watched a couple of them now, and I’m a happy dood… nice stuff! Go check ‘em out. Go… go now… stop… no, don’t do that, you know what I mean… that thing you were going to do, that dirty, naughty, disgusting thing?? Yeah, that. Don’t. Go watch his screencasts instead. Go here instead.

There’s a new video online in the Advanced Section called Globals, Commands and Functions. Go check it out.

Alright… I’ve had a lot of traffic lately and a lot of people emailing me (something’s occurred on the inter-web recently that’s picked up the interest in these videos beyond the usual 1k views per week… I don’t know what it was). This has sparked my interest in making more videos so that’s what I’m going to try and do.

But, in the last few months, I’ve also had a number of people asking me where they can send me a virtual beer, and I’ve had no place to do that. I never really cared, but hey… if a few bucks can offset my website costs every year then what the hell?

So, if you feel like making a donation of a few bucks, feel free to do so, and if you don’t, feel free to not do so :) Whatever you do, keep using Vim, and if you feel like making a donation to the Vim project instead, please do.

In an upcoming video tutorial, I’ll be doing a bit of work with the :redir command. This is a great Vim facility but it can be helped with a function wrapper. I’m including that wrapper here:

function! RedirToClipboardFunction(cmd, ...)
    let cmd = a:cmd . " " . join(a:000, " ")
    redir @*>
    exe cmd
    redir END
endfunction

command! -complete=command -nargs=+ RedirToClipboard
    \ silent! call RedirToClipbaordFunction(<f -args>)

This function allows you to run a command (such as :history, hint hint) and have the contents placed to the clipboard that you can then paste somewhere else.

The command that is created just makes it easier to use. For example:

:RedirToClipboard history : -50,

I’ve had a number of people ask me when my next Vim Video is going to go online… I know it’s been a while since I put one up, and unfortunately it’s going to be a while longer.

Work has picked up in the last little while and on top of that, I’m buying a new house and am preparing for the move. After the move finishes I should be able to do another one. The only real problem is that the new videos are going to be of the intermediate and advanced quality and those take a lot more thought and time :)

I appreciate all the great responses, encouragement and all the interest! Keep reading those help files and stay tuned…

If you want to change settings / options based on the filetype there are a couple of ways you can do it.

Using an Autocommand

You can do this with an autocmd in your vimrc. Let’s assume you want to change some of the indenting rules for perl and html.

augroup indent_settings
    au!
    au BufEnter *.pl setl autoindent smartindent
    au BufEnter *.html setl noautoindent nosmartindent
augroup END

The above will do a setlocal when entering a perl or html file. It will turn autoindent to ‘on’ and smartindent to ‘on’ when you enter a buffer containing a perl file, and will turn them off when entering a buffer containing an html file.

Dropping the commands in a filetype file

You can also choose to organize things into separate ftplugin files in your runtime directory. If we want to continue with the perl and html examples above, you would do the following:

In ftplugin/perl.vim:

setl autoindent
setl smartindent

In ftplugin/html.vim:

setl noautoindent
setl nosmartindent

I’ve managed to throw together a video on Insert Mode today. I’m not supremely happy with this one… it was a bit rushed as I only had a short amount of time between the moments when my daughter pulls on my pant-leg asking me to do “something”.

I may redo this one, not sure yet – it’ll just depend on how much time I’ve got.

I’ve managed to cobble together a video that introduces Vim’s modes.

Have a look at it right here.

I just happened to see this story at engadget and dug a little deeper to find the EigenHarp at EigenLabs. This is possibly the coolest friggin’ MIDI Controller (almost) on the market today. It’s ridiculously expensive – way out of my price range at close to $7000 (it is just a controller after all – you still gotta have a computer and some soft synths, I believe) but that doesn’t diminish it’s complete and utter coolness!

I play an EWI 4000s which is a wicked cool super powerhouse MIDI Controller, but compred to the EigenHarp it looks like it was invented over 20 years ago (which it was :D). The EigenHarp is like some sort of psychedelic Bassoon with its LEDs, tons of keys, and insane levels of control – well, it’s just a beast of a controller.

I can’t wait to see what happens with this thing over the next few years.

Switch to our mobile site