Giter VIP home page Giter VIP logo

editorconfig-vim's Introduction

EditorConfig Vim Plugin

Travis Build Status Appveyor Build Status

This is an EditorConfig plugin for Vim. This plugin can be found on both GitHub and Vim online.

Bundled versions

Depending on which version of Vim or Neovim you are using, you might not need to specifically install this plugin at all:

Installation

To install this plugin, you can use one of the following ways:

Install with the archive

Download the archive and extract it into your Vim runtime directory (~/.vim on UNIX/Linux and $VIM_INSTALLATION_FOLDER\vimfiles on windows). You should have 4 sub-directories in this runtime directory now: "autoload", "doc", "ftdetect" and "plugin".

Install as Vim8 plugin

Install as a Vim 8 plugin. Note local can be any name, but some path element must be present. On Windows, instead of ~/.vim use $VIM_INSTALLATION_FOLDER\vimfiles.

mkdir -p ~/.vim/pack/local/start
cd ~/.vim/pack/local/start
git clone https://github.com/editorconfig/editorconfig-vim.git

Install with pathogen

Use pathogen (the git repository of this plugin is https://github.com/editorconfig/editorconfig-vim.git)

Install with Vundle

Use Vundle by adding to your .vimrc Vundle plugins section:

Plugin 'editorconfig/editorconfig-vim'

Then call :PluginInstall.

Install with vim-plug

Use vim-plug by adding to your .vimrc in your plugin section:

Plug 'editorconfig/editorconfig-vim'

Source your .vimrc by calling :source $MYVIMRC.

Then call :PlugInstall.

No external editorconfig core library is required

Previous versions of this plugin also required a Python "core". The core included the code to parse .editorconfig files. This plugin includes the core, so you don't need to download the core separately.

Supported properties

The EditorConfig Vim plugin supports the following EditorConfig properties:

  • indent_style
  • indent_size
  • tab_width
  • end_of_line
  • charset
  • insert_final_newline (Feature +fixendofline, available on Vim 7.4.785+, or PreserveNoEOL is required for this property)
  • trim_trailing_whitespace
  • max_line_length
  • root (only used by EditorConfig core)

Selected Options

The supported options are documented in editorconfig.txt and can be viewed by executing the following: :help editorconfig. You may need to execute :helptags ALL so that Vim is aware of editorconfig.txt.

Excluded patterns

To ensure that this plugin works well with Tim Pope's fugitive, use the following patterns array:

let g:EditorConfig_exclude_patterns = ['fugitive://.*']

If you wanted to avoid loading EditorConfig for any remote files over ssh:

let g:EditorConfig_exclude_patterns = ['scp://.*']

Of course these two items could be combined into the following:

let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*']

Disable for a specific filetype

You can disable this plugin for a specific buffer by setting b:EditorConfig_disable. Therefore, you can disable the plugin for all buffers of a specific filetype. For example, to disable EditorConfig for all git commit messages (filetype gitcommit):

au FileType gitcommit let b:EditorConfig_disable = 1

Disable rules

In very rare cases, you might need to override some project-specific EditorConfig rules in global or local vimrc in some cases, e.g., to resolve conflicts of trailing whitespace trimming and buffer autosaving. This is not recommended, but you can:

let g:EditorConfig_disable_rules = ['trim_trailing_whitespace']

You are able to disable any supported EditorConfig properties.

Bugs and Feature Requests

Feel free to submit bugs, feature requests, and other issues to the issue tracker. Be sure you have read the contribution guidelines!

editorconfig-vim's People

Contributors

agriffis avatar arteymix avatar bruhtus avatar chrisbra avatar cxw42 avatar elyscape avatar fernandoacorreia avatar grafi-tt avatar inkarkat avatar josephfrazier avatar k-takata avatar kopischke avatar mmrwoods avatar mx-moth avatar nek- avatar peterdavehello avatar pgdouyon avatar philpennock avatar pmeinhardt avatar pocke avatar sam-github avatar sbdchd avatar scy avatar torstehu avatar treyhunner avatar wernight avatar whonore avatar xoac avatar xuhdev avatar xverges avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

editorconfig-vim's Issues

optional graceful failure to load core

I have a single vim-config shared between many systems. Today I needed my global vim config for some specific features in the config, so I cloned my vim config, Vundle installed everything, but since then editorconfig-vim complains at each vim startup about the missing core.

To be clear: I do not intent to get the message itself removed, I would rather like a way to specify in my vimrc to ignore this failure after the first time showing it.

My preferred way would be a flag file, that editorconfig-vim will create, once it has shown the warning (maybe containing exactly the error that happened, so that different failure states can be ignored). The flag file location needs to be specified manually in the config, so a user like me can choose to ignore errors after seeing them once, but the regular user has no reason to specify the flagfile.

Installing EditorConfig Core in a path with spaces (e.g. the Windows default) breaks plugin

On 64-bit Windows, the default install path for EditorConfig Core is C:\Program Files (x86)\editorconfig, rendering the full path to the binary C:\Program Files (x86)\editorconfig\bin\editorconfig.exe (on 32-bit Windows, the (x86) is removed). Unfortunately, if EditorConfig Core is installed in a path with a space (e.g. the aforementioned default) and Python is not, the following error occurs when trying to open a file:

"file.txt" 1L, 7C\editorconfig\bin\editorconfig was unexpected at this time.

Error detected while processing function <SNR>20_UseConfigFiles[20]..<SNR>20_UseConfigFiles_ExternalCommand[2]..<SNR>20_
SpawnExternalParser:
line   31:
E484: Can't open file C:\Users\elysc\AppData\Local\Temp\VIo4B54.tmp
Failed to execute "C:\Program Files (x86)\editorconfig\bin\editorconfig "C:\Users\elysc\Documents\file.txt"". Exit code:
 1
Message:
[]

Here's what's going on. The path to the EditorConfig Core binary is detected from the searchlist, and the value of (say) C:\Program Files (x86)\editorconfig\bin\editorconfig is set in s:EditorConfig_exec_path. Then, when it's time to execute the binary, s:SpawnExternalParser() takes the and just appends filenames to it, executing the result. This results in it passing a value like C:\Program Files (x86)\editorconfig\bin\editorconfig "C:\Users\elysc\Documents\file.txt" to system(). Unfortunately, this then evaluates as:

  • exec:
    • C:\Program
  • args:
    • Files
    • (x86)\editorconfig\bin\editorconfig
    • C:\Users\elysc\Documents\file.txt

Which is obviously wrong and fails.

As an attempted workaround, I added this to my .vimrc:

let g:EditorConfig_exec_path = shellescape('C:\Program Files (x86)\editorconfig\bin\editorconfig')

Unfortunately, this doesn't work because the plugin (wisely) runs it through executable() before using the value, and executable() requires the path you feed it to be unescaped.

A simple fix to this issue would be to wrap s:EditorConfig_exec_path in shellscape() when feeding it to s:SpawnExternalParser .

Doesn't seem to be working on Linux Mint 18 with `+python3`?

OS: Linux Mint 18
Vim: 7.4
:ver gives -python and +python3

I installed via pathogen by simply cloning this project into ~/.vim/bundle. It seems to recognize the plugin because I can access the help files with :help editorconfig.txt.

I installed the editorconfig core with apt install editorconfig.

When I open Vim, with my pwd at the root of my project, I have this in .editorconfig:

root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8

But, when I create a file in the same directory (play.js) nothing seems to happen when I do something like:

if (true) {
   console.log('hi'); // only 3 spaces
}

Should editorconfig edit my buffer when I save so change the 3 spaces to 4 spaces?

how to set max line length in blog writing with markdown

Hello,I want to use markdown in blog writing,but my blog will change best line length with different size of computer screen size(I used bootstrap).How to set max line length in blog writing with markdown in editorconfig-vim?
When I set textwidth=111 in my .vimrc file,I find myself reading my blog good,but when I change to a smaller size pc,I find my blog looks bad coz line length should not be 111 any more.

Can you help me ?(my blog link:https://3xp10it.cc).Thx.

Not respecting indentation settings from .vimrc when no .editorconfig file present

If I run vim inside a project that does have an .editorconfig file, it behaves as expected.

I'm on OSX running Vim 7.4.

But if I run vim somewhere else, where there is not an .editorconfig file, this plugin is changing my indentation settings.

From my .vimrc:

set tabstop=2
set shiftwidth=2
set softtabstop=2

But then if I, say, edit a .js file in a directory without an .editorconfig file, I get this:

set tabstop? ==> tabstop=4
set shiftwidth? ==> shiftwidth=4
set softtabstop? ==> softtabstop=4

trim_trailing_whitespace removes spaces in c++11 raw string literals

Code like the following:

std::string test = R"(space 
here)";

I would argue that the expected contents of the variable should be "space \nhere"

But currently any whitespace after the word "space" is deleted, changing the contents of the "test" variable.

I don't know what the intended editorconfig behaviour is here, of if it's just an interaction with c++11 specific expectations that can never be 'solved'

Error detected while processing .vim/bundle/editorconfig-vim/plugin/editorconfig.vim

I am running vim on an Ubuntu 14.04.4 server and this plugin gives me errors every time I run a :PluginInstall and every time I open vim. Here is the exact output:

Error detected while processing /path/.vim/bundle/editorconfig-vim/plugin/editorconfig.vim:
line   25:
E492: Not an editor command: ^M
line   26:
E15: Invalid expression: v:version < 700^M
line  607:
E488: Trailing characters
line  610:
E171: Missing :endif

I installed this package through Vundle. I have checked #47 and #43 and assume it has to be something similar, but both of those issues were started by Mac users with outdated versions of vim installed. Just to be sure, I have run an apt-get update and apt-get install and ubuntu tells me I have the most up-to-date version of vim. Here is my version output:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan  2 2014 19:39:32)
Included patches: 1-52
Modified by [email protected]
Compiled by buildd@
Huge version without GUI.  Features included (+) or not (-):
+acl             -clientserver    +cscope          +emacs_tags      +folding         +keymap          +menu            +mouse_netterm   +netbeans_intg   -python3         -sniff           -tcl             +virtualedit     +writebackup
+arabic          -clipboard       +cursorbind      +eval            -footer          +langmap         +mksession       +mouse_sgr       +path_extra      +quickfix        +startuptime     +terminfo        +visual          -X11
+autocmd         +cmdline_compl   +cursorshape     +ex_extra        +fork()          +libcall         +modify_fname    -mouse_sysmouse  -perl            +reltime         +statusline      +termresponse    +visualextra     -xfontset
-balloon_eval    +cmdline_hist    +dialog_con      +extra_search    +gettext         +linebreak       +mouse           +mouse_urxvt     +persistent_undo +rightleft       -sun_workshop    +textobjects     +viminfo         -xim
-browse          +cmdline_info    +diff            +farsi           -hangul_input    +lispindent      -mouseshape      +mouse_xterm     +postscript      -ruby            +syntax          +title           +vreplace        -xsmp
++builtin_terms  +comments        +digraphs        +file_in_path    +iconv           +listcmds        +mouse_dec       +multi_byte      +printer         +scrollbind      +tag_binary      -toolbar         +wildignore      -xterm_clipboard
+byte_offset     +conceal         -dnd             +find_in_path    +insert_expand   +localmap        +mouse_gpm       +multi_lang      +profile         +signs           +tag_old_static  +user_commands   +wildmenu        -xterm_save
+cindent         +cryptv          -ebcdic          +float           +jumplist        -lua             -mouse_jsbterm   -mzscheme        +python          +smartindent     -tag_any_white   +vertsplit       +windows         -xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl    -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -expo
rt-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions

Any ideas on what could be causing the problem and what might be done to fix it?

Fix file pattern to work like .gitignore files

The following 3 bullet points from the .gitignore manpage should apply to editorconfig file matching as well.

  • If the pattern does not contain a slash /, git treats it as a shellglob pattern and checks for a match against the pathname relative to the location of the .gitignore file (relative to the toplevel of the work tree if not from a .gitignore file).
  • Otherwise, git treats the pattern as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the pathname. For example, "Documentation/*.html" matches "Documentation/git.html" but not "Documentation/ppc/ppc.html" or "tools/perf/Documentation/perf.html".
  • A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".

The vim globpath command should be used instead of glob because it works similarly to fnmatch.

Breaks Gvim in Windows 10

When I add the dependency via plug, gvim will not even open. I do not get an error. If I comment out loading the editorconfig plugin, gvim loads fine. Any ideas?

Doesn't respect single file definitions in case of multifile definitions

The title is a bit misleading, what I mean is if I define editorconfig properties like [*.{md}] for example neovim isn't respect this rules.

If I add a second type like [*.{md, yaml}] for example it is working, also when I remove the curly braces like [*.md] it is working.

So I think this is a bug and should be fixed.

WDYT?

Usage question

Hi, I have macvim (-python) and I can't seem to get this plugin to work. I built editorconfig with brew install editorconfig and cloned this repo into my ~/.vim/bundle (loading with pathogen).
My ~/.editorconfig looks like:

[{package.json,.travis.yml}]
indent_style = space
indent_size = 2

And I still see vim trying to use 4 space; my .vimrc has this setting for tabstop, softtabstop and shiftwidth.

Wildcard in runtimepath breaks path escaping in plugin

See issue vim/vim#710 in vim for the whole story.

Changes made in 75fe572 added path escaping. I use a wildcard in my runtimepath:

set runtimepath+=~/.vim/bundle/*/

The wildcard in combination with the escaping causes l:python_core_files_dir to be empty. This prevents the plugin from finding main.py. The result is an error message appearing whenever I open a file: Failed to execute "'python' '$PWD/main.py'"

Error detected while processing function <SNR>26_InitializePythonBuiltin:

I try to install this plugin via Vundle by adding the following line to my .vimrc:

Plugin 'editorconfig/editorconfig-vim'

It triggers the following error:

Error detected while processing function <SNR>26_InitializePythonBuiltin:
line   23:
E887: Sorry, this command is disabled, the Python's site module could not be loaded.
line   44:
E887: Sorry, this command is disabled, the Python's site module could not be loaded.
Press ENTER or type command to continue

I tried to deactivate all my other plugin without success.

Any idea what is going wrong?

Cannot load config when `set shellslash` in gVim on Windows

Hi,

Thank you very much for providing excellent tool.

I found gVim on Windows cannot load config when shellslash is set in .vimrc.
I use gVim 8.0.69 from http://www.vim.org/ on 64bit version of Windows 10.

The error says that...

Failed to execute "'python' 'path/to/main.py' "path\to\file"". Exit code: 1
Message:
['''''python'''' is not recognized as an internal or external command,', 'operable program or batch file.']

I added the location of python.exe to PATH.
The reason of the error I think is that python is surrounded by ''.

As a result of my search, I found I can use the same solution used in s:SpawnExternalParser(), which is discussed in #44.

function! s:UseConfigFiles_Python_External() " {{{2
" Use external python interp to run the python EditorConfig Core

    """ I copied from s:SpawnExternalParser() from HERE """
    if has('win32') && empty(matchstr(&shell, 'sh'))
        let l:old_shellslash = &l:shellslash
        setlocal noshellslash
    endif
    """ I copied from s:SpawnExternalParser() to HERE """

    let l:cmd = shellescape(s:editorconfig_python_interp) . ' ' .
                \ shellescape(s:editorconfig_core_py_dir . '/main.py')


    """ I copied from s:SpawnExternalParser() from HERE """
    " restore 'shellslash'
    if exists('l:old_shellslash')
        let &l:shellslash = l:old_shellslash
    endif
    """ I copied from s:SpawnExternalParser() to HERE """

    echo s:editorconfig_python_interp
    echo l:cmd
    call s:SpawnExternalParser(l:cmd)

    return 0
endfunction

TrimTrailingWhitespace fails to run with quickfix window

Without blaming either editorconfig-vim or vim-go, something makes the TrimTrailingWhitespace function error out when you're saving a Go file with error.

Gofmt returned error
Error detected while processing function <SNR>51_TrimTrailingWhitespace:

AFAIK the buffer should still be modifiable. vim-go adds errors to a quickfix window. Could the editorconfig some how try to modify the quickfix instead?

If I simply wrap the whole function with a if &l:modifiable block, at least the error goes away. I'll create a PR with this workaround.

Related discussion: fatih/vim-go#723

Pollutes vim's search history

When this plugin is enabled, doing a simple :w<cr> adds two entries to neovim's search history:

/\s\+$
/[\u0009\u0020\u00a0\u1680\u180e\u2000-\u200b\u202f\u205f\u3000\ufeff]\+$

The result is that after saving a file, hitting n for example to view the next occurrence of a pattern will instead search for \s\+$, which is not found. I suspect based on the pattern this is related to trimming trailing whitespace.

I have had this plugin commented out for about a year and forgot why until I tried it again just now :D. Should be an easy fix though, and I regret not bringing it up back then.

A clearer installation procedure

Hi,

Thanks for this plug-in. But it's hard to understand how to install it.

Can you improve the Install section on the README ?

Like:

Step1: Extract this files... on this folder
Step2: Add this line... on this file

Thanks in advence

Slow startup time

Hi,

I've been profiling my vim startup time, and have found that the editorconfig plugin is taking over half of the total startup time (150ms - 230ms, not including python initialization). I'm wondering if there's a known way to slim this down, either with configuration options or some other means.

Other notes

  • I'm using a recent build of neovim
  • slow startup time persists regardless of whether there's an .editorconfig file present in the dir

editorconfig does not apply to [No Name] buffer

# ~/.editorconfig
[*]
indent_style=space
indent_size=2
$ vim
:set tabstop
tabstop=8
$ vim doesnotexist
:set tabstop
tabstop=2

I'd expect that [*] also applies for the [No Name] buffer.

Use-case: I often open vim for notes and decide on the go if it's worth saving or not. My editorconfig should be applied in both cases.

Incorrect indentation

When I run editorconfig manually on a file, it shows the correct settings:

charset=utf-8
end_of_line=lf
insert_final_newline=true
trim_trailing_whitespace=true
indent_style=tab
indent_size=4
tab_width=4

but when I load the file in vim and try to indent some text, it indents by a single space.

I tried turning on verbose mode to get more info by adding let g:EditorConfig_verbose = 1 to my vimrc, but I don't seem to get any output, even when I e.g. run EditorConfigReload.

Cannot load config when `set shell=sh` on Windows

I use Windows GVim with set shell=sh (this sh comes from Git for Windows). With this environment, editorconfig-vim silently failed to load config files because this plugin changes shellescape for Command Prompt.

When I commented out line 463, 464 and 466, editorconfig-vim works as expected.

I think editorconfig-vim should check shell not only shellslash. I know this environment is very rare, but I’m happy if you fix this problem.

tab_width breaks proper indentation

When i'm using "tab_width=4" vim indents each level with two tabs instead of a single tab. If i remove the "tab_width=4" line, it indents the files properly with a single tab, but now each indentation level is equal to eight spaces.

My .editorconfig-file:

# top-most EditorConfig file, do not look any further!
root = true

# General settings for all files
[*]
end_of_line = lf
insert_final_newline = false
charset = utf-8
trim_trailing_whitespace = true
tab_width = 4

# Tab indentation
[{M,m}akefile,*.{xml,html,R}]
indent_style = tab

#4 space indentation
[*.{erl,js,py,rs,rb,rex,txt,java,vim,frag,vert,sh,enc}]
indent_style = space
indent_size = 4

#2 space indentation
[*.{c,cpp,tex,bib,cl,h,hpp,pde,ino,wiki}]
indent_style = space
indent_size = 2

And in case i configured Vim incorrectly, here is my .vimrc:
https://github.com/Chilinot/dotfiles/blob/master/.vimrc

Vim 8 pack structure

Vim 8 can load plugins now natively. Like described in the packages docs it needs some well placed files to get recognized. Likewise:

Your directory layout would be like this:

start/foobar/plugin/foo.vim          " always loaded, defines commands
start/foobar/plugin/bar.vim          " always loaded, defines commands
start/foobar/autoload/foo.vim        " loaded when foo command used
start/foobar/doc/foo.txt             " help for foo.vim
start/foobar/doc/tags                " help tags
opt/fooextra/plugin/extra.vim        " optional plugin, defines commands
opt/fooextra/autoload/extra.vim      " loaded when extra command used
opt/fooextra/doc/extra.txt           " help for extra.vim
opt/fooextra/doc/tags                " help tags

This allows for the user to do:

mkdir ~/.vim/pack/myfoobar
cd ~/.vim/pack/myfoobar
git clone https://github.com/you/foobar.git

max_line_length does not wrap lines when formatoptions is set 'incorrectly'

When max_line_length is set to some value, it only wraps lines when formatoptions is set with at least "tc". Some filetypes don't have these set by default, but this leads to the option 'not working' when formatoptions isn't set correctly (for these types of files, like java files).

'fixing' this would be trivial, just appending "tc" to formatoptions fixes the problem, by forcing line wrap in both comments and normal text, but should this be default? I personally think it should, as that is what I am looking for when I have that option set. The editorconfig properties also imply this, but I'm not sure if this should be changed.

If people decide this should be done, I would be happy to do it, it should be a small change. Let me know what you think!

Error when used with fugitive

I'm using the vim-fugitive plugin in combination with editorconfig-vim and when I :Gblame and try to view the git commit Object I receive the following error:

Error detected while processing function 30_UseConfigFiles.. SNR>30_UseConfigFiles_Python_Builtin:
line 23:
Input file must be a full path name.

I have tracked the error down to plugin/editorconfig-core-py/editorconfig/handler.py#L92.

It appears that fugitive is passing the following as the filepath:

fugitive:///home/vagrant/Code/dotfiles/.git/a6f75e74cb68bd42d9e459c63f1c2c01b75a05a6

Would it be possible to just ignore files that begin with the fugitive protocol, or be able to specify a pattern of files to ignore?

Python? issues with vim 8

Whenever I install this plugin with vim-plug, I get the following error:

Error detected while processing function <SNR>63_InitializePythonBuiltin:
line   23:
E887: Sorry, this command is disabled, the Python's site module could not be loaded. 

I'm on OSX 10.12 Sierra, installed vim with Homebrew. Here is the output of :ver:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 30 2016 05:50:39)                                   
MacOS X (unix) version                                                                               
Included patches: 1-19                                                                               
Compiled by Homebrew                                                                                 
Huge version without GUI.  Features included (+) or not (-):                                         
+acl             +dialog_con      +job             +mouse_sgr       +rightleft       +user_commands  
+arabic          +diff            +jumplist        -mouse_sysmouse  +ruby            +vertsplit      
+autocmd         +digraphs        +keymap          +mouse_urxvt     +scrollbind      +virtualedit    
-balloon_eval    -dnd             +lambda          +mouse_xterm     +signs           +visual         
-browse          -ebcdic          +langmap         +multi_byte      +smartindent     +visualextra    
++builtin_terms  +emacs_tags      +libcall         +multi_lang      +startuptime     +viminfo        
+byte_offset     +eval            +linebreak       -mzscheme        +statusline      +vreplace       
+channel         +ex_extra        +lispindent      +netbeans_intg   -sun_workshop    +wildignore     
+cindent         +extra_search    +listcmds        +num64           +syntax          +wildmenu       
-clientserver    +farsi           +localmap        +packages        +tag_binary      +windows        
+clipboard       +file_in_path    -lua             +path_extra      +tag_old_static  +writebackup    
+cmdline_compl   +find_in_path    +menu            +perl            -tag_any_white   -X11            
+cmdline_hist    +float           +mksession       +persistent_undo -tcl             -xfontset       
+cmdline_info    +folding         +modify_fname    +postscript      +termguicolors   -xim            
+comments        -footer          +mouse           +printer         +terminfo        -xpm            
+conceal         +fork()          -mouseshape      +profile         +termresponse    -xsmp           
+cryptv          -gettext         +mouse_dec       +python          +textobjects     -xterm_clipboard
+cscope          -hangul_input    -mouse_gpm       -python3         +timers          -xterm_save     
+cursorbind      +iconv           -mouse_jsbterm   +quickfix        +title                           
+cursorshape     +insert_expand   +mouse_netterm   +reltime         -toolbar                         
   system vimrc file: "$VIM/vimrc"                                                                   
     user vimrc file: "$HOME/.vimrc"                                                                 
 2nd user vimrc file: "~/.vim/vimrc"                                                                 
      user exrc file: "$HOME/.exrc"                                                                  
       defaults file: "$VIMRUNTIME/defaults.vim"                                                     
  fall-back for $VIM: "/usr/local/share/vim"                                                         
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTI
FY_SOURCE=1                                                                                          
Linking: clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt
/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -framewo
rk Cocoa   -mmacosx-version-min=10.12 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/
perl/5.24.0_1/lib/perl5/5.24.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -F/usr/local/Cel
lar/python/2.7.12_1/Frameworks -framework Python   -lruby.2.3.0 -lobjc -L/usr/local/Cellar/ruby/2.3.1
_1/lib

Edit: The error only seems to happen when I open MacVim. No error is present when using vim directly.

Doesn't Respect ~/.editorconfig

For some reason, when opening a file .editorconfig is only loaded if I am in a directory which has a .editorconfig file.

Example:

$ pwd
~/
$ [ -f .editorconfig ] && echo 1
1
$ vi ~/folder/file.ext

everything works as expect.

$ pwd
~/folder
$ [ -f .editorconfig ] && echo 1

$ vi file.ext

~/.editorconfig is not loaded and I don't get the proper settings.

Relevant lines in .vimrc

let g:EditorConfig_core_mode = 'external_command'
let g:EditorConfig_exclude_patterns = ['fugitive://.*']

My .editorconfig file

top-most EditorConfig file

root = true

[*]
end_of_line = lf
char_set = utf-8
trim_trailing_whitespace = true
indent_style = space
indent_size = 4
tab_width = 4
max_line_length = 80

[.pentadactylrc]
trim_trailing_whitespace = false

[*.{c,C}]
indent_size = 2
tab_width = 2

[*.tex]
indent_size = 2
tab_width = 2

[compile,*.mk,Makefile]
indent_style = tab

All files opened in one vim session use indentation of first file opened

After executing

vim file1.py

The indentation style will be changed to that of *.py files (assuming they are specified in editorconfig file).

If afterwards a different file is opened in vim, like

vim file2.js

The indentation style will not change to that of *.js files (assuming they are specified in editorconfig file).

The indentation style should change to the file in view whenever the buffer focus changes.

Upload installation package

Downloadable archives can be uploaded to the "Downloads" section (under the "Code" tab).

I think we should create Linux, Windows, and Mac archives containing the vim plugin, the editorconfig binary file compiled for their system from the core code, and an installation script that will copy these files to the appropriate locations.

This would make the code considerably more accessible.

Add break_at_hyphen

To complement max_line_length, a break_at_hyphen option would be nice.

In vim, it would do set fo+=b.

Errors when max line indicator set to "fill" and `max_line_length` is offscreen

When g:EditorConfig_max_line_indicator is set to fill and when the column where max_line_length rests is actually offscreen, the plugin errors out:

screenshot 2015-12-30 12 58 15

This happens whenever a file that these settings applies to is opened or on :EditorConfigReload.

I've tested this with a stripped down .vimrc and .editorconfig (see above). I'm using urxvt (this also happens on xterm, at least on my system) on Arch. I'm using the Python version rather than EditorConfig core. I have both Python 2.7.11 and 3.5.1 installed. I'm using the latest version of this plugin. The output of :version is as follows:

:version                                                                                              
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 30 2015 08:28:28)
Included patches: 1-944
Compiled by Arch Linux
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +dialog_con_gui  +insert_expand   +mouse_sgr       +ruby            +vertsplit
+arabic          +diff            +jumplist        -mouse_sysmouse  +scrollbind      +virtualedit
+autocmd         +digraphs        +keymap          +mouse_urxvt     +signs           +visual
+balloon_eval    +dnd             +langmap         +mouse_xterm     +smartindent     +visualextra
+browse          -ebcdic          +libcall         +multi_byte      -sniff           +viminfo
++builtin_terms  +emacs_tags      +linebreak       +multi_lang      +startuptime     +vreplace
+byte_offset     +eval            +lispindent      -mzscheme        +statusline      +wildignore
+cindent         +ex_extra        +listcmds        +netbeans_intg   -sun_workshop    +wildmenu
+clientserver    +extra_search    +localmap        +path_extra      +syntax          +windows
+clipboard       +farsi           +lua             +perl            +tag_binary      +writebackup
+cmdline_compl   +file_in_path    +menu            +persistent_undo +tag_old_static  +X11
+cmdline_hist    +find_in_path    +mksession       +postscript      -tag_any_white   -xfontset
+cmdline_info    +float           +modify_fname    +printer         -tcl             +xim
+comments        +folding         +mouse           +profile         +terminfo        +xsmp_interact
+conceal         -footer          +mouseshape      +python          +termresponse    +xterm_clipboard
+cryptv          +fork()          +mouse_dec       -python3         +textobjects     -xterm_save
+cscope          +gettext         +mouse_gpm       +quickfix        +title           -xpm
+cursorbind      -hangul_input    -mouse_jsbterm   +reltime         +toolbar
+cursorshape     +iconv           +mouse_netterm   +rightleft       +user_commands
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.
0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/inc
lude/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/freetyp
e2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/includ
e/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic
-O2 -pipe -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl
,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro -L/usr/local/lib -Wl,--a
s-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpan
goft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE
-lm -lncurses -lelf -lnsl   -lacl -lattr -lgpm -ldl  -L/usr/lib -llua -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/
CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/core_
perl/CORE -lperl -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc -L/usr/lib/python2.7/config -lpython2.7 -lpthread -l
dl -lutil -lm -Xlinker -export-dynamic   -lruby -lpthread -lgmp -ldl -lcrypt -lm  -L/usr/lib

I ran into this issue when I set a project-wide max_line_length, but wanted to unset this (and have no max line length) for my README.md, and happened to set max_line_length to 999999.

open the python file in the editorconfig-vim will cause problem

Hi!

When open the file in the editorconfig-vim/plugin/editorconfig-core-py, following error is reported:

Failed to execute "python /home/ihep/.vim/bundle/editorconfig-vim/plugin/editorconfig-core-py/main.py/main.py '/home/ihep/.vim/bundle/editorconfig-vim/plugin/editorconfig-core-py/.editorconfig'". Exit code: 2
Message:
['python: can''t open file ''/home/ihep/.vim/bundle/editorconfig-vim/plugin/editorconfig-core-py/main.py/main.py'': [Errno 20] Not a directory']

I find the problem is caused in s:FindPythonFiles, which returns a wrong directory.
findfile(g:EditorConfig_python_files_dir . '/main.py',','.&runtimepath) will return main.py, so the substitution will be failed.

New release tag?

Are there any plans on releasing a new version, i.e. generating a new tag?

Error loading editorconfig

After a recent update editorconfig fails to load.

Error detected while processing function <SNR>21_FindPythonFiles:
line    3:
E117: Unknown function: <SNR>21_DisableShellSlash
line   18:
E117: Unknown function: <SNR>21_ResetShellSlash

cc: @elyscape

ftplugin overriding editorconfig

I've noticed that if I have a ftplugin eg .vim/after/ftplugin/yaml.vim

setlocal expandtab
setlocal tabstop=2
setlocal shiftwidth=2

That this overrides what I have set in the .editorconfig

global configuration not working

in my ~/.editorconfig file, it contains this

[*]
end_of_line = LF
charset = utf-8
indent_size = 4
indent_style = space
trim_trailing_whitespace = true

when opening vim to create a new file without extensions, it doesn't follow the configurations defined.

Python related problem in NeoVim

I've started having trouble with this plugin in newer (last few months) NeoVim builds. I was originally using Vundle, and have recently switched to vim-plug to manage my plugins. I was hoping this was some problem in the way the plugin was being updated, but I'm now having exactly the same problem with everything freshened up, so here it is. This is with NeoVim 0.1.2 and the latest master branch of editorconfig-vim.

When I launch nvim, I get an error like this:

❯❯❯ nvim
function <SNR>63_InitializePythonBuiltin..provider#python#Call..remote#host#Require..<SNR>62_RequirePythonHost, line 15
Vim(if):Channel was closed by the client
Failed to load python host. You can try to see what happened by starting Neovim with the environment variable $NVIM_PYTHON_LOG_FILE set to a file and opening the generated log file. Also, the host stderr will be available in Neovim log, so it may contain useful information. See also ~/.nvimlog.
Press ENTER or type command to continue

Setting the noted environment variable generated a log file with the PID appended to the name, but the file is blank. The ~/.nvimlog file is likewise blank. I am unable to get any useful debug information beyond this error.

I do have the python-editorconfig parser installed separately:

❯❯❯ /usr/bin/editorconfig -v
EditorConfig Python Core Version 0.12.0

However even without that, I have the python bindings enabled in NeoVim with both python-neovim and python2-neovim packages installed, so it should work with either internal or external methods. I've even tried setting g:EditorConfig_core_mode to override the default but there is no change to the error above.

My system default python binary is for 3.5.1, but a python2 is also available.

Error after upgrading Python (and pip)

Just upgraded Python to 2.7.12 today and the plugin breaks. Basically when I try to do everything within Vim, I get the following error message:

Error detected while processing function <SNR>20_InitializePythonBuiltin:
line   23:
E887: Sorry, this command is disabled, the Python's site module could not be loaded.
Press ENTER or type command to continue

Had to remove the plugin in order to use Vim.

My setup:

$ python --version
Python 2.7.12

$ pip --version
pip 8.1.2 from /usr/local/lib/python2.7/site-packages (python 2.7)

$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 26 2016 11:13:04)
MacOS X (unix) version
Included patches: 1-13
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     +termguicolors
-browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     -gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
-clientserver    +insert_expand   +packages        -toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python          +vreplace
+cscope          +lispindent      -python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      -lua             +rightleft       +writebackup
+diff            +menu            +ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      -mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
+farsi           +mouse_netterm   +tag_binary
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -framework Cocoa   -mmacosx-version-min=10.11 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.24.0_1/lib/perl5/5.24.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -F/usr/local/Cellar/python/2.7.12/Frameworks -framework Python   -lruby.2.3.0 -lobjc -L/usr/local/Cellar/ruby/2.3.1/lib

Both installed via Homebrew, by the way.

can't disable conflicting rules

problem: trim_trailing_whitespace rule conflicts with autosaving, that results in following behavior

  • type some code (ie var), then type space
  • wait for 1 second (to come up with variable name)
  • autosaving triggered
  • trim triggered, space removed

solution: add parameter to disable supported rules in global or local vimrc

Wrong reading order

From http://editorconfig.org/#file-format-details the .editorconfig should be read from top to bottom, each time overriding previous setting. This can be inferred from their example: "closest EditorConfig files are read last [...] so properties in closer files take precedence."

EditorConfig files are read top to bottom and the closest EditorConfig files are read last. Properties from matching EditorConfig sections are applied in the order they were read, so properties in closer files take precedence.

However this doesn't seem to be respected:

[*]
indent_style = tab

[*.md]
indent_style = space
indent_size = 4

Editing a *.md file would still apply tabs as indentation.

Plugin should strip CR characters from output of editorconfig-core

I have a slightly unusual set up: I'm running Vim from Git-for-windows, with the windows build of editorconfig-core installed. I don't have a Python install currently.

When I set

let g:EditorConfig_verbose = 1

I see that the output of editorconfig.exe is garbled, presumably by the CRLF line endings. This leads to incorrect editor settings being applied.

As a workaround, I have a script which pipes the output of editorconfig.exe through dos2unix which seems to resolve the problem.

Error detected while processing function <SNR>58_UseConfigFiles..

When I load a file from a directory that contains an .editorconfig file I get the following error from your vim-plugin:

Error detected while processing function 58_UseConfigFiles..58_UseConfigFiles_Python_Builtin:
line 33:
Traceback (most recent call last):
File "", line 3, in
TypeError: expected string without null bytes

My .editorconfig looks like the following snippet

root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

Do you've an idea how to fix the problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.