Skip to content
Vim

How I vim

The simple Vim setup I use for writing, and the one function that turns it into a word processor.

I’ve been enjoying writing in vim a lot more.

There is now great support for writing code, especially Go. To get started with programming in Vim in Go, clone the latest vim-go:

$ git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go

Then run Vim and use the command :GoInstallBinaries which will install the necessary programs.

There is a nice and simple way to make writing a lot easier (word wrapping, nice color scheme), add the a WordProcessorMode.

You can just make the following config file (save as ~/.vimrc):

filetype plugin indent on
let g:go_fmt_command = "goimports"
func! WordProcessorMode() set columns=80 setlocal formatoptions=1 setlocal noexpandtab map j gj map k gk setlocal spell spelllang=en_us set complete+=s set formatprg=par setlocal wrap setlocal linebreak set foldcolumn=3 highlight Normal ctermfg=black ctermbg=grey hi NonText ctermfg=grey guifg=grey
endfu
com! WP call WordProcessorMode()

Then, while in vim you can activate the word processing mode by typing :WP.

Reference shelf

A short shelf of sources and related reading. Opens in a new tab.