I have a following very simple .vimrc
file based on an example in Practical Vim book:
set nocompatible
set hidden
if has("autocmd")
filetype on
autocmd FileType sh setlocal ts=2 sts=2 sw=2 expandtab
endif
As I understand, if file is a shell script file, then FileType
event happens, if condition is started and setlocal ts=2 sts=2 sw=2 expandtab
command is executed? However, what is the point of keeping the filetype on
(enables file type detection) inside the if
statement? Shouldn't this be outside and before the if
statement?
:filetype
needs a version of Vim compiled withautocmd
to work.