diff options
author | Gregory Anders <greg@gpanders.com> | 2023-01-04 15:10:19 -0700 |
---|---|---|
committer | Gregory Anders <greg@gpanders.com> | 2023-01-07 08:19:37 -0700 |
commit | 6ffa434f0b1c6e82fb6c1445d5d7382e0ef22e07 (patch) | |
tree | 6f6ab3d711c26a8d91c7bf51ddc16027cec9d7b0 | |
parent | 34d1eaa792fa332cea190568967a489e324fca6f (diff) | |
download | rneovim-6ffa434f0b1c6e82fb6c1445d5d7382e0ef22e07.tar.gz rneovim-6ffa434f0b1c6e82fb6c1445d5d7382e0ef22e07.tar.bz2 rneovim-6ffa434f0b1c6e82fb6c1445d5d7382e0ef22e07.zip |
refactor(editorconfig)!: change editorconfig_enable to editorconfig
-rw-r--r-- | runtime/doc/editorconfig.txt | 14 | ||||
-rw-r--r-- | runtime/doc/news.txt | 2 | ||||
-rw-r--r-- | runtime/plugin/editorconfig.lua | 3 | ||||
-rw-r--r-- | test/functional/plugin/editorconfig_spec.lua | 4 |
4 files changed, 12 insertions, 11 deletions
diff --git a/runtime/doc/editorconfig.txt b/runtime/doc/editorconfig.txt index e93713e5ff..04a057e5ff 100644 --- a/runtime/doc/editorconfig.txt +++ b/runtime/doc/editorconfig.txt @@ -13,16 +13,18 @@ the opened file are applied. For more information on EditorConfig, see https://editorconfig.org/. - *g:editorconfig_enable* -EditorConfig integration can be disabled by adding >lua + *g:editorconfig* *b:editorconfig* +EditorConfig integration can be disabled globally by adding >lua - vim.g.editorconfig_enable = false + vim.g.editorconfig = false < -to the user's |init.lua| file (or the Vimscript equivalent to |init.vim|). +to the user's |init.lua| file (or the Vimscript equivalent to |init.vim|). It +can also be disabled per-buffer by setting the |b:editorconfig| buffer-local +variable to `false`. - *b:editorconfig* When Nvim finds a valid .editorconfig file it will store the applied -properties in the buffer variable |b:editorconfig|. +properties in the buffer variable |b:editorconfig| if it was not already set to +`false` by the user. *editorconfig-properties* The following properties are supported by default: diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 3e291e59c9..33ac9ddd20 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -53,7 +53,7 @@ The following new APIs or features were added. • EditorConfig support is now builtin. This is enabled by default and happens automatically. To disable it, users should add >lua - vim.g.editorconfig_enable = false + vim.g.editorconfig = false < (or the Vimscript equivalent) to their |config| file. diff --git a/runtime/plugin/editorconfig.lua b/runtime/plugin/editorconfig.lua index c715279fd5..54cd0e828e 100644 --- a/runtime/plugin/editorconfig.lua +++ b/runtime/plugin/editorconfig.lua @@ -3,8 +3,7 @@ vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead', 'BufFilePost' }, { group = group, callback = function(args) -- Buffer-local enable has higher priority - local enable = - vim.F.if_nil(vim.b.editorconfig_enable, vim.F.if_nil(vim.g.editorconfig_enable, true)) + local enable = vim.F.if_nil(vim.b.editorconfig, vim.F.if_nil(vim.g.editorconfig, true)) if not enable then return end diff --git a/test/functional/plugin/editorconfig_spec.lua b/test/functional/plugin/editorconfig_spec.lua index ad95b9a07e..e6a2550aba 100644 --- a/test/functional/plugin/editorconfig_spec.lua +++ b/test/functional/plugin/editorconfig_spec.lua @@ -195,7 +195,7 @@ But not this one end) it('can be disabled globally', function() - meths.set_var('editorconfig_enable', false) + meths.set_var('editorconfig', false) meths.set_option_value('shiftwidth', 42, {}) test_case('3_space.txt', { shiftwidth = 42 }) end) @@ -203,7 +203,7 @@ But not this one it('can be disabled per-buffer', function() meths.set_option_value('shiftwidth', 42, {}) local bufnr = funcs.bufadd(testdir .. pathsep .. '3_space.txt') - meths.buf_set_var(bufnr, 'editorconfig_enable', false) + meths.buf_set_var(bufnr, 'editorconfig', false) test_case('3_space.txt', { shiftwidth = 42 }) test_case('4_space.py', { shiftwidth = 4 }) end) |