editorconfig / editorconfig-vim

EditorConfig plugin for Vim
http://editorconfig.org
Other
3.14k stars 139 forks source link

Editorconfig settings lost on file reload #120

Open lu-zero opened 5 years ago

lu-zero commented 5 years ago

I noticed that upon reloading a file the editorconfig overrides are lost.

To reproduce:

Also:

xuhdev commented 5 years ago

let vim reload the file once it notices

Did you manually do this or some plugin did it automatically for you?

lu-zero commented 5 years ago

it is the normal behavior on mac

cxw42 commented 4 years ago

Thanks!

lu-zero commented 4 years ago

macOS, 8.2

alext commented 2 years ago

I'm also seeing this behaviour on Ubuntu.

Ubuntu: 20.04 Vim: vim-gtk3 2:8.1.2269-1ubuntu5.7

I have the following in ~/.vim/ftplugin/javascript.vim

setlocal shiftwidth=4
setlocal tabstop=4

In the root dir of my project, I have the following .editorconfig:

root = true

[*.js]
indent_style=space
indent_size=2

Reproduction steps:

cxw42 commented 2 years ago

@alext thanks! I can repro following your steps above.

I agree that .editorconfig should override the ftplugins on reload, as it does on :e.

cxw42 commented 2 years ago

It looks like this might be an issue in vim itself. In the reload case, FileType is invoked twice, once after BufRead. Since we hook BufRead, the FileType work (including ftplugins) overrides what we did in BufRead. Logfile diff: image

To re-create: set up the files as above, and do

$ rm log.txt ; gvim '-nN' '-i' 'NONE' -V100log.txt test.js

then pull out the relevant sections of the log for reload and :e, and do

:g/Executing.*Autocommands\|s:UseConfig\|ftplugin.javascript.vim/p

to get the relevant events.

Any Vim-internals folks who might be willing to file the issue upstream? If not, I can do my best, but I haven't touched vim's internals at all.