Skip to content

Replace vim.opt with vim.o #1495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 11, 2025
Merged

Replace vim.opt with vim.o #1495

merged 3 commits into from
May 11, 2025

Conversation

oriori1703
Copy link
Contributor

@oriori1703 oriori1703 commented Apr 26, 2025

Even though this change is not mandatory until all of the plugins use the new vim.o interface, as discussed in #1264 , I think there it is still beneficial switching to vim.o.

In contrast to vim.opt, vim.o opens the documentation on hover, and provides type hints which will be useful for beginners (and also experts who are just lazy ;).

In addition it is more intuitive to get the value of the option (e.g. vim.bo.modifiable instead of vim.opt_local.modifiable:get()).

The main downside is that it is less convenient in the cases where vim.opt provides a table (This is tracked in neovim/neovim#20107).
So for now I left vim.opt.listchars and vim.opt.rtp unchanged.

Because it offers a nicer interface and info on hover.
For now leave vim.opt when using the table interface (until vim.o
with tables is implemented)
@brianhuster
Copy link

brianhuster commented Apr 26, 2025

I think there should be document about the difference between them, and why you use vim.o for this but keep vim.opt for that

@oriori1703
Copy link
Contributor Author

I think there should be document about the difference between them, and why you use vim.o for this but keep vim.opt for that

I added a comment explaining why I choose to use vim.opt and referencing the manual for an explanation about the difference.
What do you think?

@brianhuster
Copy link

LGTM

@feoh feoh merged commit c92ea7c into nvim-lua:master May 11, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants