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
arsxhy pushed a commit to arsxhy/arsKickstart.nvim that referenced this pull request May 11, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o
dribic added a commit to dribic/nvim-files that referenced this pull request May 11, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o

Co-authored-by: Ori Perry <48057913+oriori1703@users.noreply.github.com>
Signed-off-by: Dejan Ribič <dejan.ribic@gmail.com>
kumiau pushed a commit to kumiau/kickstart.nvim that referenced this pull request May 12, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o
viliusradz pushed a commit to viliusradz/kickstart.nvim that referenced this pull request May 14, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o
viliusradz pushed a commit to viliusradz/kickstart.nvim that referenced this pull request May 14, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o
CamilleMo pushed a commit to CamilleMo/kickstart.nvim that referenced this pull request May 16, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o
DivyanshDev05 pushed a commit to DivyanshDev05/kickstart.nvim that referenced this pull request May 17, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o
ditatompel added a commit to ditatompel/ditatompel that referenced this pull request May 18, 2025
The `vim.opt.listchars` and `vim.opt.rtp` left unchanged, see
nvim-lua/kickstart.nvim#1495

Co-authored-by: Ori Perry <48057913+oriori1703@users.noreply.github.com>
kuroikyu pushed a commit to kuroikyu/kickstart.nvim that referenced this pull request May 18, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o
mhamza15 added a commit to mhamza15/kickstart.nvim that referenced this pull request May 19, 2025
* Added lua/lazy-bootstrap.lua

* Added lua/lazy-plugins.lua

* Added lua/options.lua

* Added lua/keymaps.lua

* Added lua/telescope-setup.lua

* Added lua/treesitter-setup.lua

* Added lua/lsp-setup.lua

* Added lua/cmp-setup.lua

* Update README.md - remove single-file

* Update README.md - kickstart-modular fork

* init.lua: update section comments to match upstream

* Run stylua on init.lua

* Minor changes to README to reflect the modular repo (nvim-lua#3)

* Update README to reflect modular organization

- Change install links to this repo instead of nvim-lua/kickstart.nvim

- Change “Recommended Steps” repo link to reflect kickstart-modular.nvim.git

- Change FAQ re: multiple files to reflect that we are in the modular repo, not the single file repo.

* README.md: removed some trailing spaces

* fix: incorrect reference to init.lua in README.md

* README.md: minor update to the modular fork note

* chore(docs): Update README.md (nvim-lua#1344)

Neovim has renamed the "linux64" binary to "linux-x86_64".

* docs: clarify using opts = {} vs config = function() ... require('plu… (nvim-lua#1316)

* docs: clarify using opts = {} vs config = function() ... require('plugin').setup({}) .. end

The current documentation mentioning that using "require" is equivalent to using "opts" without detailing the use in the "config = function()" block seems inaccurate.
Lower in the configuration the "config = function()" block is used without clarifying why it needed and what it does.
This clarification may help new users understand the difference between the two, or how and where to place the "require" statement.

* Update init.lua

* remove whitespace

* fix (nvim-lua#1319): gitsigns deprecated functions (nvim-lua#1321)

- This commit change two functions that are marked as deprecated now:
`gitsigns.stage_hunk` and `gitsigns.toggle_deleted`

* Add a blurb about installing missing emoji on Ubuntu

Right next to the nerdfonts blurb as requested.

* fix: arguments for the `vim.lsp.Client.supports_method` method (nvim-lua#1356)

* feat(diagnostic): add diagnostic config (nvim-lua#1335)

Co-authored-by: gelocraft <gelocraft@users.noreply.github.com>

* perf: load tokyonight.nvim in the intended way (nvim-lua#1360)

Fixes nvim-lua#1357

* feat: add basic function signature help (nvim-lua#1358)

* feat: add basic function signature help

* Update init.lua

Co-authored-by: makeworld <25111343+makew0rld@users.noreply.github.com>

---------

Co-authored-by: makeworld <25111343+makew0rld@users.noreply.github.com>

* Fix: fix the cmp-nvim-lsp-signature-help link (nvim-lua#1363)

* fix: regression introduced in db78c0b (nvim-lua#1367)

* Remove duplicate cmp-path (nvim-lua#1369)

* Propsed fix for init.lua warnings as per nvim-lua#1305 (comment) (nvim-lua#1354)

* feat: add `vim.opt.confirm = true` (nvim-lua#1384)

* fix: use correct github abmonition syntax (nvim-lua#1414)

* changed Conform's format_on_save lambda so that buffers that match disable_filetypes return nil. This allows you to enable a formatter for langages in the disable_filetypes table to have a formatter that can be run manually with Leader-f but doesnt enable format_on_save for them (nvim-lua#1395)

* feat(keymap): move windows without `<C-w>` (nvim-lua#1368)

* fix: minor misspellings (nvim-lua#1450)

* fix: minor misspellings

* revert change for `-Bbuild`

* Change LSP Keybindings to Match the Default `gr` Bindings Introduced in Neovim 0.11 (nvim-lua#1427)

* refactor: change LSP keybindings to the default gr bindings introduced in 0.11

* refactor: modify existing LSP functions to follow  convention

* Remove Telescope `0.1` branch lock (nvim-lua#1448)

* feat: switch nvim-cmp for blink.cmp (nvim-lua#1426)

* remove cmp.lua which was replaced with blink-cmp.lua

* Change to Mason's new address (nvim-lua#1516)

* feat: switch vim-sleuth for guess-indent.nvim (nvim-lua#1512)

* Replace vim.opt with vim.o (nvim-lua#1495)

* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o

* don't lazy-load neo-tree so netrw hijacking on startup works (nvim-lua#1489)

* README: mention fd-find in requirements (nvim-lua#1477)

Fixes nvim-lua#1476

* fix: rename vim.highlight.on_yank to vim.hl.on_yank (nvim-lua#1482)

The functions of vim.highlight were renamed to vim.hl on commit
18b43c331d8a0ed87d7cbefe2a18543b8e4ad360 of neovim, which was applied
with the release of nvim version 0.11.

Now, the use of vim.highlight is deprecated, and instead, one should
use vim.hl functions.
In practice, vim.highlight is still working, however, asking for help
for vim.highlight.on_yank fails (E149), while asking for help for
vim.hl.on_yank works as expected. So, by updating the used function, a
new user will have easier time looking getting the relevant help.

Co-authored-by: Omri Sarig <omri.sarig@prevas.dk>

* Update windows installation command

* remove conflicting stuff

* more changes

* more

---------

Co-authored-by: Damjan 9000 <damjan.9000@gmail.com>
Co-authored-by: Peter S. Jaglom <145091604+pjaglom@users.noreply.github.com>
Co-authored-by: Vinit Neogi <20491952+vneogi199@users.noreply.github.com>
Co-authored-by: Ryan Nevius <rnevius@users.noreply.github.com>
Co-authored-by: bleacheda <60625523+bleacheda@users.noreply.github.com>
Co-authored-by: Erlan Rangel <erlanrangel@gmail.com>
Co-authored-by: Chris Patti <feoh@feoh.org>
Co-authored-by: Jonas Zeltner <jonas.zeltner@posteo.de>
Co-authored-by: GeloCraft <115651305+gelocraft@users.noreply.github.com>
Co-authored-by: gelocraft <gelocraft@users.noreply.github.com>
Co-authored-by: Joaquín Guerra <joaquinguerratocino@gmail.com>
Co-authored-by: Rob <rcsfletcher@protonmail.com>
Co-authored-by: makeworld <25111343+makew0rld@users.noreply.github.com>
Co-authored-by: Aryan Rajoria <57455619+aryan-rajoria@users.noreply.github.com>
Co-authored-by: Ari Pollak <aripollak@users.noreply.github.com>
Co-authored-by: Crypto-Spartan <29098151+Crypto-Spartan@users.noreply.github.com>
Co-authored-by: Luca Saccarola <96259932+saccarosium@users.noreply.github.com>
Co-authored-by: RulentWave <49258216+RulentWave@users.noreply.github.com>
Co-authored-by: Sander <info@mesander.com>
Co-authored-by: dasvh <dasvh@protonmail.com>
Co-authored-by: Theo P. <63016528+theopn@users.noreply.github.com>
Co-authored-by: Dmytro Onypko <vaporif@gmail.com>
Co-authored-by: Liam Dyer <liamcdyer@gmail.com>
Co-authored-by: guru245 <guru245@users.noreply.github.com>
Co-authored-by: Ori Perry <48057913+oriori1703@users.noreply.github.com>
Co-authored-by: pynappo <lehtien.david@gmail.com>
Co-authored-by: Omri Sarig <omri.sarig13@gmail.com>
Co-authored-by: Omri Sarig <omri.sarig@prevas.dk>
Co-authored-by: jaho5 <ho.jason.main@gmail.com>
kien5436 pushed a commit to kien5436/kickstart.nvim that referenced this pull request May 21, 2025
loadre pushed a commit to loadre/kickstart.nvim that referenced this pull request May 21, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o
arkottke pushed a commit to arkottke/kickstart.nvim that referenced this pull request May 21, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o
karolis-arbaciauskas added a commit to karolis-arbaciauskas/kickstart.nvim that referenced this pull request May 22, 2025
commit 6ba2408
Author: Omri Sarig <omri.sarig13@gmail.com>
Date:   Sun May 11 02:29:04 2025 +0200

    fix: rename vim.highlight.on_yank to vim.hl.on_yank (nvim-lua#1482)

    The functions of vim.highlight were renamed to vim.hl on commit
    18b43c331d8a0ed87d7cbefe2a18543b8e4ad360 of neovim, which was applied
    with the release of nvim version 0.11.

    Now, the use of vim.highlight is deprecated, and instead, one should
    use vim.hl functions.
    In practice, vim.highlight is still working, however, asking for help
    for vim.highlight.on_yank fails (E149), while asking for help for
    vim.hl.on_yank works as expected. So, by updating the used function, a
    new user will have easier time looking getting the relevant help.

    Co-authored-by: Omri Sarig <omri.sarig@prevas.dk>

commit f5a9f9c
Author: Damjan 9000 <damjan.9000@gmail.com>
Date:   Sun May 11 02:23:54 2025 +0200

    README: mention fd-find in requirements (nvim-lua#1477)

    Fixes nvim-lua#1476

commit fb73617
Author: pynappo <lehtien.david@gmail.com>
Date:   Sat May 10 17:18:04 2025 -0700

    don't lazy-load neo-tree so netrw hijacking on startup works (nvim-lua#1489)

commit c92ea7c
Author: Ori Perry <48057913+oriori1703@users.noreply.github.com>
Date:   Sun May 11 03:16:03 2025 +0300

    Replace vim.opt with vim.o (nvim-lua#1495)

    * Replace vim.opt with vim.o

    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)

    * Add type hint for vim.opt.rtp

    * Add a comment about using vim.opt instead of vim.o

commit 2b2f0f8
Author: guru245 <guru245@users.noreply.github.com>
Date:   Sun May 11 09:11:50 2025 +0900

    feat: switch vim-sleuth for guess-indent.nvim (nvim-lua#1512)

commit 76cb865
Author: guru245 <guru245@users.noreply.github.com>
Date:   Sat May 10 08:41:44 2025 +0900

    Change to Mason's new address (nvim-lua#1516)
gcaufield added a commit to gcaufield/kickstart.nvim that referenced this pull request May 23, 2025
* upstream/master:
  Update remaining Mason's old address (nvim-lua#1530)
  fix: rename vim.highlight.on_yank to vim.hl.on_yank (nvim-lua#1482)
  README: mention fd-find in requirements (nvim-lua#1477)
  don't lazy-load neo-tree so netrw hijacking on startup works (nvim-lua#1489)
  Replace vim.opt with vim.o (nvim-lua#1495)
  feat: switch vim-sleuth for guess-indent.nvim (nvim-lua#1512)
  Change to Mason's new address (nvim-lua#1516)
  feat: switch nvim-cmp for blink.cmp (nvim-lua#1426)
  Remove Telescope `0.1` branch lock (nvim-lua#1448)
  Change LSP Keybindings to Match the Default `gr` Bindings Introduced in Neovim 0.11 (nvim-lua#1427)
  fix: minor misspellings (nvim-lua#1450)
  feat(keymap): move windows without `<C-w>` (nvim-lua#1368)
  changed Conform's format_on_save lambda so that buffers that match disable_filetypes return nil. This allows you to enable a formatter for langages in the disable_filetypes table to have a formatter that can be run manually with Leader-f but doesnt enable format_on_save for them (nvim-lua#1395)
  fix: use correct github abmonition syntax (nvim-lua#1414)
notmaiku pushed a commit to notmaiku/kickstart.nvim that referenced this pull request May 23, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o
ests pushed a commit to ests/kickstart.nvim that referenced this pull request May 24, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o
ests pushed a commit to ests/kickstart.nvim that referenced this pull request May 24, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o
@ests ests mentioned this pull request May 24, 2025
bradenaa added a commit to bradenaa/kickstart.nvim that referenced this pull request May 24, 2025
* Change to Mason's new address (nvim-lua#1516)

* feat: switch vim-sleuth for guess-indent.nvim (nvim-lua#1512)

* Replace vim.opt with vim.o (nvim-lua#1495)

* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o

* don't lazy-load neo-tree so netrw hijacking on startup works (nvim-lua#1489)

* README: mention fd-find in requirements (nvim-lua#1477)

Fixes nvim-lua#1476

* fix: rename vim.highlight.on_yank to vim.hl.on_yank (nvim-lua#1482)

The functions of vim.highlight were renamed to vim.hl on commit
18b43c331d8a0ed87d7cbefe2a18543b8e4ad360 of neovim, which was applied
with the release of nvim version 0.11.

Now, the use of vim.highlight is deprecated, and instead, one should
use vim.hl functions.
In practice, vim.highlight is still working, however, asking for help
for vim.highlight.on_yank fails (E149), while asking for help for
vim.hl.on_yank works as expected. So, by updating the used function, a
new user will have easier time looking getting the relevant help.

Co-authored-by: Omri Sarig <omri.sarig@prevas.dk>

* Update remaining Mason's old address (nvim-lua#1530)

* conflict

* move plugins to folder

---------

Co-authored-by: guru245 <guru245@users.noreply.github.com>
Co-authored-by: Ori Perry <48057913+oriori1703@users.noreply.github.com>
Co-authored-by: pynappo <lehtien.david@gmail.com>
Co-authored-by: Damjan 9000 <damjan.9000@gmail.com>
Co-authored-by: Omri Sarig <omri.sarig13@gmail.com>
Co-authored-by: Omri Sarig <omri.sarig@prevas.dk>
Co-authored-by: Carlos Calla Alarcón <calla.alarcon@gmail.com>
bradenaa pushed a commit to bradenaa/kickstart.nvim that referenced this pull request May 24, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o
melito00 pushed a commit to melito00/kickstart.nvim that referenced this pull request May 25, 2025
* Replace vim.opt with vim.o

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)

* Add type hint for vim.opt.rtp

* Add a comment about using vim.opt instead of vim.o
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