Opening Marked in Vim

Jason Heppler

I am a big fan of Brett Terpstra’s Marked.app 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 Marked.app '%: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 Marked.app '%:p' :redraw!<cr>
This is a note — a shorter observation, sometimes provisional or incomplete. ~0.015g CO2 Tech life
Jason Heppler
Jason A. Heppler
Environmental & Digital Historian
Newsletter

Tack & Ink

Occasional writing on the American West, agricultural history, and political culture.