Opening Marked in Vim

I am a big fan of Brett Terpstra’s for previewing Markdown documents. I wanted a way to launch Marked from within vim so I can preview what I’m writing as I am working. The task is easy. In your .vimrc file, add the line:

:nnoremap <leader>ma :silent !open -a '%:p'<cr>

I have my leader mapped to , (comma), so if I want to launch Marked in a markdown file I’m writing, I just type ,ma and it launches the app.

UPDATE 10/16/12
Lincoln Mullen points out that console vim does not redraw after :silent and modified the command slightly:

:nnoremap <leader>ma :silent !open -a '%:p' :redraw!<cr>

October 16, 2012 @jaheppler

Tagged in: vim