From ec49068a1a6ac9509946456cfb1753f79618cf30 Mon Sep 17 00:00:00 2001 From: Frank Seifferth Date: Thu, 7 Oct 2021 17:16:11 +0200 Subject: Revert "Allow setting arbitrary options via 'vis_*' keys" This reverts commit 556370f35d4486ad01d549a7f6ff24618a547908. It looks like nobody is interested in using 'vis_*' keys. If that changes, drop me a note to revert the revert. Until then, not having this feature seems to be the cleaner way. --- README.md | 25 ------------------------- edconf.lua | 6 ++---- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 75411cf..4e4c106 100644 --- a/README.md +++ b/README.md @@ -80,28 +80,3 @@ import in `visrc.lua`: require('editorconfig/edconf') vis:command('set edconfhooks on') -- supposing you did previously -- require('vis') - -### Setting arbitrary options - -To some it might be convenient to use editorconfig files to set arbitrary -vis options. Therefore, the vis editorconfig plugin uses the `vis_` -prefix in keys as an interface to anything that can be specified with -`:set`. - -Instead of running `:set spelllang en_US` after opening a file, for -instance, one can also add - - vis_spelllang = en_US - -to the appropriate section of an editorconfig file. - -Note that keys in editorconfig are case-insensitive. The specification -suggests to lowercase them. Therefore, it is only possible to use this -mechanism for lowercase options. If you really need to use upper or -camel case options, add an alias to your `visrc.lua`: - -```lua -vis:option_register("snake_case_option", "string", function(value) - vis:command("set camelCaseOption " .. value) -end, "Alias for camelCaseOption") -``` diff --git a/edconf.lua b/edconf.lua index f956704..da3c32d 100644 --- a/edconf.lua +++ b/edconf.lua @@ -178,11 +178,9 @@ function ec_iter(p) end function ec_set_values(file) - if file.path then + if path then for name, value in ec_iter(file.path) do - if name:sub(1,4) == "vis_" then - vis_set(name:sub(5,#name), value) - elseif OPTIONS[name] then + if OPTIONS[name] then OPTIONS[name](value, file) end end -- cgit