editorconfig.txt 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. *editorconfig.txt*
  2. File: editorconfig.txt
  3. Version: 0.3.3
  4. Maintainer: EditorConfig Team <http://editorconfig.org>
  5. Description: EditorConfig vim plugin
  6. License:
  7. Copyright (c) 2011-2015 EditorConfig Team
  8. All rights reserved.
  9. Redistribution and use in source and binary forms, with or without
  10. modification, are permitted provided that the following conditions are met:
  11. 1. Redistributions of source code must retain the above copyright notice,
  12. this list of conditions and the following disclaimer.
  13. 2. Redistributions in binary form must reproduce the above copyright notice,
  14. this list of conditions and the following disclaimer in the documentation
  15. and/or other materials provided with the distribution.
  16. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  17. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  20. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  21. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  22. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  23. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  24. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  25. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  26. POSSIBILITY OF SUCH DAMAGE.
  27. CONTENTS~
  28. *editorconfig-contents*
  29. ----------------------------------------------------------------------------
  30. 1. Overview |editorconfig-overview|
  31. 2. Installation |editorconfig-installation|
  32. 3. Commands |editorconfig-commands|
  33. 4. Settings |editorconfig-settings|
  34. 5. Advanced |editorconfig-advanced|
  35. OVERVIEW~
  36. *editorconfig-overview*
  37. ----------------------------------------------------------------------------
  38. This is the EditorConfig plugin for vim.
  39. INSTALLATION~
  40. *editorconfig-installation*
  41. ----------------------------------------------------------------------------
  42. Download the [EditorConfig core][] and follow the instructions in the README
  43. and INSTALL files to install it.
  44. Once EditorConfig core is installed, copy the `plugin/editorconfig.vim` file
  45. to your `~/.vim/plugin` directory, `autoload/editorconfig.vim` to
  46. `~/.vim/autoload` and `doc/editorconfig.txt` to your `~/.vim/doc` directory
  47. to install the EditorConfig plugin.
  48. COMMANDS~
  49. *editorconfig-commands*
  50. ----------------------------------------------------------------------------
  51. *:EditorConfigReload*
  52. Command:
  53. :EditorConfigReload
  54. Reload the EditorConfig conf files. When `.editorconfig` files are modified,
  55. this command could prevent you to reload the current edited file to load the
  56. new configuration.
  57. SETTINGS~
  58. *editorconfig-settings*
  59. ----------------------------------------------------------------------------
  60. *g:EditorConfig_core_mode*
  61. Specify the mode of EditorConfig core. Generally it is OK to leave this option
  62. empty. There are 3 modes currently: "external_command", "python_builtin",
  63. "python_external".
  64. python_builtin: Use the vim built-in python to run the python version
  65. EditorConfig Core. In this mode, Python 2.5 or higher
  66. is required.
  67. python_external: Use an external python interpreter to run the python
  68. version EditorConfig Core.
  69. external_command: Run external EditorConfig Core.
  70. If "g:EditorConfig_core_mode" is not specified, this plugin will automatically
  71. choose a mode that could work for you. The checking sequence is:
  72. python_builtin, external_command, python_external.
  73. *g:EditorConfig_exclude_patterns*
  74. This is a list contains file path patterns which will be ignored by
  75. EditorConfig plugin. When the path of the opened buffer (i.e.
  76. "expand('%:p')") matches any of the patterns in the list, EditorConfig will
  77. not load for this file. The default is an empty list.
  78. Example: Avoid loading EditorConfig for any remote files over ssh
  79. >
  80. let g:EditorConfig_exclude_patterns = ['scp://.*']
  81. <
  82. *g:EditorConfig_exec_path*
  83. The file path to the EditorConfig core executable. You could set this value in
  84. your |vimrc| like this:
  85. >
  86. let g:EditorConfig_exec_path = 'Path to your EditorConfig Core executable'
  87. <
  88. The default value is empty.
  89. This plugin will search through the following executables in order:
  90. On UNIX:
  91. the value of g:EditorConfig_exec_path
  92. editorconfig
  93. /usr/local/bin/editorconfig
  94. /usr/bin/editorconfig
  95. /opt/bin/editorconfig
  96. /opt/editorconfig/bin/editorconfig
  97. editorconfig.py
  98. /usr/local/bin/editorconfig.py
  99. /usr/bin/editorconfig.py
  100. /opt/bin/editorconfig.py
  101. /opt/editorconfig/bin/editorconfig.py
  102. On Windows:
  103. the value of g:EditorConfig_exec_path
  104. editorconfig
  105. C:\editorconfig\bin\editorconfig
  106. D:\editorconfig\bin\editorconfig
  107. E:\editorconfig\bin\editorconfig
  108. F:\editorconfig\bin\editorconfig
  109. C:\Program Files\editorconfig\bin\editorconfig
  110. D:\Program Files\editorconfig\bin\editorconfig
  111. E:\Program Files\editorconfig\bin\editorconfig
  112. F:\Program Files\editorconfig\bin\editorconfig
  113. editorconfig.py
  114. *g:EditorConfig_max_line_indicator*
  115. The way to show the line where the maximal length is reached. Accepted values
  116. are "line", "fill", otherwise there will be no max line indicator.
  117. "line": the right column of the max line length column will be
  118. highlighted, made possible by setting 'colorcolumn' to
  119. "max_line_length + 1".
  120. "fill": all the columns to the right of the max line length column
  121. will be highlighted, made possible by setting 'colorcolumn'
  122. to a list of numbers starting from "max_line_length + 1" to
  123. the number of columns on the screen.
  124. "exceeding": the right column of the max line length column will be
  125. highlighted on lines that exceed the max line length, made
  126. possible by adding a match for the ColorColumn group.
  127. "none": no max line length indicator will be shown. This is the
  128. recommended value when you do not want any indicator to be
  129. shown, but values other than "line" or "fill" would also work
  130. as "none".
  131. To set this option, add any of the following lines to your |vimrc| file:
  132. >
  133. let g:EditorConfig_max_line_indicator = "line"
  134. let g:EditorConfig_max_line_indicator = "fill"
  135. let g:EditorConfig_max_line_indicator = "exceeding"
  136. let g:EditorConfig_max_line_indicator = "none"
  137. <
  138. Default to "line".
  139. *g:EditorConfig_python_files_dir*
  140. If the EditorConfig core mode is python_builtin or python_external (see
  141. |g:EditorConfig_core_mode|), this variable is the directory where the plugin
  142. looks for the python scripts. This could either be an abosolute path, or a
  143. path relative to any of the directories in 'runtimepath'. The default value is
  144. "plugin/editorconfig-core-py", which means all "plugin/editorconfig-core-py"
  145. directory in 'runtimepath' will be searched.
  146. *g:EditorConfig_preserve_formatoptions*
  147. Set this to 1 if you don't want your formatoptions modified when
  148. max_line_length is set:
  149. >
  150. let g:EditorConfig_preserve_formatoptions = 1
  151. <
  152. This option defaults to 0.
  153. *g:EditorConfig_verbose*
  154. Set this to 1 if you want debug info printed:
  155. >
  156. let g:EditorConfig_verbose = 1
  157. <
  158. ADVANCED~
  159. *editorconfig-advanced*
  160. ----------------------------------------------------------------------------
  161. *editorconfig-hook*
  162. *EditorConfig#AddNewHook()*
  163. While this plugin offers several builtin supported properties (as mentioned
  164. here: https://github.com/editorconfig/editorconfig-vim#supported-properties),
  165. we are also able to add our own hooks to support additional EditorConfig
  166. properties, including those not in the EditorConfig standard. For example, we
  167. are working on an Objective-C project, and all our "*.m" files should be
  168. Objective-C source files. However, vim sometimes detect "*.m" files as MATLAB
  169. source files, which causes incorrect syntax highlighting, code indentation,
  170. etc. To solve the case, we could write the following code into the |vimrc|
  171. file:
  172. >
  173. function! FiletypeHook(config)
  174. if has_key(a:config, 'vim_filetype')
  175. let &filetype = a:config['vim_filetype']
  176. endif
  177. return 0 " Return 0 to show no error happened
  178. endfunction
  179. call editorconfig#AddNewHook(function('FiletypeHook'))
  180. <
  181. And add the following code to your .editorconfig file:
  182. >
  183. [*.m]
  184. vim_filetype = objc
  185. <
  186. Then try to open an Objective-C file, you will find the |filetype| is set to
  187. "objc".
  188. vim:ft=help:tw=78