Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you write 'plus equals' in Lua for a vim setting?

Tags:

lua

neovim

How does set mouse+=a translate to the equivalent Lua Neovim setting?

like image 887
garrettmaring Avatar asked Jul 21 '26 23:07

garrettmaring


1 Answers

vim.opt.mouse returns a mouse option object.

You can use Option:append(value) to append a string value to an option like this.

-- These are equivalent
vim.opt.mouse:append('a')
vim.opt.mouse = vim.opt.mouse + 'a'

Learn more in :h vim.opt:append()

There is also a vim.o.mouse, which returns the option as a string. You can also append a string value to it using ...

vim.o.mouse = vim.o.mouse .. 'a'
like image 51
theJian Avatar answered Jul 25 '26 06:07

theJian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!