Meikel  Brandmeyer avatar Meikel Brandmeyer committed e8d8859

Initial check-in

Comments (0)

Files changed (6)

+This archive contains a syntax file, a filetype plugin and an indent plugin
+for clojure.
+
+The syntax is maintained by Toralf Wittner <toralf.wittner@gmail.com>. I
+included it with his permission. All kudos for the highlighting go to Toralf.
+
+Additionally I created a (currently relatively simple) filetype and indent
+plugin. The blame for those go to me.
+
+To setup the plugins copy the contents of this archive to your ~/.vim directory.
+The ftdetect/clojure.vim sets up an autocommand to automatically detect .clj
+files as clojure files. The rest works automagically when you enabled the
+corresponding features (see :help :filetype).
+
+-- Meikel Brandmeyer <mb@kotka.de>
+   Frankfurt am Main, June 21st 2008

ftdetect/clojure.vim

+au BufNewFile,BufRead *.clj setfiletype clojure

ftplugin/clojure.vim

+" Vim filetype plugin file
+" Language:     Clojure
+" Maintainer:   Meikel Brandmeyer <mb@kotka.de>
+" Last Change:  2008 Jun 21
+
+" Only do this when not done yet for this buffer
+if exists("b:did_ftplugin")
+	finish
+endif
+
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+let b:undo_ftplugin = "setlocal fo< com< cms<"
+
+" Set 'formatoptions' to break comment lines but not other lines,
+" and insert the comment leader when hitting <CR> or using "o".
+setlocal formatoptions-=t formatoptions+=croql
+setlocal commentstring=;%s
+
+" Set 'comments' to format dashed lists in comments.
+setlocal comments=sO:;\ -,mO:;\ \ ,n:;
+
+" When the matchit plugin is loaded, this makes the % command skip parens and
+" braces in comments.
+let b:match_words = &matchpairs
+let b:match_skip = 's:comment\|string\|character'
+
+" Win32 can filter files in the browse dialog
+if has("gui_win32") && !exists("b:browsefilter")
+	let b:browsefilter = "Clojure Source Files (*.clj)\t*.clj\n" .
+				\ "Jave Source Files (*.java)\t*.java\n" .
+				\ "All Files (*.*)\t*.*\n"
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save

indent/clojure.vim

+" Vim indent file
+" Language:      Clojure
+" Maintainer:    Meikel Brandmeyer <mb@kotka.de>
+" Last Change:   2008 Jun 21
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+	finish
+endif
+let b:did_indent = 1
+
+let b:undo_indent = "setlocal ai< si< lisp< lw< et<"
+setlocal autoindent lisp expandtab nosmartindent
+
+" Defintions:
+setlocal lispwords=def,defn,defmacro,defmethod,let,fn,binding
+
+" Conditionals and Loops:
+setlocal lispwords+=if,when,when-not,when-first,cond,loop,dotimes,for
+
+" Blocks:
+setlocal lispwords+=do,doto,try,catch,locking,with-out-str,with-open
+setlocal lispwords+=dosync,with-local-vars,doseq

syntax/clojure.vim

+" Vim syntax file
+" Language:	   Clojure
+" Last Change: 2008-05-14
+" Maintainer:  Toralf Wittner <toralf.wittner@gmail.com>
+
+if version < 600
+    syntax clear
+elseif exists("b:current_syntax")
+    finish
+endif
+
+setl iskeyword+=?,-,*,!,+,/,=,<,>
+
+syn match clojureComment ";.*$"
+syn match clojureKeyword ":\a[a-zA-Z0-9?!\-_+*\./=<>]*"
+syn region clojureString start=/"/ end=/"/ skip=/\\"/
+syn match clojureCharacter "\\."
+syn match clojureCharacter "\\[0-7]\{3\}"
+syn match clojureCharacter "\\u[0-9]\{4\}"
+syn match clojureCharacter "\\space"
+syn match clojureCharacter "\\tab"
+syn match clojureCharacter "\\newline"
+syn match clojureCharacter "\\backspace"
+syn match clojureCharacter "\\formfeed"
+
+syn match clojureNumber "\<-\?[0-9]\+\>"
+syn match clojureRational "\<-\?[0-9]\+/[0-9]\+\>"
+syn match clojureFloat "\<-\?[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
+
+syn keyword clojureSyntax fn fn* if def let let* loop* new recur loop do quote the-var identical? throw set! monitor-enter monitor-exit try catch finally in-ns
+syn match clojureSyntax "(\s*\(\.\.\|\.\)"hs=s+1
+
+syn region clojureDef matchgroup=clojureSyntax start="(\s*\(defmethod\|defmulti\|defmacro\|defstruct\|defn\|def\)\(\s\|\n\)\+"hs=s+1 end="\ze[\[('":)]\|\ze\(#^\)\@<!{" contains=ALLBUT,clojureFunc
+syn match clojureDefName "\<[^0-9][a-zA-Z0-9\?!\-\+\*\./<>=]*\>" contained
+
+syn region clojureVector matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALLBUT,clojureDefName
+syn region clojureMap matchgroup=Delimiter start="{" matchgroup=Delimiter end="}" contains=ALLBUT,clojureDefName
+
+syn match clojureNil "\<nil\>"
+syn match clojureQuote "\('\|`\)"
+syn match clojureUnquote "\(\~@\|\~\)"
+syn match clojureDispatch "\(#^\|#'\)"
+syn match clojureAnonFn "#\ze("
+syn match clojurePattern /#\ze"/
+syn match clojureSet "#\ze{"
+syn match clojureVarArg "&" containedin=clojureVector
+syn keyword clojureBoolean true false
+
+highlight link clojureComment Comment
+highlight link clojureString String
+highlight link clojureCharacter Character
+highlight link clojureNumber Number
+highlight link clojureFloat Number
+highlight link clojureRational Number
+highlight link clojureKeyword PreProc
+highlight link clojureSyntax Statement
+highlight link clojureDefName Function
+highlight link clojureNil Constant
+highlight link clojureQuote Macro
+highlight link clojureAnonFn Macro
+highlight link clojurePattern Macro
+highlight link clojureSet Macro
+highlight link clojureUnquote Delimiter
+highlight link clojureDispatch Constant
+highlight link clojureVarArg Number
+highlight link clojureBoolean Constant
+
+if exists("g:clj_highlight_builtins")
+    "Highlight Clojure's predefined functions"
+    syn keyword clojureFunc ! * *agent* *command-line-args* *in* *macro-meta* *ns* *out* *print-meta* *print-readably* *proxy-classes* *warn-on-reflection* + - -> .. / < <= = == > >= accessor agent agent-errors aget alength all-ns alter and apply array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc await await-for bean binding bit-and bit-not bit-or bit-shift-left bit-shift-right bit-xor boolean butlast byte cast char class clear-agent-errors comment commute comp comparator complement concat cond conj cons constantly construct-proxy contains? count create-ns create-struct cycle dec defmacro defmethod defmulti defn defn- defstruct deref destructure disj dissoc distinct doall doc dorun doseq dosync dotimes doto double drop drop-while ensure eval every? false? ffirst file-seq filter find find-doc find-ns find-var first float flush fnseq for frest gensym get get-proxy-class hash-map hash-set identity if-let import inc instance? int interleave into into-array iterate key keys keyword keyword? last lazy-cat lazy-cons line-seq list list* load load-file locking long macroexpand macroexpand-1 make-array map map? mapcat max max-key memfn merge merge-with meta min min-key name namespace neg? newline nil? not not-any? not-every? not= ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unmap nth nthrest or partial peek pmap pop pos? pr pr-str print print-doc print-str println println-str prn prn-str proxy proxy-mappings quot rand rand-int range re-find re-groups re-matcher re-matches re-pattern re-seq read read-line reduce ref ref-set refer rem remove-method remove-ns repeat replace replicate require resolve rest resultset-seq reverse rfirst rrest rseq scan second select-keys send send-off seq seq? set short slurp some sort sort-by sorted-map sorted-map-by sorted-set special-symbol? split-at split-with str string? struct struct-map subs subvec symbol symbol? sync take take-nth take-while test time to-array to-array-2d touch tree-seq true? update-proxy val vals var-get var-set var? vector vector? when when-first when-let when-not with-local-vars with-meta with-open with-out-str xml-seq zero? zipmap repeatedly add-classpath vec hash
+    highlight link clojureFunc Special
+endif
+
+let b:current_syntax = "clojure"
+
+
+  version.txt -- Version Information for vimclojure (syntax: Text)
+  [automatically generated and maintained by GNU shtool]
+
+  This is vimclojure, Version 1.0.0 (24-Jun-2008)
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.