1" Vim filetype plugin file 2" Language: Clojure 3" Author: Meikel Brandmeyer <[email protected]> 4" 5" Maintainer: Sung Pae <[email protected]> 6" URL: https://github.com/guns/vim-clojure-static 7" License: Same as Vim 8" Last Change: 08 September 2013 9 10if exists("b:did_ftplugin") 11 finish 12endif 13let b:did_ftplugin = 1 14 15let s:cpo_save = &cpo 16set cpo&vim 17 18let b:undo_ftplugin = 'setlocal iskeyword< define< formatoptions< comments< commentstring<' 19 20setlocal iskeyword+=?,-,*,!,+,/,=,<,>,.,:,$ 21 22" There will be false positives, but this is better than missing the whole set 23" of user-defined def* definitions. 24setlocal define=\\v[(/]def(ault)@!\\S* 25 26" Remove 't' from 'formatoptions' to avoid auto-wrapping code. The '+=croql' 27" is standard ftplugin boilerplate, although it is arguably intrusive. 28setlocal formatoptions-=t formatoptions+=croql 29 30" Lisp comments are routinely nested (e.g. ;;; SECTION HEADING) 31setlocal comments=n:; 32setlocal commentstring=;\ %s 33 34" Provide insert mode completions for special forms and clojure.core. As 35" 'omnifunc' is set by popular Clojure REPL client plugins, we also set 36" 'completefunc' so that the user has some form of completion available when 37" 'omnifunc' is set and no REPL connection exists. 38for s:setting in ['omnifunc', 'completefunc'] 39 if exists('&' . s:setting) && empty(eval('&' . s:setting)) 40 execute 'setlocal ' . s:setting . '=clojurecomplete#Complete' 41 let b:undo_ftplugin .= ' | setlocal ' . s:setting . '<' 42 endif 43endfor 44 45" Take all directories of the CLOJURE_SOURCE_DIRS environment variable 46" and add them to the path option. 47" 48" This is a legacy option for VimClojure users. 49if exists('$CLOJURE_SOURCE_DIRS') 50 for s:dir in split($CLOJURE_SOURCE_DIRS, (has("win32") || has("win64")) ? ';' : ':') 51 let s:dir = fnameescape(s:dir) 52 " Whitespace escaping for Windows 53 let s:dir = substitute(s:dir, '\', '\\\\', 'g') 54 let s:dir = substitute(s:dir, '\ ', '\\ ', 'g') 55 execute "setlocal path+=" . s:dir . "/**" 56 endfor 57 let b:undo_ftplugin .= ' | setlocal path<' 58endif 59 60" Skip brackets in ignored syntax regions when using the % command 61if exists('loaded_matchit') 62 let b:match_words = &matchpairs 63 let b:match_skip = 's:comment\|string\|regex\|character' 64 let b:undo_ftplugin .= ' | unlet! b:match_words b:match_skip' 65endif 66 67" Win32 can filter files in the browse dialog 68if has("gui_win32") && !exists("b:browsefilter") 69 let b:browsefilter = "Clojure Source Files (*.clj)\t*.clj\n" . 70 \ "ClojureScript Source Files (*.cljs)\t*.cljs\n" . 71 \ "Java Source Files (*.java)\t*.java\n" . 72 \ "All Files (*.*)\t*.*\n" 73 let b:undo_ftplugin .= ' | unlet! b:browsefilter' 74endif 75 76let &cpo = s:cpo_save 77 78unlet! s:cpo_save s:setting s:dir 79 80" vim:sts=8:sw=8:ts=8:noet 81