1
0
Fork 0
mirror of synced 2024-10-31 15:58:57 -04:00
ultimate-vim/sources_non_forked/editorconfig-vim/doc/editorconfig.txt
luc da40fe1222 feat: include editorconfig-vim plugin
Signed-off-by: luc <onion0709@gmail.com>
2021-06-06 15:59:09 +08:00

203 lines
8.1 KiB
Text

*editorconfig.txt*
File: editorconfig.txt
Version: 1.1.1
Maintainer: EditorConfig Team <http://editorconfig.org>
Description: EditorConfig vim plugin
License:
Copyright (c) 2011-2019 EditorConfig Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
CONTENTS~
*editorconfig-contents*
----------------------------------------------------------------------------
1. Overview |editorconfig-overview|
2. Installation |editorconfig-installation|
3. Commands |editorconfig-commands|
4. Settings |editorconfig-settings|
5. Advanced |editorconfig-advanced|
OVERVIEW~
*editorconfig-overview*
----------------------------------------------------------------------------
This is the EditorConfig plugin for vim.
INSTALLATION~
*editorconfig-installation*
----------------------------------------------------------------------------
Follow the instructions in the README.md file to install this plugin.
COMMANDS~
*editorconfig-commands*
----------------------------------------------------------------------------
*:EditorConfigReload*
Command:
:EditorConfigReload
Reload the EditorConfig conf files. When `.editorconfig` files are modified,
this command could prevent you to reload the current edited file to load the
new configuration.
SETTINGS~
*editorconfig-settings*
----------------------------------------------------------------------------
*g:EditorConfig_core_mode*
Specify the mode of EditorConfig core. Generally it is OK to leave this option
empty. Currently, the supported modes are "vim_core" (default) and
"external_command".
vim_core: Use the included VimScript EditorConfig Core.
external_command: Run external EditorConfig Core.
If "g:EditorConfig_core_mode" is not specified, this plugin will automatically
choose "vim_core".
If you choose "external_command" mode, you must also set
|g:EditorConfig_exec_path|.
Changes to "g:EditorConfig_core_mode" will not take effect until Vim
is restarted.
*b:EditorConfig_disable*
This is a buffer-local variable that disables the EditorConfig plugin for a
single buffer.
Example: Disable EditorConfig for the current buffer:
>
let b:EditorConfig_disable = 1
<
Example: Disable EditorConfig for all git commit messages:
>
au FileType gitcommit let b:EditorConfig_disable = 1
<
*g:EditorConfig_exclude_patterns*
This is a list contains file path patterns which will be ignored by
EditorConfig plugin. When the path of the opened buffer (i.e.
"expand('%:p')") matches any of the patterns in the list, EditorConfig will
not load for this file. The default is an empty list.
Example: Avoid loading EditorConfig for any remote files over ssh
>
let g:EditorConfig_exclude_patterns = ['scp://.*']
<
*g:EditorConfig_exec_path*
The file path to the EditorConfig core executable. You can set this value in
your |vimrc| like this:
>
let g:EditorConfig_exec_path = 'Path to your EditorConfig Core executable'
<
The default value is empty.
If "g:EditorConfig_exec_path" is not set, the plugin will use the "vim_core"
mode regardless of the setting of |g:EditorConfig_core_mode|.
Changes to "g:EditorConfig_exec_path" will not take effect until Vim
is restarted.
*g:EditorConfig_max_line_indicator*
The way to show the line where the maximal length is reached. Accepted values
are "line", "fill", otherwise there will be no max line indicator.
"line": the right column of the max line length column will be
highlighted, made possible by setting 'colorcolumn' to
"max_line_length + 1".
"fill": all the columns to the right of the max line length column
will be highlighted, made possible by setting 'colorcolumn'
to a list of numbers starting from "max_line_length + 1" to
the number of columns on the screen.
"exceeding": the right column of the max line length column will be
highlighted on lines that exceed the max line length, made
possible by adding a match for the ColorColumn group.
"none": no max line length indicator will be shown. This is the
recommended value when you do not want any indicator to be
shown, but values other than "line" or "fill" would also work
as "none".
To set this option, add any of the following lines to your |vimrc| file:
>
let g:EditorConfig_max_line_indicator = "line"
let g:EditorConfig_max_line_indicator = "fill"
let g:EditorConfig_max_line_indicator = "exceeding"
let g:EditorConfig_max_line_indicator = "none"
<
The default value is "line".
*g:EditorConfig_preserve_formatoptions*
Set this to 1 if you don't want your formatoptions modified when
max_line_length is set:
>
let g:EditorConfig_preserve_formatoptions = 1
<
This option defaults to 0.
*g:EditorConfig_verbose*
Set this to 1 if you want debug info printed:
>
let g:EditorConfig_verbose = 1
<
ADVANCED~
*editorconfig-advanced*
----------------------------------------------------------------------------
*editorconfig-hook*
*EditorConfig#AddNewHook()*
While this plugin offers several builtin supported properties (as mentioned
here: https://github.com/editorconfig/editorconfig-vim#supported-properties),
we are also able to add our own hooks to support additional EditorConfig
properties, including those not in the EditorConfig standard. For example, we
are working on an Objective-C project, and all our "*.m" files should be
Objective-C source files. However, vim sometimes detect "*.m" files as MATLAB
source files, which causes incorrect syntax highlighting, code indentation,
etc. To solve the case, we could write the following code into the |vimrc|
file:
>
function! FiletypeHook(config)
if has_key(a:config, 'vim_filetype')
let &filetype = a:config['vim_filetype']
endif
return 0 " Return 0 to show no error happened
endfunction
call editorconfig#AddNewHook(function('FiletypeHook'))
<
And add the following code to your .editorconfig file:
>
[*.m]
vim_filetype = objc
<
Then try to open an Objective-C file, you will find the |filetype| is set to
"objc".
vim:ft=help:tw=78