annotate runtime/ftplugin/clojure.vim @ 4676:9d3768ec9d74

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