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