mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
186 lines
5.7 KiB
Plaintext
186 lines
5.7 KiB
Plaintext
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'clojure') == -1
|
|
|
|
*clojure.txt* Clojure runtime files
|
|
|
|
INTRODUCTION *clojure-introduction*
|
|
|
|
Meikel Brandmeyer's excellent Clojure runtime files. Includes syntax, indent,
|
|
ftdetect, and ftplugin scripts.
|
|
|
|
CLOJURE *ft-clojure-indent* *clojure-indent*
|
|
|
|
Clojure indentation differs somewhat from traditional Lisps, due in part to
|
|
the use of square and curly brackets, and otherwise by community convention.
|
|
These conventions are not universally followed, so the Clojure indent script
|
|
offers a few configurable options, listed below.
|
|
|
|
If the current vim does not include searchpairpos(), the indent script falls
|
|
back to normal 'lisp' indenting, and the following options are ignored.
|
|
|
|
*g:clojure_maxlines*
|
|
|
|
Set maximum scan distance of searchpairpos(). Larger values trade performance
|
|
for correctness when dealing with very long forms. A value of 0 will scan
|
|
without limits.
|
|
>
|
|
" Default
|
|
let g:clojure_maxlines = 100
|
|
<
|
|
*g:clojure_fuzzy_indent*
|
|
*g:clojure_fuzzy_indent_patterns*
|
|
*g:clojure_fuzzy_indent_blacklist*
|
|
|
|
The 'lispwords' option is a list of comma-separated words that mark special
|
|
forms whose subforms must be indented with two spaces.
|
|
|
|
For example:
|
|
>
|
|
(defn bad []
|
|
"Incorrect indentation")
|
|
|
|
(defn good []
|
|
"Correct indentation")
|
|
<
|
|
If you would like to specify 'lispwords' with a |pattern| instead, you can use
|
|
the fuzzy indent feature:
|
|
>
|
|
" Default
|
|
let g:clojure_fuzzy_indent = 1
|
|
let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let']
|
|
let g:clojure_fuzzy_indent_blacklist =
|
|
\ ['-fn$', '\v^with-%(meta|out-str|loading-context)$']
|
|
|
|
" Legacy comma-delimited string version; the list format above is
|
|
" recommended. Note that patterns are implicitly anchored with ^ and $
|
|
let g:clojure_fuzzy_indent_patterns = 'with.*,def.*,let.*'
|
|
<
|
|
|g:clojure_fuzzy_indent_patterns| and |g:clojure_fuzzy_indent_blacklist| are
|
|
|Lists| of patterns that will be matched against the unquoted, unqualified
|
|
symbol at the head of a list. This means that a pattern like "^foo" will match
|
|
all these candidates: "foobar", "my.ns/foobar", and "#'foobar".
|
|
|
|
Each candidate word is tested for special treatment in this order:
|
|
|
|
1. Return true if word is literally in 'lispwords'
|
|
2. Return false if word matches a pattern in
|
|
|g:clojure_fuzzy_indent_blacklist|
|
|
3. Return true if word matches a pattern in
|
|
|g:clojure_fuzzy_indent_patterns|
|
|
4. Return false and indent normally otherwise
|
|
|
|
*g:clojure_special_indent_words*
|
|
|
|
Some forms in Clojure are indented so that every subform is indented only two
|
|
spaces, regardless of 'lispwords'. If you have a custom construct that should
|
|
be indented in this idiosyncratic fashion, you can add your symbols to the
|
|
default list below.
|
|
>
|
|
" Default
|
|
let g:clojure_special_indent_words =
|
|
\ 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn'
|
|
<
|
|
*g:clojure_align_multiline_strings*
|
|
|
|
Align subsequent lines in multiline strings to the column after the opening
|
|
quote, instead of the same column.
|
|
|
|
For example:
|
|
>
|
|
(def default
|
|
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
|
|
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
|
|
enim ad minim veniam, quis nostrud exercitation ullamco laboris
|
|
nisi ut aliquip ex ea commodo consequat.")
|
|
|
|
(def aligned
|
|
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
|
|
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
|
|
enim ad minim veniam, quis nostrud exercitation ullamco laboris
|
|
nisi ut aliquip ex ea commodo consequat.")
|
|
<
|
|
This option is off by default.
|
|
>
|
|
" Default
|
|
let g:clojure_align_multiline_strings = 0
|
|
<
|
|
*g:clojure_align_subforms*
|
|
|
|
By default, parenthesized compound forms that look like function calls and
|
|
whose head subform is on its own line have subsequent subforms indented by
|
|
two spaces relative to the opening paren:
|
|
>
|
|
(foo
|
|
bar
|
|
baz)
|
|
<
|
|
Setting this option changes this behavior so that all subforms are aligned to
|
|
the same column, emulating the default behavior of clojure-mode.el:
|
|
>
|
|
(foo
|
|
bar
|
|
baz)
|
|
<
|
|
This option is off by default.
|
|
>
|
|
" Default
|
|
let g:clojure_align_subforms = 0
|
|
<
|
|
|
|
CLOJURE *ft-clojure-syntax*
|
|
|
|
The default syntax groups can be augmented through the
|
|
*g:clojure_syntax_keywords* and *b:clojure_syntax_keywords* variables. The
|
|
value should be a |Dictionary| of syntax group names to a |List| of custom
|
|
identifiers:
|
|
>
|
|
let g:clojure_syntax_keywords = {
|
|
\ 'clojureMacro': ["defproject", "defcustom"],
|
|
\ 'clojureFunc': ["string/join", "string/replace"]
|
|
\ }
|
|
<
|
|
Refer to the Clojure syntax script for valid syntax group names.
|
|
|
|
If the |buffer-variable| *b:clojure_syntax_without_core_keywords* is set, only
|
|
language constants and special forms are matched.
|
|
|
|
Setting *g:clojure_fold* enables folding Clojure code via the syntax engine.
|
|
Any list, vector, or map that extends over more than one line can be folded
|
|
using the standard Vim |fold-commands|.
|
|
|
|
Please note that this option does not work with scripts that redefine the
|
|
bracket syntax regions, such as rainbow-parentheses plugins.
|
|
|
|
This option is off by default.
|
|
>
|
|
" Default
|
|
let g:clojure_fold = 0
|
|
<
|
|
|
|
ABOUT *clojure-about*
|
|
|
|
This document and associated runtime files are maintained at:
|
|
https://github.com/guns/vim-clojure-static
|
|
|
|
Distributed under the Vim license. See |license|.
|
|
|
|
syntax/clojure.vim
|
|
|
|
Copyright 2007-2008 (c) Toralf Wittner <toralf.wittner@gmail.com>
|
|
Copyright 2008-2012 (c) Meikel Brandmeyer <mb@kotka.de>
|
|
|
|
ftdetect/clojure.vim,
|
|
ftplugin/clojure.vim,
|
|
indent/clojure.vim
|
|
|
|
Copyright 2008-2012 (c) Meikel Brandmeyer <mb@kotka.de>
|
|
|
|
Modified and relicensed under the Vim License for distribution with Vim:
|
|
|
|
Copyright 2013-2014 (c) Sung Pae <self@sungpae.com>
|
|
|
|
Last Change: %%RELEASE_DATE%%
|
|
|
|
vim:tw=78:noet:sw=8:sts=8:ts=8:ft=help:norl:
|
|
|
|
endif
|