Skip to content

I use Vim mostly at work on Windows (don’t even get me started on that lovely O/S), working on two different machines – my desktop and my laptop – neither of which are backed up. That presents a couple of problems:

  • How do I keep the two machines up to date with each other?
  • How do I avoid the death crash from hell?

I solve both of those problems with one move – keep the configuration in Perforce. Now, I’m not a huge fan of Perforce but it’s all I’ve got at work, and it certainly does the job when I want to solve these problems. You don’t need much to handle this issue so any version control system should do (so long as the repository is remote and backed up for you, of course :D).

Once you’ve set up your Vim files into your version control system, you just need to tell Vim where they are.  You do this with the $VIM environment variable (or %VIM% if you’re on Windows and you just want to be really pedantic about the details :D).  You don’t need to do this, of course, if your version controlled Vim files map to the same place as Vim would normally look, but in my case they map to somewhere really weird so I need to help Vim out by telling it where the files are.

Then it’s just like versioning any other piece of code.  Check config files out, modify them, check them in, sync them to other machines.  Normally I work on my desktop box, so the first thing I do when I power up my laptop is p4 sync my Vim configuration so I can get the exact same experience as I had on my desktop, right away.

I’ve completed the video series on the Vim BASIC Movement Tutorials.

Pick it up here.  It’s also catalogued on this site, right here.

Yup, I’m an idiot. I’ve had a Dreamhost account for a long time now, mostly for the email address, and I went to WordPress.com to set up my vim-related blog – the free one. Why the hell would I do that?? Dreamhost gives me the same thing, plus all the extras because I’ve already paid for it. Eventually I clued in :)

I’ll probably be changing some cosmetics and such over the next short while but the content should be staying the same – I’ll just be adding more.

Ever been inside a code block and want to reformat (via ==) a number of lines but not the whole file and not line by line?

Let’s say you’ve got code like this:

[cpp]
class MyClass
{
public:
MyClass()
{
std::cout << "In MyClass constructor" << std::endl;
}

int somefunc()
{
for (;;)
{
std::cout << "breaking" << std::endl;
}
}
};
[/cpp]

That’s just not ideally formatted, is it? Here’s one cool way to format it:

  • Put the cursor somewhere inside the outer most block – say on public: or on the blank line between the constructor and the function.
  • hit: =aB

That will format “a block” and that means it formats the outer block recursively down to the inner most blocks. Not that this is a great demonstration, but it looks like this:

[cpp]
class MyClass
{
public:
MyClass()
{
std::cout << "In MyClass constructor" << std::endl;
}

int somefunc()
{
for (;;)
{
std::cout << "breaking" << std::endl;
}
}
};
[/cpp]

David Fishburn (of vim_use Mailing List and other fame), suggested that I put up some videos regarding the vimrc file, and I thought that this was a great idea, so I started this morning – not with the videos though :) I want to get a decent idea of what I want to talk about before diving into that medium, so I started with a bit of work on this site with some pages on the vimrc. So far all I’ve got is the bare minimum, but I’ll be fleshing that out in the near future.

I suppose with the addition of the Vim pages on the right side of this page, I can say that I’ve now “begun” my new blog. I’ve had others in the past that were all pretty stupid, but I’m trying to make a commitment to Vim, to write about it, Screencast it, and Twitter it.

Watch this space…

Oh now this is sweet, ladies and gentlemen. WordPress has the BlackBerry client. I’ll be playing with this… Cheers WordPress!

Switch to our mobile site