Mercurial > vim
annotate runtime/ftplugin/clojure.vim @ 29882:5454d999bbd4
Added tag v9.0.0279 for changeset 0cc9a300171720b99acf0a10f50ea8d8619a13a2
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 26 Aug 2022 18:00:05 +0200 |
parents | e3d6184b89fa |
children | 8ae680be2a51 |
rev | line source |
---|---|
4098 | 1 " Vim filetype plugin file |
23931 | 2 " Language: Clojure |
26100 | 3 " Maintainer: Alex Vear <alex@vear.uk> |
23931 | 4 " Former Maintainers: Sung Pae <self@sungpae.com> |
5 " Meikel Brandmeyer <mb@kotka.de> | |
6 " URL: https://github.com/clojure-vim/clojure.vim | |
7 " License: Vim (see :h license) | |
28246 | 8 " Last Change: 2022-03-24 |
4098 | 9 |
10 if exists("b:did_ftplugin") | |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
4098
diff
changeset
|
11 finish |
4098 | 12 endif |
13 let b:did_ftplugin = 1 | |
14 | |
15 let s:cpo_save = &cpo | |
16 set cpo&vim | |
17 | |
5734 | 18 let b:undo_ftplugin = 'setlocal iskeyword< define< formatoptions< comments< commentstring< lispwords<' |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
4098
diff
changeset
|
19 |
26100 | 20 setlocal iskeyword+=?,-,*,!,+,/,=,<,>,.,:,$,%,&,\| |
4098 | 21 |
22 " There will be false positives, but this is better than missing the whole set | |
23 " of user-defined def* definitions. | |
24 setlocal define=\\v[(/]def(ault)@!\\S* | |
25 | |
5763 | 26 " Remove 't' from 'formatoptions' to avoid auto-wrapping code. |
27 setlocal formatoptions-=t | |
4098 | 28 |
29 " Lisp comments are routinely nested (e.g. ;;; SECTION HEADING) | |
30 setlocal comments=n:; | |
31 setlocal commentstring=;\ %s | |
32 | |
5734 | 33 " Specially indented symbols from clojure.core and clojure.test. |
34 " | |
35 " Clojure symbols are indented in the defn style when they: | |
36 " | |
37 " * Define vars and anonymous functions | |
38 " * Create new lexical scopes or scopes with altered environments | |
39 " * Create conditional branches from a predicate function or value | |
40 " | |
41 " The arglists for these functions are generally in the form of [x & body]; | |
42 " Functions that accept a flat list of forms do not treat the first argument | |
43 " specially and hence are not indented specially. | |
44 " | |
5763 | 45 " -*- LISPWORDS -*- |
28246 | 46 " Generated from https://github.com/clojure-vim/clojure.vim/blob/fd280e33e84c88e97860930557dba3ff80b1a82d/clj/src/vim_clojure_static/generate.clj |
5763 | 47 setlocal lispwords=as->,binding,bound-fn,case,catch,cond->,cond->>,condp,def,definline,definterface,defmacro,defmethod,defmulti,defn,defn-,defonce,defprotocol,defrecord,defstruct,deftest,deftest-,deftype,doseq,dotimes,doto,extend,extend-protocol,extend-type,fn,for,if,if-let,if-not,if-some,let,letfn,locking,loop,ns,proxy,reify,set-test,testing,when,when-first,when-let,when-not,when-some,while,with-bindings,with-in-str,with-local-vars,with-open,with-precision,with-redefs,with-redefs-fn,with-test |
5734 | 48 |
4098 | 49 " Provide insert mode completions for special forms and clojure.core. As |
50 " 'omnifunc' is set by popular Clojure REPL client plugins, we also set | |
51 " 'completefunc' so that the user has some form of completion available when | |
52 " 'omnifunc' is set and no REPL connection exists. | |
53 for s:setting in ['omnifunc', 'completefunc'] | |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
4098
diff
changeset
|
54 if exists('&' . s:setting) && empty(eval('&' . s:setting)) |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
4098
diff
changeset
|
55 execute 'setlocal ' . s:setting . '=clojurecomplete#Complete' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
4098
diff
changeset
|
56 let b:undo_ftplugin .= ' | setlocal ' . s:setting . '<' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
4098
diff
changeset
|
57 endif |
4098 | 58 endfor |
59 | |
60 " Skip brackets in ignored syntax regions when using the % command | |
61 if exists('loaded_matchit') | |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
4098
diff
changeset
|
62 let b:match_words = &matchpairs |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
4098
diff
changeset
|
63 let b:match_skip = 's:comment\|string\|regex\|character' |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
4098
diff
changeset
|
64 let b:undo_ftplugin .= ' | unlet! b:match_words b:match_skip' |
4098 | 65 endif |
66 | |
26100 | 67 " Filter files in the browse dialog |
68 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") | |
28246 | 69 let b:browsefilter = "All Files\t*\n" . |
70 \ "Clojure Files\t*.clj;*.cljc;*.cljs;*.cljx\n" . | |
71 \ "EDN Files\t*.edn\n" . | |
72 \ "Java Files\t*.java\n" | |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
4098
diff
changeset
|
73 let b:undo_ftplugin .= ' | unlet! b:browsefilter' |
4098 | 74 endif |
75 | |
76 let &cpo = s:cpo_save | |
77 | |
78 unlet! s:cpo_save s:setting s:dir | |
79 | |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
4098
diff
changeset
|
80 " vim:sts=8:sw=8:ts=8:noet |