Using Markdown in vim
Considering this is my first Rails project, it definitely lacks a certain… sophistication. For example, posts are either published and live, or don’t exist yet. And also, I don’t have any autosave mechanism.
These two areas of want combined to make me a very sad panda one day. After writing up the post of the day, I may have restarted my computer, forgetting that I had a lovely work of writing in progress. Whoops. Got a little upset by that.
Until I have time to implement those two features, I found a suitable stop-gap: vim! So I’ve taken to simply writing stuff up in vim, and when it’s ready, copy, paste, and publish. Easy peasy.
But where would vim be without some syntax highlighting? NOWHERE! Well, it’s still pretty awesome regardless, but I don’t think many would disagree that syntax highlighting is a bad thing.
Download this, and place it in ~/.vim/syntax/ (of course, creating it if it doesn’t exist).
Now create, or add to ~/.vim/filetype.vim:
" markdown filetype file if exists("did\_load\_filetypes") finish endif augroup markdown au! BufRead,BufNewFile *.mkd setfiletype mkd augroup END
And then to ~/.vimrc and/or ~/.gvimrc
augroup mkd autocmd BufRead *.mkd set ai formatoptions=tcroqn2 comments=n:> augroup END
I kind of feel like a plugin, or something, could take care of this for you, but I don’t know enough vim voodoo to sure.
Now you have vim markdown goodness… Enjoy!