How do I set an option that affects only the current buffer/window?

Some of the Vim options can have a local or global value. A local value applies only to a specific buffer or window. A global value applies to all the buffers or windows. When a Vim option is modified using the “:set” command, both the global and local values for the option are changed. You can use the “:setlocal” command to modify only the local value for the option and the “:setglobal” command to modify only the global value. You can use the “:setlocal” command to set an option that will affect only the current file/buffer:

    :setlocal textwidth=70

Note that not all options can have a local value. You can use “:setlocal” command to set an option locally to a buffer/window only if the option is allowed to have a local value. You can also use the following command to set an option locally:

    :let &l:{option-name} = 

Comments (1)


Pepsh Pepshinsky

Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE


Speak Your Mind