Vim's Change, Replace & Substitute

Change, Substitute, & Replace… Read this after you’ve familiarized yourself with Delete, Yank, and Put (Cut, Copy, And Paste) Change Change (c) is similar to Delete. The difference is that Delete tells Vim “I want to get rid of this and go away.” Change says “I want to get rid of this and replace it with something else.” The practical difference is that after telling Vim what you want to change, it puts you into Insert mode so that you can start entering the replacement text. [Read More]

Vim's Leader Key (wtf is it?)

Sooner or later you’re going to hear mention of the leader key. In vimscript it looks like <Leader>. You can think of it as a trigger, or maybe a shortcut. macOS has the command key (⌘). Vim has the <Leader> key. You type it, and then usually two or three more characters to trigger some behavior like saying ⌘+o to open a file. By default it is set to backslash \\ Lots of people remap it to something else that they find easier to type or remember. [Read More]

Vim's Visual Mode

Visual mode is what Vim calls it when you’re making a visual selection. It doesn’t matter if you’re defining the selection with a mouse or the keyboard, it’s still called “Visual” mode. Plain Visual Mode When you click-drag on some text in a modern editor you are creating a “visual selection”. We tend to just say “selection” because everything is “visual” in a modern editor, and it would be a meaningless redundancy. [Read More]

Visual Block Mode

Visual block mode allows you to select any arbitrary rectangular selection in your document. Most of the time it’s not very useful, but when you’re editing something like a CSV file, it can be pretty awesome. Visual Block mode always maintains a rectangular selection. Imagine that your text editor isn’t a collection of lines, but a grid filled with characters. You can draw a rectangle on that grid and select all the characters in that rectangle. [Read More]

Working With Vim Plugins

Plugins are 80% of what makes Vim awesome. You take this great foundation, and then you pile on 25 years worth of developers going “ooh, I bet I can make it do this nifty thing.” The result is amazing, and as far as I can tell, all those ancient plugins still work. Everything isn’t perfect in the land of plugins. For a while it was download, and expand a zip file, or load a vimball (don’t ask). [Read More]

Working on a Project in Vim

Many of the modern editors have the concept of working on a “Project”. Usually this is just a fancy way of saying “files in a specific folder”. Vim does the same thing. Wherever you the first file from is assumed to be the top level of whatever you’re working on. Imagine this is your project’s directory: my_project/ ├── controllers │ └── controller_a.rb ├── models │ └── model_a.rb └── views └── view_a. [Read More]

Graphical Vim Clients

One of the major complaints of Vim and other terminal editors, is that they’re terminal editors. Most people are used to using really nice Graphical editors with buttons, good mouse support, and good integration with the system clipboard. Fortunately, there’s no need to use a terminal version of Vim unless you’re SSH’d onto a remote computer. It should be noted that Neovim is getting a lot of interest these days and there many attempts to put a GUI wrapper on it. [Read More]