editorconfig-vim
editorconfig-vim copied to clipboard
Get currently loaded configuration
How could I display the path to currently used/loaded .editorconfig
file?
Unfortunately, there is not a way at present. Also, the settings may come from multiple files, in each directory up to the project root. Could you tell us more about your use case?
It is very simple: debugging. I am the author of https://gitlab.com/mcepl/editorconfig-vim-spell and it stopped to work recently. I am really not sure, what’s going on (testing with neovim and switched to the neovim-compatible configuration), but I don’t know how to debug it properly. Ability to dump content of config
parameter of the plugin would be excessively helpful. In the current state the plugin messages nothing.
For debugging, I can tell you what I did while working on the Vim core.
1. Check whether it's the plugin or the core
-
:let g:EditorConfig_verbose=1
- Open the file of interest
- See if the settings are what you expect.
Example:
:let g:EditorConfig_verbose=1
:e foo.txt
Applying EditorConfig vim_core on file "/home/cxw/foo.txt"
Options: {'tab_width': '5', 'indent_size': '5'}
- If the settings are what you expect but the behaviour doesn't match the settings, the problem is in the plugin.
- If the settings are not what you expect, the problem is in the core or the
.editorconfig
files.
2. Debugging the core --- where to start
-
let g:editorconfig_core_vimscript_debug = 1
- Open a file and see what you get! Say
:messages
to see the output if it goes by too quickly.
3. Digging a bit deeper
- Edit
editorconfig-vim/autoload/editorconfig_core/handler.vim
- Go to
function! editorconfig_core#handler#get_configurations(job)
. - Scroll down to
for l:conf_fn in l:conf_files
- Uncomment the
echom
lines - Open a file and look at the messages
Other than that, it's just regular Vimscript debugging. I used :debug
quite a lot. I also remember it was a real pain to debug the core on Windows on Appveyor.