PageRenderTime 93ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 0ms

/bundle/vim-clojure-static/README.markdown

https://github.com/cristibalan/.vim
Markdown | 296 lines | 213 code | 83 blank | 0 comment | 0 complexity | 46e27e68eeb2ba6a7da841d3e21e5901 MD5 | raw file
Possible License(s): MIT, WTFPL, BSD-3-Clause, BSD-2-Clause
  1. o8o
  2. '"'
  3. oooo ooooooo ooo. .oo. .oo.
  4. `88. .8' `888 `888P"Y88bP"Y88b
  5. `88..8' 888 888 888 888
  6. `888' 888 888 888 888
  7. `8' o888oo888o o888o o888o
  8. oooo o8o
  9. `888 '"'
  10. .ooooo. 888 .ooooo. oooooooo oooo oooo d8b .ooooo.
  11. d88' `"Y8 888 d88' `88b`888`888 `888 `888""8Pd88' `88b
  12. 888 888 888 888 888 888 888 888 888ooo888
  13. 888 .o8 888 888 888 888 888 888 888 888 .o
  14. `Y8bod8P'o888o`Y8bod8P' 888 `V88V"V8P'd888b `Y8bod8P'
  15. 888
  16. .o. 88P
  17. . `Y888P . o8o
  18. .o8 .o8 '"'
  19. .oooo.o.o888oo .oooo. .o888oooooo .ooooo.
  20. d88( "8 888 `P )88b 888 `888 d88' `"Y8
  21. `"Y88b. 888 .oP"888 888 888 888
  22. o. )88b 888 .d8( 888 888 . 888 888 .o8
  23. 8""888P' "888"`Y888""8o "888"o888o`Y8bod8P'
  24. Meikel Brandmeyer's excellent Clojure runtime files, extracted from the
  25. [VimClojure](http://www.vim.org/scripts/script.php?script_id=2501) project for
  26. use with alternate Clojure REPL plugins.
  27. These files ship with Vim versions 7.3.803 and later, and are periodically
  28. merged into the official Vim repository.
  29. Installation
  30. ============
  31. If you are running an old version of Vim or if you would like to keep up with
  32. development, you can install this repository like a standard Vim plugin.
  33. If you are unfamiliar with this process, refer to
  34. the [Pathogen](https://github.com/tpope/vim-pathogen) project.
  35. Please make sure that the following options are set in your vimrc to enable
  36. all features:
  37. ```vim
  38. syntax on
  39. filetype plugin indent on
  40. ```
  41. Features
  42. ========
  43. * [Augmentable](#syntax-options) syntax highlighting for Clojure and
  44. ClojureScript buffers.
  45. * [Configurable](#indent-options) Clojure-specific indentation.
  46. * Basic insert mode completion for special forms and public vars in
  47. `clojure.core`.
  48. This is bound to both the `'omnifunc'` and `'completefunc'` options, which
  49. can be invoked with the insert mode mappings `<C-X><C-O>` and `<C-X><C-U>`
  50. respectively.
  51. If you install this project as a plugin, `*.edn` files are recognized as a
  52. Clojure filetype, overriding the built-in declaration as `edif`.
  53. Third Party Extensions
  54. ======================
  55. * Rainbow Parentheses
  56. kien's [`rainbow_parentheses.vim`](https://github.com/kien/rainbow_parentheses.vim)
  57. is highly recommended.
  58. * Extended Syntax Highlighting
  59. [`vim-clojure-highlight`](https://github.com/guns/vim-clojure-highlight) is
  60. a fireplace.vim plugin that extends syntax highlighting to local, referred,
  61. and aliased vars via [`b:clojure_syntax_keywords`](#syntax-options).
  62. This is a reimplementation of the DynamicHighlighting feature from
  63. VimClojure.
  64. Clojure REPL Plugins
  65. ====================
  66. If you would like to get more serious about programming in Clojure, consider
  67. using an interactive
  68. [Clojure REPL plugin](https://github.com/guns/vim-clojure-static/wiki/Clojure-REPL-Plugins).
  69. Syntax Options
  70. ==============
  71. Syntax highlighting for public vars from `clojure.core` is provided by
  72. default, but any symbol can be matched and highlighted by adding it to the
  73. `g:clojure_syntax_keywords` or `b:clojure_syntax_keywords` variables:
  74. ```vim
  75. let g:clojure_syntax_keywords = {
  76. \ 'clojureMacro': ["defproject", "defcustom"],
  77. \ 'clojureFunc': ["string/join", "string/replace"]
  78. \ }
  79. ```
  80. See `s:clojure_syntax_keywords` in the [syntax script](syntax/clojure.vim) for
  81. a complete example.
  82. The global version of this variable is intended for users that always wish
  83. to have a certain set of symbols highlighted in a certain way, while the
  84. buffer-local version is intended for plugin authors who wish to highlight
  85. symbols dynamically.
  86. If the buffer flag `b:clojure_syntax_without_core_keywords` is set, vars from
  87. `clojure.core` are not highlighted by default. This is useful for highlighting
  88. namespaces that have set `(:refer-clojure :only [])`.
  89. [`vim-clojure-highlight`](https://github.com/guns/vim-clojure-highlight) uses
  90. these variables to highlight extra vars when connected to a REPL.
  91. Indent Options
  92. ==============
  93. Clojure indentation differs somewhat from traditional Lisps, due in part to
  94. the use of square and curly brackets, and otherwise by community convention.
  95. These conventions are not universally followed, so the Clojure indent script
  96. offers a few configurable options, listed below.
  97. If the current vim does not include searchpairpos(), the indent script falls
  98. back to normal `'lisp'` indenting, and the following options are ignored.
  99. ### `g:clojure_maxlines`
  100. Set maximum scan distance of searchpairpos(). Larger values trade performance
  101. for correctness when dealing with very long forms. A value of 0 will scan
  102. without limits.
  103. ```vim
  104. " Default
  105. let g:clojure_maxlines = 100
  106. ```
  107. ### `g:clojure_fuzzy_indent`, `g:clojure_fuzzy_indent_patterns`, `g:clojure_fuzzy_indent_blacklist`
  108. The `'lispwords'` option is a list of comma-separated words that mark special
  109. forms whose subforms must be indented with two spaces.
  110. For example:
  111. ```clojure
  112. (defn bad []
  113. "Incorrect indentation")
  114. (defn good []
  115. "Correct indentation")
  116. ```
  117. If you would like to specify `'lispwords'` with a pattern instead, you can use
  118. the fuzzy indent feature:
  119. ```vim
  120. " Default
  121. let g:clojure_fuzzy_indent = 1
  122. let g:clojure_fuzzy_indent_patterns = ['^with', '^def', '^let']
  123. let g:clojure_fuzzy_indent_blacklist = ['-fn$', '\v^with-%(meta|out-str|loading-context)$']
  124. " Legacy comma-delimited string version; the list format above is
  125. " recommended. Note that patterns are implicitly anchored with ^ and $.
  126. let g:clojure_fuzzy_indent_patterns = 'with.*,def.*,let.*'
  127. ```
  128. `g:clojure_fuzzy_indent_patterns` and `g:clojure_fuzzy_indent_blacklist` are
  129. lists of patterns that will be matched against the unqualified symbol at the
  130. head of a list. This means that a pattern like `"^foo"` will match all these
  131. candidates: `foobar`, `my.ns/foobar`, and `#'foobar`.
  132. Each candidate word is tested for special treatment in this order:
  133. 1. Return true if word is literally in `'lispwords'`
  134. 2. Return false if word matches a pattern in `g:clojure_fuzzy_indent_blacklist`
  135. 3. Return true if word matches a pattern in `g:clojure_fuzzy_indent_patterns`
  136. 4. Return false and indent normally otherwise
  137. ### `g:clojure_special_indent_words`
  138. Some forms in Clojure are indented so that every subform is indented only
  139. two spaces, regardless of `'lispwords'`. If you have a custom construct that
  140. should be indented in this idiosyncratic fashion, you can add your symbols to
  141. the default list below.
  142. ```vim
  143. " Default
  144. let g:clojure_special_indent_words = 'deftype,defrecord,reify,proxy,extend-type,extend-protocol,letfn'
  145. ```
  146. ### `g:clojure_align_multiline_strings`
  147. Align subsequent lines in multiline strings to the column after the opening
  148. quote, instead of the same column.
  149. For example:
  150. ```clojure
  151. (def default
  152. "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
  153. eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
  154. enim ad minim veniam, quis nostrud exercitation ullamco laboris
  155. nisi ut aliquip ex ea commodo consequat.")
  156. (def aligned
  157. "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
  158. eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
  159. enim ad minim veniam, quis nostrud exercitation ullamco laboris
  160. nisi ut aliquip ex ea commodo consequat.")
  161. ```
  162. This option is off by default.
  163. ```vim
  164. " Default
  165. let g:clojure_align_multiline_strings = 0
  166. ```
  167. ### `g:clojure_align_subforms`
  168. By default, parenthesized compound forms that look like function calls and
  169. whose head subform is on its own line have subsequent subforms indented by
  170. two spaces relative to the opening paren:
  171. ```clojure
  172. (foo
  173. bar
  174. baz)
  175. ```
  176. Setting this option changes this behavior so that all subforms are aligned to
  177. the same column, emulating the default behavior of clojure-mode.el:
  178. ```clojure
  179. (foo
  180. bar
  181. baz)
  182. ```
  183. This option is off by default.
  184. ```vim
  185. " Default
  186. let g:clojure_align_subforms = 0
  187. ```
  188. Development
  189. ===========
  190. Pull requests and patches are strongly encouraged!
  191. A large portion of the syntax file is generated from Clojure code in
  192. `clj/src/`. Generation of vim code in this fashion is preferred over hand
  193. crafting of the same.
  194. There is an incomplete syntax test suite in `clj/test/`. Any additions and
  195. improvements to these tests are highly appreciated.
  196. License and Acknowledgements
  197. ============================
  198. Many thanks to [Meikel Brandmeyer](http://kotka.de/) for his excellent work on
  199. making Vim a first class Clojure editor.
  200. Thanks to [Tim Pope](https://github.com/tpope/) for advice in #vim.
  201. `syntax/clojure.vim`
  202. * Copyright 2007-2008 (c) Toralf Wittner <toralf.wittner@gmail.com>
  203. * Copyright 2008-2012 (c) Meikel Brandmeyer <mb@kotka.de>
  204. `ftdetect/clojure.vim`,<br>
  205. `ftplugin/clojure.vim`,<br>
  206. `indent/clojure.vim`
  207. * Copyright 2008-2012 (c) Meikel Brandmeyer <mb@kotka.de>
  208. Modified and relicensed under the Vim License for distribution with Vim:
  209. * Copyright 2013-2014 (c) Sung Pae <self@sungpae.com>
  210. See LICENSE.txt for more information.
  211. <!--
  212. vim:ft=markdown:et:tw=78:
  213. -->