Getting Clojure Highlighting With Vim On Windows

Toralf Wittner wrote a good syntax file for Clojure but I had a hell of a time getting it to work on Windows, mostly because I’m not very smart and/or I didn’t bother to read the documentation for Vim. So sue me. Regardless, if you want to use Vim to edit Clojure scripts on Windows, save the file at the link above into your vimfiles/syntax folder and call it clojure.vim. The filename isn’t important but it makes it easy to see what syntax files are what. I’m currently just loading the file manually when I code in Clojure using :set ft=clojure and boom, you’ve got nice syntax highlighting.

You could probably set this up to automatically recognize .clj filetypes and turn syntax highlighting on for those but I’m going to stick with this small victory first. At least I learned SOMETHING today.

4 thoughts on “Getting Clojure Highlighting With Vim On Windows

  1. I packaged up Toralf’s syntax highlighting script and also provided indenting and other filetype plugin specific things for clojure. The whole package is called VimClojure and can be found at Eg. it also takes care to automatically set the clojure filetype, provides completion for clojure functions…..

    A sidenote: the name of the file you put in the syntax/ directory is *not* arbitrary! In must be identical to the filetype you set with :setfiletype. So when you call your filetype foobar, the file must be named foobar.vim.

    Hope this gives a pleasant Clojure journey in Vim.

    — Meikel

Leave a Reply

Your email address will not be published. Required fields are marked *