How to have a soft word-wrap without messing with vertical splits?

Hello all again :slight_smile:

Some days ago I configured Neovim to make paragraphs in Markdown files be a single line, but to see them visually wrapped. I’ll call this feature soft-wrap:

vim.o.textwidth = 0
vim.o.wrapmargin = 0
-- visual wrap (no real line cutting is made)
vim.o.wrap = true
vim.o.linebreak = true -- breaks by word rather than character

However since my monitor lets Neovim to have 165 columns, this configuration doesn’t make much sense: I wanted to have a narrower view of my documents to aid in my reading.

Then I found and added:

vim.opt_local.columns = 80

Which makes Neovim think it has only 80 columns. And that was pretty good… Until today that I found that this option also affects vertical splits: now my Markdown documents are hard to read when working with vertical splits because the buffer is too narrow.

What would be the best approach to have a dynamic setting? I’d like to have vim.opt_local.columns = 80 permanently set, but to get back automatically to the hardware allowed width when I make a vertical split.