Here’s a quick guide on how I use Vim on a day to day basis as a developer. First, we’ll go through some settings, then we’ll cover apps I use the most often. These days, I write code mostly on a Mac, so feel free to substitute the shortcuts below as required. If you’re new… Continue reading My Vim Setup for Day to Day
Category: Vim
Learning Vim like a Martial Art
Learning Vim is a challenge. There are a lot of keys to remember and Vim works in a different way to other editors. I had an idea about structuring a Vim tutorial like learning a martial art, where each milestone is represented by a belt colour. We start at white belt where we learn the… Continue reading Learning Vim like a Martial Art
Vim Macro Example
In this section, we’ll work through a simple example to get familiar with Vim Macros. We’ll edit a column in a tab separated file (TSV) using a macro. TSV Example Let’s say we have the following tab separated text. Notice the last column, where all the cities are in capital letters: We’ll create a macro… Continue reading Vim Macro Example
Getting to Black Belt in Vim – Part 6 – Black Belt
Welcome to our final chapter. We made it! Previously, at blue belt level, we covered text-objects. At black belt level, we’ll cover search/replace, macros and window commands. Finally, we’ll explore topics to take you beyond black belt. Search & Replace To replace everything on the current line, type: :s/<search term>/<replace term>/g where the <search term>… Continue reading Getting to Black Belt in Vim – Part 6 – Black Belt
Getting to Black Belt in Vim – Part 5 – Red Belt
At blue belt level, we covered visual mode and advanced motions. At red belt level, we’ll introduce a powerful new concept. If you’re a developer, they’re a game changer – you can transform text in a few keystrokes. Let’s learn more. Red Belt Text Objects Text objects are a sequence of commands, that let you… Continue reading Getting to Black Belt in Vim – Part 5 – Red Belt
Getting to Black Belt in Vim – Part 4 – Blue Belt
Great work for coming this far! We covered a lot at green belt level.At blue belt level, we’ll cover visual mode, a couple of advanced motions, searching and some more editing commands. Blue Belt Visual Mode We’ll see how to use visual mode with counts and motions later on. Vertical Motions Searching Horizontal Motions Operator… Continue reading Getting to Black Belt in Vim – Part 4 – Blue Belt
Getting to Black Belt in Vim – Part 3 – Green Belt
In previous posts, we covered basic editing and motions. At green belt level, we’ll learn about getting into insert mode faster i.e. moving to a location and entering insert mode in one command. Then, we’ll cover a few more motions. Finally, we’ll look at jumps and navigating through your jump history. Green Belt Insert Mode… Continue reading Getting to Black Belt in Vim – Part 3 – Green Belt
Getting to Black Belt in Vim – Part 2 – Yellow Belt
Now that you’ve mastered the basics at white belt level, let’s get a bit faster. At yellow belt level, we’ll introduce motions and more editing commands. Let’s get started. Yellow Belt A motion is a movement of the cursor, either horizontally or vertically. Horizontal motions: Vertical motions: Edit operators: Repeating You can add a number… Continue reading Getting to Black Belt in Vim – Part 2 – Yellow Belt
Getting to Black Belt in Vim – Part 1 – White Belt
Vim is awesome. But it can be overwhelming if you’re just starting out. In this series of articles, we’ll structure learning Vim like learning a martial art. We’ll build solid foundations at white belt, building up to advanced moves at black belt. First, let’s start with the basics at white belt level. White Belt This… Continue reading Getting to Black Belt in Vim – Part 1 – White Belt
Show End of Line Characters and Tabs in Vim
When working with files, it’s often useful to see special characters such as tabs or end of line (EOL) characters. Let’s see how we can do this in Vim. First, once we’ve opened a file in Vim, type the following: This allows us to enable list mode, which shows tabs as ^I and end of… Continue reading Show End of Line Characters and Tabs in Vim