writer vim

Published on 24 Apr 2018

This is not a vim plugin. I am not that smart to code a plugin. Rather, I am just writing a note here on how I am using Vim to write stuff, mostly blog entries for Caspershire & Caspershire Meta.

Note that I prefer writing using gvim (Arch linux: sudo pacman -S gvim) rather than using in-terminal vim, mostly because I am trying to retain sanity.

To enter my zen writing mode, here are the plugins I am currently using:

  1. Goyo. It has the iA Writer feels.
  2. Limelight, best coupled with Goyo.
  3. vim-pencil, makes writing a better experience.
  4. vim-grammarous, a grammar checker.
  5. vim-wordy to identify word misuse.
  6. Latest Vim, which is Vim 8. Vim 7 is a thing of the past.

These plugins best be installed with a plugin manager. I always go with Vundle because that’s what I started with at first.

I have this (kind of) config file for my writer mode here ~/.vim/writer.vim. Here’s the content:

SoftPencil 
colorscheme pencil
set background=light
Goyo
Limelight

In this current form, my Writer Mode is basically usable. When I am writing and my current buffer is a markdown file, I simply call my writer mode by issuing :source ~/.vim/writer.vim and magic happens. However, ain’t nobody got time to write this long command. Hence, I mapped this in my ~/.vimrc.

nnoremap <space>wr :source ~/.vim/writer.vim<cr>

So to get into my zen writing mode, I simply press <space>, sequentially followed by w and r. The only downside is that I need to quit twice, because the first :q to close Goyo and another :q to exit Vim.

Zen Writer Zen Writer activated!

I treat my <space> key as my leader key for two reasons: I am also using Emacs with Spacemacs distribution where the leader key is <space> and because the <space> key is big I can hit this key with 99.99% accuracy even while I am sleeping.

For proofing, I first use :set spell spelllang=en_us to enable Vim’s built-in spell-checking, in which I mapped this key to <space> followed by s key twice.

nnoremap <space>ss :set spell spelllang=en_us<cr>

As for checking the grammar, I call :GrammarousCheck. For some weird reason, it is better to run this grammar checking when Goyo is off. To turn off Goyo, just issue :Goyo. Sometimes I also use :Wordy to gauge the quality of my writing.


Note 01: I set the font in gvim to use Cousine Regular (10 pt) because I like how it looks.

Note 02: I like to complicate things. I am running gvim on a virtualized Arch linux because we don’t have a gvim for macOS or Windows. Although the setup is time-consuming, but I like the result. There is Oni, a GUI front-end for Vim but it is based on Electron. It beats the purpose of Vim itself. Vim is supposed to be lightweight, and Electron is exactly the opposite of that.