I’ve put my Vim configuration on GitHub now. Have a gander at http://github.com/derekwyatt/vim-config
I’ve put my Vim configuration on GitHub now. Have a gander at http://github.com/derekwyatt/vim-config
Well, I got another patch from someone for protodef. It was just getting silly that I didn’t have anywhere to actually put this stuff and I was getting tired of people sending patches :). Now y’all can just fix stuff for me directly… go to it.
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.
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.
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.
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.