I’ve been trying to switch to Vim from TextMate as my default text editor, and I’m constantly stumbling and learning in the process.
One quirk I dealt with recently was spaces. Well, yeah, spaces.
I liked using Monaco as my default font on TextMate and Xcode when I’m working on Python scripts or on iOS apps, mainly because characters are distinct, and it is difficult to confuse 0 (figure zero) and O (uppercase O), or 1 (figure one) | (Vertical bar) I (uppercase i) and l (lowercase l) – which are all characters that occur a lot in programming. So I wanted to set it up as my default font on GVim on Ubuntu. I got a copy of it and installed it just fine, and set it as my font on GVim using the menu.
To make it my default font, I went ahead and opened my .vimrc file, and when I looked it up on GVim (using set guifont?), I saw this:
Then I added the same line to my .vimrc as
and it wouldn’t work. Whenever I started GVim, it would complain that it didn’t understand the .vimrc file.
After searching online and looking up a lot of forum posts, I learned that Vim does not recognize spaces in arguments. So I actually had to add a backslash (\) after the first word if I wanted vim to treat the next word as part of the same argument.
And it worked!
Now I’ve been using it in more places where it’s appropriate. For example, if I have a long piece of text and I wanted to replace apples with yellow oranges, I could just do
and voila, every occurrence of apples will be replaced with yellow oranges.
Maybe this will help another struggling Vim user someday!