aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/options.lua
diff options
context:
space:
mode:
authorFamiu Haque <famiuhaque@proton.me>2023-12-17 05:23:33 +0600
committerGitHub <noreply@github.com>2023-12-17 07:23:33 +0800
commit8f08b1efbd096850c04c2e8e2890d993bd4d9f95 (patch)
tree2fa91d7a39c1c82e9b6d0c578d74f17bb80b1827 /src/nvim/options.lua
parent2b1bc94b768cb13801e7166f6b02bd09caa3c18f (diff)
downloadrneovim-8f08b1efbd096850c04c2e8e2890d993bd4d9f95.tar.gz
rneovim-8f08b1efbd096850c04c2e8e2890d993bd4d9f95.tar.bz2
rneovim-8f08b1efbd096850c04c2e8e2890d993bd4d9f95.zip
refactor(options): use hashy for finding options (#26573)
Problem: `findoption()` searches through the options[] table linearly for option names, even though hashy can be used to generate a compile-time hash table for it. Solution: Use hashy to generate a compile time hash table for finding options. This also allows handling option aliases, so we don't need separate options[] table entries for things like 'viminfo'.
Diffstat (limited to 'src/nvim/options.lua')
-rw-r--r--src/nvim/options.lua20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index 6d61a6d64e..0d5c24a793 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -2,6 +2,7 @@
--- @field full_name string
--- @field desc? string
--- @field abbreviation? string
+--- @field alias? string|string[]
--- @field short_desc? string|fun(): string
--- @field varname? string
--- @field pv_name? string
@@ -84,6 +85,7 @@ end
return {
cstr = cstr,
--- @type vim.option_meta[]
+ --- The order of the options MUST be alphabetic for ":set all".
options = {
{
abbreviation = 'al',
@@ -6809,6 +6811,7 @@ return {
},
{
abbreviation = 'sd',
+ alias = { 'vi', 'viminfo' },
cb = 'did_set_shada',
defaults = {
if_true = "!,'100,<50,s10,h",
@@ -6940,6 +6943,7 @@ return {
},
{
abbreviation = 'sdf',
+ alias = { 'vif', 'viminfofile' },
defaults = { if_true = '' },
deny_duplicates = true,
desc = [=[
@@ -9375,22 +9379,6 @@ return {
varname = 'p_vop',
},
{
- abbreviation = 'vi',
- full_name = 'viminfo',
- nodefault = true,
- scope = { 'global' },
- short_desc = N_('Alias for shada'),
- type = 'string',
- },
- {
- abbreviation = 'vif',
- full_name = 'viminfofile',
- nodefault = true,
- scope = { 'global' },
- short_desc = N_('Alias for shadafile instead'),
- type = 'string',
- },
- {
abbreviation = 've',
cb = 'did_set_virtualedit',
defaults = { if_true = '' },