0

How can I assign showbreak a value locally to a buffer? The following makes it +++ for all buffers.

let &showbreak="+++" 

I can set Vim options locally to a buffer by using setlocal instead of set. I was wondering if there is a way to this with internal variables as well, if there is available some kind of *letlocal, so to speak.

1
  • 'showbreak' is a plain option, not an internal variable. You're just using the :let &... syntax to modify it; :set would work just as well. Mar 18, 2015 at 13:57

1 Answer 1

1

Check out :help 'showbreak':

'showbreak' 'sbr'   string  (default "")
                    global

The global means that there's no buffer- or window-local value.

You have to either

  • Work around this with a set of :autocmds that switch the option based on the entered buffer. However, if you have multiple buffers in split windows, the other ones will also show the changed value. This is similar to the frequent request of having different colorschemes per buffer.
  • Write a patch that turns the global option into supporting local values, so that you can :setlocal them, or convince someone on the vim_dev mailing list to implement such feature.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.