Favorite Vim commands for Writing

Jay Penner
3 min readApr 1, 2020

Vim is an awesomely popular programmer’s editor, and I’ve adopted vim mode in Visual Studio Code for writing novels and articles.

In this post I cover my most used commands and how they make my writing so much faster. There are a ton more, but I’m only covering the once I most employ. I use the VSCode Vim extension in Visual Studio Code, which is what I use to write my novels!

Moving Around

Go back to my previous screen position

C-O

When I’m at one place and went somewhere else and need to return.

Go to a specific line

:n or nG go to line n.

gg to beginning of file

G to end of file.

I usually put my notes and todo’s and a few other items on the top of my manuscript. It’s handy to sometimes just go to the top to check my notes.

Go the beginning of the next sentence (and previous)

) (

Go to the end of the word, or the beginning of the next word

e and w

It’s so much faster hitting keys to move, rather than using a mouse! You have to try it.

Go to the end of the line

a in editing mode, or $

Bookmark a position…

ma and where ‘a’ can be replaced by any alphabet or number

…and go to that bookmark

`a

Bookmarking is absolutely fantastic. I usually mark where I am in active writing with ma and then I move around in the manuscript for anything else, and when I need to return, I just hit `a and come back. I set multiple bookmarks as needed as I move around and it’s such a huge time saver.

Move to the Top (High), Middle, or Bottom (Low) of the screen

H M L

Go to a specific character forward and behind

fc or Fc where c is a character in the sentence(e.g., a , )

I use this a lot when I’m editing and making corrections. Just jump to the next comma or ; or whatever else. No mouse!

Manipulating Text

Join line below to current line

J

Select a paragraph (or select a sentence, or a word)

V v w

…and then delete or copy, and then paste elsewhere

d or y and then p

Copy or delete until end of line

y$ or d$

Find a phrase and replace it globally

:s/phrase/replace/g

Just search for a phrase

/phrase

Handy Ones

Repeat last command

;

For more, fantastic cheatsheet and article

There, these are my comfort commands . There are more, but there’s only so much one can remember. Vim is a beast… but it’s a beast at your service. Give it a shot. You might want to check out my article on how I use Visual Studio Code for writing novels, it’ll give you some ideas on the approach and how helpful it’s been.

--

--

Jay Penner

I write on topics pertaining to ancient history and productivity. I am also the author of The Whispers of Atlantis series — more on https://jaypenner.com