neovim / neovim

Vim-fork focused on extensibility and usability
https://neovim.io
Other
82.78k stars 5.67k forks source link

Lua: vim.opt table syntax fails for "fillchars" #15670

Open p0da opened 3 years ago

p0da commented 3 years ago

Neovim version (nvim -v)

NVIM v0.6.0-dev+274-g6188926e0 (latest commit)

Vim (not Nvim) behaves the same?

not applicable

Operating system/version

Archlinux

Terminal name/version

alacritty

$TERM environment variable

alacritty

Installation

Custom Build

How to reproduce the issue

nvim -u NONE :lua vim.opt.fillchars={'eob:a'}

Expected behavior

For the vim.opt's table based syntax to work for the "fillchars" option.

Actual behavior

The tables based syntax for vim.opt with comma separated options does not seem to work properly for the "fillchars" option. :lua vim.opt.fillchars={'eob:a'} does not work (invalid argument error) while :lua vim.opt.fillchars='eob:a' does and :lua vim.opt.wildmode={'longest:full'} does.

zeertzjq commented 3 years ago

You can use :lua vim.opt.fillchars = { eob = 'a' } instead.

justinmk commented 3 years ago

:lua vim.opt.fillchars={'eob:a'} does not work (invalid argument error) while :lua vim.opt.fillchars='eob:a' does and :lua vim.opt.wildmode={'longest:full'} does.

I don't see why :lua vim.opt.wildmode={'longest:full'} should work.

Both 'wildmode' and 'fillchars' are P_ONECOMMA type (subclass of P_COMMA). Not sure why runtime/lua/vim/_meta.lua would treat them differently.

https://github.com/neovim/neovim/blob/9edd17509fca597b847656adc8fc20fc1cc44ce5/src/nvim/option.c#L7795-L7796

zeertzjq commented 3 years ago

This todo may be related.

p0da commented 3 years ago

Thanks for the alternative definition method. Perhaps that should be documented, unless it already is and I am missing it. Additionally I also noticed that the "listchars" option behaves similarly to "fillchars" in this regard.