New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Settings not applied for files in new directory #126
Comments
I can reproduce this on Vim 8.0 + 1-1453 on Ubuntu. Thanks for reporting! For context, what is your use case? I agree this is a surprising behaviour, but there's not much you can do with a file in a nonexistent directory :) . |
I have the following snippet in my vimrc, which automatically creates any missing directories on save (credit to Stack Overflow): fun! s:CreateNonexistentDirs(file, buf) abort
if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/'
let dir=fnamemodify(a:file, ':h')
if !isdirectory(dir)
call mkdir(dir, 'p')
endif
endif
endfun
augroup BWCCreateDir
au!
au BufWritePre * :call s:CreateNonexistentDirs(expand('<afile>'), +expand('<abuf>'))
augroup end |
Nice! |
Per editorconfig/editorconfig-vote#8, nonexistent directories should now be treated as if existing and empty. Therefore, this is officially a bug in the editorconfig-vim plugin, and I have labeled it as such. Thanks for reporting! It's on the list. |
If you edit a file which does not exist, editorconfig settings are applied, but if you edit a file in a directory which does not exist, editorconfig settings are not applied.
~/.editorconfig:
vim foo.js
,:verb set et? sw?
:vim foo/bar.js
,:verb set et? sw?
:The text was updated successfully, but these errors were encountered: