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>
About Jason

I am a digital historian at the University of Nebraska at Omaha and a scholar of the twentieth-century United States. I often write here about the history of the North American West, technology, the environment, politics, culture, and coffee. You can follow me on Twitter, or learn more about me.

This was written on October 16, 2012 | 1 minute read | 151 Words
Filed under: vim marked

← Read more essays