editorconfig.txt (10176B)
1 *editorconfig.txt* EditorConfig plugin for vim. 2 3 File: editorconfig.txt 4 Version: 1.1.1 5 Maintainer: EditorConfig Team <http://editorconfig.org> 6 Description: EditorConfig vim plugin 7 8 CONTENTS~ 9 *editorconfig-contents* 10 ---------------------------------------------------------------------------- 11 1. Overview |editorconfig-overview| 12 2. Installation |editorconfig-installation| 13 3. Commands |editorconfig-commands| 14 4. Settings |editorconfig-settings| 15 5. Advanced |editorconfig-advanced| 16 6. License |editorconfig-license| 17 18 19 OVERVIEW~ 20 *editorconfig-overview* 21 ---------------------------------------------------------------------------- 22 This is the EditorConfig plugin for vim. 23 24 25 INSTALLATION~ 26 *editorconfig-installation* 27 ---------------------------------------------------------------------------- 28 Follow the instructions in the README.md file to install this plugin. 29 30 COMMANDS~ 31 *editorconfig-commands* 32 ---------------------------------------------------------------------------- 33 34 *:EditorConfigReload* 35 Command: 36 :EditorConfigReload 37 38 Reload the EditorConfig conf files. When `.editorconfig` files are modified, 39 this command could prevent you to reload the current edited file to load the 40 new configuration. 41 42 SETTINGS~ 43 *editorconfig-settings* 44 ---------------------------------------------------------------------------- 45 *g:EditorConfig_core_mode* 46 Specify the mode of EditorConfig core. Generally it is OK to leave this option 47 empty. Currently, the supported modes are "vim_core" (default) and 48 "external_command". 49 50 vim_core: Use the included Vim script EditorConfig Core. 51 external_command: Run external EditorConfig Core. 52 53 If "g:EditorConfig_core_mode" is not specified, this plugin will automatically 54 choose "vim_core". 55 56 If you choose "external_command" mode, you must also set 57 |g:EditorConfig_exec_path|. 58 59 Changes to "g:EditorConfig_core_mode" will not take effect until Vim 60 is restarted. 61 62 *b:EditorConfig_disable* 63 This is a buffer-local variable that disables the EditorConfig plugin for a 64 single buffer. 65 66 Example: Disable EditorConfig for the current buffer: 67 > 68 let b:EditorConfig_disable = 1 69 < 70 Example: Disable EditorConfig for all git commit messages: 71 > 72 au FileType gitcommit let b:EditorConfig_disable = 1 73 < 74 75 *g:EditorConfig_exclude_patterns* 76 This is a list contains file path patterns which will be ignored by 77 EditorConfig plugin. When the path of the opened buffer (i.e. 78 "expand('%:p')") matches any of the patterns in the list, EditorConfig will 79 not load for this file. The default is an empty list. 80 81 Example: Avoid loading EditorConfig for any remote files over ssh 82 > 83 let g:EditorConfig_exclude_patterns = ['scp://.*'] 84 < 85 86 *g:EditorConfig_exec_path* 87 The file path to the EditorConfig core executable. You can set this value in 88 your |vimrc| like this: 89 > 90 let g:EditorConfig_exec_path = 'Path to your EditorConfig Core executable' 91 < 92 The default value is empty. 93 94 If "g:EditorConfig_exec_path" is not set, the plugin will use the "vim_core" 95 mode regardless of the setting of |g:EditorConfig_core_mode|. 96 97 Changes to "g:EditorConfig_exec_path" will not take effect until Vim 98 is restarted. 99 100 *g:EditorConfig_max_line_indicator* 101 The way to show the line where the maximal length is reached. Accepted values 102 are "line", "fill", "exceeding" and "fillexceeding", otherwise there will be 103 no max line indicator. 104 105 "line": the right column of the max line length column will be 106 highlighted on all lines, by adding +1 to 'colorcolumn'. 107 108 "fill": all the columns to the right of the max line length 109 column will be highlighted on all lines, by setting 110 'colorcolumn' to a list starting from "max_line_length + 111 1" to the number of columns on the screen. 112 113 "exceeding": the right column of the max line length column will be 114 highlighted on lines that exceed the max line length, by 115 adding a match for the ColorColumn group. 116 117 "fillexceeding": all the columns to the right of the max line length 118 column will be highlighted on lines that exceed the max 119 line length, by adding a match for the ColorColumn group. 120 121 "none": no max line length indicator will be shown. Recommended 122 when you do not want any indicator to be shown, but any 123 value other than those listed above also work as "none". 124 125 To set this option, add any of the following lines to your |vimrc| file: 126 > 127 let g:EditorConfig_max_line_indicator = "line" 128 let g:EditorConfig_max_line_indicator = "fill" 129 let g:EditorConfig_max_line_indicator = "exceeding" 130 let g:EditorConfig_max_line_indicator = "fillexceeding" 131 let g:EditorConfig_max_line_indicator = "none" 132 < 133 The default value is "line". 134 135 *g:EditorConfig_enable_for_new_buf* 136 Set this to 1 if you want EditorConfig plugin to set options 137 for new empty buffers too. 138 Path to .editorconfig will be determined based on CWD (see |getcwd()|) 139 > 140 let g:EditorConfig_enable_for_new_buf = 1 141 < 142 This option defaults to 0. 143 144 *g:EditorConfig_preserve_formatoptions* 145 Set this to 1 if you don't want your formatoptions modified when 146 max_line_length is set: 147 > 148 let g:EditorConfig_preserve_formatoptions = 1 149 < 150 This option defaults to 0. 151 152 *g:EditorConfig_softtabstop_space* 153 When spaces are used for indent, Vim's 'softtabstop' feature will make the 154 backspace key delete one indent level. If you turn off that feature (by 155 setting the option to 0), only a single space will be deleted. 156 This option defaults to 1, which enables 'softtabstop' and uses the 157 'shiftwidth' value for it. You can also set this to -1 to automatically follow 158 the current 'shiftwidth' value (since Vim 7.3.693). Or set this to [] if 159 EditorConfig should not touch 'softtabstop' at all. 160 161 *g:EditorConfig_softtabstop_tab* 162 When tabs are used for indent, Vim's 'softtabstop' feature only applies to 163 backspacing over existing runs of spaces. 164 This option defaults to 1, so backspace will delete one indent level worth of 165 spaces; -1 does the same but automatically follows the current 'shiftwidth' 166 value. Set this to 0 to have backspace delete just a single space character. 167 Or set this to [] if EditorConfig should not touch 'softtabstop' at all. 168 169 *g:EditorConfig_verbose* 170 Set this to 1 if you want debug info printed: 171 > 172 let g:EditorConfig_verbose = 1 173 < 174 175 ADVANCED~ 176 *editorconfig-advanced* 177 ---------------------------------------------------------------------------- 178 *editorconfig-hook* 179 *EditorConfig#AddNewHook()* 180 While this plugin offers several builtin supported properties (as mentioned 181 here: https://github.com/editorconfig/editorconfig-vim#supported-properties), 182 we are also able to add our own hooks to support additional EditorConfig 183 properties, including those not in the EditorConfig standard. For example, we 184 are working on an Objective-C project, and all our "*.m" files should be 185 Objective-C source files. However, vim sometimes detect "*.m" files as MATLAB 186 source files, which causes incorrect syntax highlighting, code indentation, 187 etc. To solve the case, we could write the following code into the |vimrc| 188 file: 189 > 190 function! FiletypeHook(config) 191 if has_key(a:config, 'vim_filetype') 192 let &filetype = a:config['vim_filetype'] 193 endif 194 195 return 0 " Return 0 to show no error happened 196 endfunction 197 198 call editorconfig#AddNewHook(function('FiletypeHook')) 199 < 200 And add the following code to your .editorconfig file: 201 > 202 [*.m] 203 vim_filetype = objc 204 < 205 Then try to open an Objective-C file, you will find the |filetype| is set to 206 "objc". 207 208 License~ 209 *editorconfig-license* 210 ---------------------------------------------------------------------------- 211 212 License: 213 Copyright (c) 2011-2019 EditorConfig Team 214 All rights reserved. 215 216 Redistribution and use in source and binary forms, with or without 217 modification, are permitted provided that the following conditions are met: 218 219 1. Redistributions of source code must retain the above copyright notice, 220 this list of conditions and the following disclaimer. 221 2. Redistributions in binary form must reproduce the above copyright notice, 222 this list of conditions and the following disclaimer in the documentation 223 and/or other materials provided with the distribution. 224 225 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 226 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 227 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 228 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 229 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 230 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 231 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 232 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 233 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 234 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 235 POSSIBILITY OF SUCH DAMAGE. 236 237 238 vim:ft=help:tw=78:cc=