vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

README.md (4915B)


      1 # EditorConfig Vim Plugin
      2 
      3 [![Travis Build Status](https://img.shields.io/travis/cxw42/editorconfig-vim.svg?logo=travis)](https://travis-ci.org/editorconfig/editorconfig-vim)
      4 [![Appveyor Build Status](https://img.shields.io/appveyor/ci/cxw42/editorconfig-vim.svg?logo=appveyor)](https://ci.appveyor.com/project/cxw42/editorconfig-vim)
      5 
      6 This is an [EditorConfig][] plugin for Vim. This plugin can be found on both
      7 [GitHub][] and [Vim online][].
      8 
      9 ## Installation
     10 
     11 To install this plugin, you can use one of the following ways:
     12 
     13 ### Install with the archive
     14 
     15 Download the [archive][] and extract it into your Vim runtime directory
     16 (`~/.vim` on UNIX/Linux and `$VIM_INSTALLATION_FOLDER\vimfiles` on windows).
     17 You should have 4 sub-directories in this runtime directory now: "autoload",
     18 "doc", "ftdetect" and "plugin".
     19 
     20 ### Install as Vim8 plugin
     21 
     22 Install as a Vim 8 plugin. Note `local` can be any name, but some path
     23 element must be present. On Windows, instead of `~/.vim` use
     24 `$VIM_INSTALLATION_FOLDER\vimfiles`.
     25 ```shell
     26 mkdir -p ~/.vim/pack/local/start
     27 cd ~/.vim/pack/local/start
     28 git clone https://github.com/editorconfig/editorconfig-vim.git
     29 ```
     30 
     31 ### Install with [pathogen][]
     32 
     33 Use pathogen (the git repository of this plugin is
     34 https://github.com/editorconfig/editorconfig-vim.git)
     35 
     36 ### Install with [Vundle][]
     37 
     38 Use Vundle by adding to your `.vimrc` Vundle plugins section:
     39 
     40 ```viml
     41 Plugin 'editorconfig/editorconfig-vim'
     42 ```
     43 
     44 Then call `:PluginInstall`.
     45 
     46 ### Install with [vim-plug][]
     47 
     48 Use vim-plug by adding to your `.vimrc` in your plugin section:
     49 
     50 ```viml
     51 Plug 'editorconfig/editorconfig-vim'
     52 ```
     53 
     54 Source your `.vimrc` by calling `:source $MYVIMRC`.
     55 
     56 Then call `:PlugInstall`.
     57 
     58 ### No external editorconfig core library is required
     59 
     60 Previous versions of this plugin also required a Python "core".
     61 The core included the code to parse `.editorconfig` files.
     62 This plugin **includes** the core, so you don't need to download the
     63 core separately.
     64 
     65 ## Supported properties
     66 
     67 The EditorConfig Vim plugin supports the following EditorConfig [properties][]:
     68 
     69 * `indent_style`
     70 * `indent_size`
     71 * `tab_width`
     72 * `end_of_line`
     73 * `charset`
     74 * `insert_final_newline` (Feature `+fixendofline`, available on Vim 7.4.785+,
     75   or [PreserveNoEOL][] is required for this property)
     76 * `trim_trailing_whitespace`
     77 * `max_line_length`
     78 * `root` (only used by EditorConfig core)
     79 
     80 ## Selected Options
     81 
     82 The supported options are documented in [editorconfig.txt][]
     83 and can be viewed by executing the following: `:help editorconfig`. You may
     84 need to execute `:helptags ALL` so that Vim is aware of editorconfig.txt.
     85 
     86 ### Excluded patterns
     87 
     88 To ensure that this plugin works well with [Tim Pope's fugitive][], use the
     89 following patterns array:
     90 
     91 ```viml
     92 let g:EditorConfig_exclude_patterns = ['fugitive://.*']
     93 ```
     94 
     95 If you wanted to avoid loading EditorConfig for any remote files over ssh:
     96 
     97 ```viml
     98 let g:EditorConfig_exclude_patterns = ['scp://.*']
     99 ```
    100 
    101 Of course these two items could be combined into the following:
    102 
    103 ```viml
    104 let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
    105 ```
    106 
    107 ### Disable for a specific filetype
    108 
    109 You can disable this plugin for a specific buffer by setting
    110 `b:EditorConfig_disable`.  Therefore, you can disable the
    111 plugin for all buffers of a specific filetype. For example, to disable
    112 EditorConfig for all git commit messages (filetype `gitcommit`):
    113 
    114 ```viml
    115 au FileType gitcommit let b:EditorConfig_disable = 1
    116 ```
    117 
    118 ### Disable rules
    119 
    120 In very rare cases,
    121 you might need to override some project-specific EditorConfig rules in global
    122 or local vimrc in some cases, e.g., to resolve conflicts of trailing whitespace
    123 trimming and buffer autosaving.  This is not recommended, but you can:
    124 
    125 ```viml
    126 let g:EditorConfig_disable_rules = ['trim_trailing_whitespace']
    127 ```
    128 
    129 You are able to disable any supported EditorConfig properties.
    130 
    131 ## Bugs and Feature Requests
    132 
    133 Feel free to submit bugs, feature requests, and other issues to the
    134 [issue tracker][]. Be sure you have read the [contribution guidelines][]!
    135 
    136 [EditorConfig]: http://editorconfig.org
    137 [GitHub]: https://github.com/editorconfig/editorconfig-vim
    138 [PreserveNoEOL]: http://www.vim.org/scripts/script.php?script_id=4550
    139 [Tim Pope's fugitive]: https://github.com/tpope/vim-fugitive
    140 [Vim online]: http://www.vim.org/scripts/script.php?script_id=3934
    141 [Vundle]: https://github.com/gmarik/Vundle.vim
    142 [archive]: https://github.com/editorconfig/editorconfig-vim/archive/master.zip
    143 [contribution guidelines]: https://github.com/editorconfig/editorconfig/blob/master/CONTRIBUTING.md#submitting-an-issue
    144 [issue tracker]: https://github.com/editorconfig/editorconfig-vim/issues
    145 [pathogen]: https://github.com/tpope/vim-pathogen
    146 [properties]: http://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties
    147 [editorconfig.txt]: https://github.com/editorconfig/editorconfig-vim/blob/master/doc/editorconfig.txt
    148 [vim-plug]: https://github.com/junegunn/vim-plug