VIM dances with markdown


As the God of editors, what kind of sparks will VIM create when it is used for editing and reading markdown?

Because I can’t stand the editing experience of a certain knowledge note, I explored the possible solutions for editing and managing markdown notes in VIM some time ago. Finally, I found a solution that I thought was good, even better than many markdown editors.

Syntax highlighting

As a plain text format, how to quickly find the required content in markdown documents is a key factor affecting the editing experience of markdown. As the best state, if the editing can provide the same layout or style as reading, markdown can be written efficiently and concisely. Therefore, a good markdown editor should be able to reduce markdown as much as possibleThe sense of separation between editing and reading

Syntax highlighting is a better solution. Imagine that if bold and italics are used for highlighting, and code blocks and links are highlighted in the same style as when rendering, editing and reading are almost the same thing.

VIM used to support markdown’s syntax highlighting, but it didn’t do enough. I use the gabrielelana / VIM markdown plug-in to enhance highlighting. In addition, in order to meet other needs, I fork the plug-in to make some improvements in tamlok / VIM markdown.

In addition, the color scheme used is tamlok / detorte. This color scheme supports two themes, light color and dark color, which are relatively soft. For the abovevim-markdownThe plug-in has been specially adapted.

Let’s start with a rendering:

VIM dances with markdown

You can see:

  1. normal modeandinsert modeIt’s all bold,Combination commandIn italics;

  2. The title is also distinguished according to different levels, and it is displayed in bold, clear and eye-catching;

  3. In line code, such asN<command>Use a preview like style to display (grayed out);

  4. The ordinal number, table and link of the ordered list also have very good differentiation;

  5. Using VimConcealProperty that appropriately hides non content tags, such as bold**Italic*, tags of in-line code, URL parts of links, etc. In this way, it can avoid a lot of marks that are distracting.

Through grammar highlighting, it is easy to grasp the content and structure of the article.

In addition, for code blocks, another plug-in, joker1007 / VIM markdown quote syntax, is recommended. It supports code syntax highlighting in code blocks, which is very cool.

Render Preview

Because you often need to work on windows and Linux, you need a rendering plug-in that supports both platforms.

Iamcco / markdown-preview.vim is a markdown preview plug-in that supports windows, Linux and Mac OS at the same time. With the following configuration, you can preview the current notes with one key.

let g:mkdp_path_to_chrome="chrome"
let g:mkdp_auto_close=0
nmap <F7> <Plug>MarkdownPreview
nmap <F8> <Plug>StopMarkdownPreview


The outline is helpful to grasp the structure of the article and control the article as a whole.

When it comes to the outline, we must mention the famous majutsushi / tagbar. However, the plug-in does not support markdown by default.

In fact, it mainly produces the output of ctags format,tagbarCan be rendered. There are many online tutorials, for example, just add to implementtagbarThe outline catalog of markdown is shown in.

The effect is as follows:

VIM dances with markdown

Note taking management

Note management can be done directly by using the plug-in scrolloose / nerdtree. The plug-in also supports favorites, which can correspond to the concept of notebook.

VIM dances with markdown


VIM has powerful search and search functions, so it can be used for plain text markdown. There’s not much to say here, like:vimgrep, ggreer / the silver searcher, etc.


After tossing around, there is no problem in editing markdown notes under VIM, especially syntax highlighting and continuous features, which can reduce markdown’s inherent sense of separation as much as possible.

However, it’s a pity that GVIM doesn’t support displaying pictures, otherwise, how nice it would be if we could preview picture links when editing? In addition, for pictures, manual management is also needed, which is also a pity.

At work, I used this solution to record markdown notes for about two months. Later, I couldn’t help it. Based on these advantages of vim, I struggled with a markdown note taking softwareVNote, in the work completely replaced some knowledge notes, ha ha!


Highly recommend one! GitHub project home page, a previously written introductory article, segmentfault vNote.