Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM: Difference between set and setl in view of filetype

Tags:

vim

I understand that VIM makes a difference between set and setl in that the first one sets an option for all buffers while the latter one sets the option fur the current buffer only. This is evident if I have do a :set tw=80 as opposed to a :setl tw=80.

Now, when I do a :set ft=plsql, it only opperates on the current buffer although I did not do a setl. This, of course, makes sense. Yet, I fail to see if this is documented somewhere. So, the question probably boils down to: are there options that by default operate on the current buffer while others operate "everywhere" and where is that documented?

like image 258
René Nyffenegger Avatar asked Jan 13 '11 15:01

René Nyffenegger


1 Answers

There are indeed options that operate on the current buffer (and indeed the current window in some cases). The documentation is with the documentation for the option. If you go to any option in :help option-list, it will have one of the following three strings as the third-ish line:

global
local to window
local to buffer

(or some combination of them). For example, :help 'ft' gives:

                    *'filetype'* *'ft'*
'filetype' 'ft'     string (default: "")
            local to buffer
            {not in Vi}
            {not available when compiled without the |+autocmd|
            feature}
    When this option is set, the FileType autocommand event is triggered.
    All autocommands that match with the value of this option will be
    executed.  Thus the value of 'filetype' is used in place of the file
    name.

So this option is local to the buffer. For more discussion, see:

:help option-summary
like image 83
DrAl Avatar answered Oct 12 '22 22:10

DrAl