vim / Marked

Reading time:
1 min. | 96 words

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>

About

Greetings! My name is Jason Heppler. I am a Digital Engagement Librarian and Assistant Professor of History 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.

Where

Search