Module 0356: Using [n]vim for Markdown

Tak Auyeung

1 Introduction

This document describes a way to use [n]vim to create Markdown documents. This is not the only way to utilize vi type editors to work with Markdown formats, but it works for the author!

2 vi, vim, or nvim

vi stands for “visual”, it was a revolutionary step forward in a time when all editors are line-based. vim stands for “vi improved”, it includes many features, such as the ability to have plug-in modules. nvim stands for “neo nvim”, it is a newer implementation of vim and offers certain features over vim.

The entire family of editors is designed around the idea of “never leaving the home positions on a keyboard.” This means that on a QWERTY keyboard, the index fingers should “home” at the ‘F’ and ‘J’ keys. Everything should be done using the keyboard without the use of a pointing device (like a mouse or a mouse pad).

The vi family of editors (along with vi extensions for web browsers!) aim for efficiency. By doing so, vi tools are more difficult to learn. The reader (you) should evaluate how much time is available to learn a new tool.

3 Prerequisite

Using nvim or vim combined with pandoc is intended for people already with competency in the use of command line interface (CLI). Furthermore, some experience in using git can also be beneficial.

4 Components

4.1 Which vi?

Since Markdown is a plain text format, any text editor will work. In order to utilize a previewer, vim or nvim should be used. Of these two, nvim is recommended over vim because the instruction of the plugin is more comprehensive.

4.2 vim-plug

vim-plug is a plug-in manager for both vim and nvim. While there are other plugin managers for vim and nvim, vim-plug is one of the most used tool.

4.3 markdown-preview

There are two projects, one for vim, and one for nvim:

Please note that each plugin has its own instructions to install some additional components.

4.4 pandoc

If you plan to publish the Markdown content in other formats, such as PDF and HTML, pandoc is a great tool with flexibility.

Note that with pandoc, there are many “filters” that can be installed to extend beyond the Markdown standard. Note that some extensions cannot be previewed using the vim or nvim previewer extensions.

4.5 pandoc filters

A pandoc filter is a program that is written in a certain way to expand the ability of pandoc.

5 Workflow