Distraction Free Writing in Vim
Note: this post was originally published in 2014. I have decided to repost it for purposes of other sites that have linked to it.
Update 2014-12-31: Since writing this I have moved to using Vim-pencil instead of a lot of the custom config I had. I've updated this post to reflect that.
I recently switched to Vim as my primary text editor of choice. I may write a more lengthy post sometime about why I made this decision, and how the change is going. But for now here is quick write-up of my configuration for using Vim as a writing tool.
For starters, I use a few plugins:
- Goyo - Removes distractions and center text.
- Vim-pencil - Make the navigation and line wrapping better for writing.
- Vim-marked - Open files in Marked for Markdown preview and review.
Goyo is really the linchpin in this case to get everything aligned properly in the buffer and dare I say? Makes it look pretty.

That row of stuff along the bottom is my Tmux status line. I could hide it if I wanted. I'm choosing not too.
In addition to the plugins, I have some custom configuration in my .vimrc:
" " Markdown specific stuff. " " Change default app for Vim-marked. I have Marked2, but it is just called "Marked". Maybe because it is the non-AS version? let g:marked_app = "Marked" autocmd BufNewFile,BufReadPost *.md set filetype=markdown autocmd Filetype markdown call SetMarkdownOptions() function SetMarkdownOptions() " Enable spellcheck. set spell spelllang=en_us " Wrap text (without linebreak charecters) " I don't want to highlight the current line. highlight CursorLine ctermbg=NONE " Lastly, invoke Goyo plugin. Goyo endfunction " Vim-pencil stuff. augroup pencil autocmd! autocmd FileType markdown,mkd,md call pencil#init() autocmd FileType text call pencil#init() augroup ENDOverall I think this setup is opinionated as Vim stuff goes. It makes Vim behave more like a word processor and less like a traditional text editor.
Well, why would you want to do that!?
Simple. I believe that I can be more productive if I focus on having a single text editor that can perform all the tasks needed. This is one of the many great points outlined in The Pragmatic Programmer:
Use a Single Editor Well > > The editor should be an extension of your hand; make sure your editor is configurable, extensible, and programmable.
With Vim I can fulfill this principal in any environment. Even without a UI.