Home / Tech / Custom Vim Commands
Created on Fri, April 21 2017 12:38

I never want to leave vim when I'm editing a blog post. This means I also want to publish my blog or serve local preview directly in vim.

The Old Way

In Vim command mode, I usually type this to publish my blog.

:! publish_blog.sh

This gets very tiring to write, so taking a few seconds to convert this to a custom Vim command can save time in the future!

The Vim Way

In your .vimrc file you can add custom commands. Let's convert the top snippet into a vim command.

command Publish execute "! publish_blog.sh"

Now I can easily publish my blog through command mode in Vim by typing :Publish