Updating shada option in lua


I want to change shada option to remember last 300 files instead of 100. I want to leave everything else as is. I can’t just do

vim.opt.shada:append( "'300" )

Because it won’t remove the original '100 setting in shada option. What works is:

vim.opt.shada:remove( "'100" )
vim.opt.shada:append( "'300" )

But isn’t it a bit overkill? And what if, in the future version of nvim, the default shada setting will change from '100 to '200, for example? The above code will quietly become wrong.

Any suggestions?

You could set it like this:

vim.o.shada = "!,'300,<50,s10,h"

The other values are the default ones.