I want to set some commands for specific filetypes. For example an abbreviation: :iabbr Sb SameBatchThe files have extension like .data, .pro. Their grammar, syntax-highlighting are defined in the framework. I am unaware of those things. Those files contain variables and their values for Perl scripts.I tried :au FileType data iabbr di dittoBut it doesn't work.I thought that the extension is the file type of a file. Is it wrong and how to get it worked?
How to set commands for unrecognised file type
vimrc;command line;autocmd;filetype
You could use the BufEnter autocommand event like this:autocmd! BufEnter *.data :iabbr <buffer> di dittoThe abbreviation will be created when you enter a buffer which is named anything followed by .data and will exists only in this buffer thanks to <buffer>.To answer more precisely the comment of @SibiCoder I'll detail the line:BufEnter trigger the command when a the user enter a buffer.*.data restrict the execution of the autocommand to files ending with .data this way when you enter a file named foo.c or bar.sh the autocommand is not trigger.:iabbr <buffer> di ditto is the command to execute and because of the <buffer> argument the abbreviation will be defined only for the current buffer.See :h autocommand-events and :h :abbreviate-<buffer>