You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
223 lines
9.0 KiB
Plaintext
223 lines
9.0 KiB
Plaintext
8 years ago
|
*editorconfig.txt*
|
||
|
|
||
|
File: editorconfig.txt
|
||
|
Version: 0.3.3
|
||
|
Maintainer: EditorConfig Team <http://editorconfig.org>
|
||
|
Description: EditorConfig vim plugin
|
||
|
|
||
|
License:
|
||
|
Copyright (c) 2011-2015 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*
|
||
|
----------------------------------------------------------------------------
|
||
|
Download the [EditorConfig core][] and follow the instructions in the README
|
||
|
and INSTALL files to install it.
|
||
|
|
||
|
Once EditorConfig core is installed, copy the `plugin/editorconfig.vim` file
|
||
|
to your `~/.vim/plugin` directory, `autoload/editorconfig.vim` to
|
||
|
`~/.vim/autoload` and `doc/editorconfig.txt` to your `~/.vim/doc` directory
|
||
|
to install the EditorConfig 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. There are 3 modes currently: "external_command", "python_builtin",
|
||
|
"python_external".
|
||
|
|
||
|
python_builtin: Use the vim built-in python to run the python version
|
||
|
EditorConfig Core. In this mode, Python 2.5 or higher
|
||
|
is required.
|
||
|
python_external: Use an external python interpreter to run the python
|
||
|
version EditorConfig Core.
|
||
|
external_command: Run external EditorConfig Core.
|
||
|
|
||
|
If "g:EditorConfig_core_mode" is not specified, this plugin will automatically
|
||
|
choose a mode that could work for you. The checking sequence is:
|
||
|
python_builtin, external_command, python_external.
|
||
|
|
||
|
*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 could set this value in
|
||
|
your |vimrc| like this:
|
||
|
>
|
||
|
let g:EditorConfig_exec_path = 'Path to your EditorConfig Core executable'
|
||
|
<
|
||
|
The default value is empty.
|
||
|
|
||
|
This plugin will search through the following executables in order:
|
||
|
|
||
|
On UNIX:
|
||
|
the value of g:EditorConfig_exec_path
|
||
|
editorconfig
|
||
|
/usr/local/bin/editorconfig
|
||
|
/usr/bin/editorconfig
|
||
|
/opt/bin/editorconfig
|
||
|
/opt/editorconfig/bin/editorconfig
|
||
|
editorconfig.py
|
||
|
/usr/local/bin/editorconfig.py
|
||
|
/usr/bin/editorconfig.py
|
||
|
/opt/bin/editorconfig.py
|
||
|
/opt/editorconfig/bin/editorconfig.py
|
||
|
|
||
|
On Windows:
|
||
|
the value of g:EditorConfig_exec_path
|
||
|
editorconfig
|
||
|
C:\editorconfig\bin\editorconfig
|
||
|
D:\editorconfig\bin\editorconfig
|
||
|
E:\editorconfig\bin\editorconfig
|
||
|
F:\editorconfig\bin\editorconfig
|
||
|
C:\Program Files\editorconfig\bin\editorconfig
|
||
|
D:\Program Files\editorconfig\bin\editorconfig
|
||
|
E:\Program Files\editorconfig\bin\editorconfig
|
||
|
F:\Program Files\editorconfig\bin\editorconfig
|
||
|
editorconfig.py
|
||
|
|
||
|
*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.
|
||
|
|
||
|
"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 3 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 = "none"
|
||
|
<
|
||
|
|
||
|
Default to "line".
|
||
|
|
||
|
*g:EditorConfig_python_files_dir*
|
||
|
If the EditorConfig core mode is python_builtin or python_external (see
|
||
|
|g:EditorConfig_core_mode|), this variable is the directory where the plugin
|
||
|
looks for the python scripts. This could either be an abosolute path, or a
|
||
|
path relative to any of the directories in 'runtimepath'. The default value is
|
||
|
"plugin/editorconfig-core-py", which means all "plugin/editorconfig-core-py"
|
||
|
directory in 'runtimepath' will be searched.
|
||
|
|
||
|
*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
|