Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Vim I make local buffer definition with setl and with iabbrev abbreviations. How can I set local buffer or filetype iabbrev?

share|improve this question

1 Answer 1

up vote 0 down vote accepted
:autocmd FileType javascript iabbrev <buffer> abbreviation expanded_abbreviation

Is this what you were looking for? It will set an abbreviation for insert mode, that will work only when javascript filetype is open. It will not work in other filetypes nor in other buffers.

share|improve this answer
but, if I have open a c file and open a js file, the js file load the iabbrev, this iabbrev affect c file ? –  juanpablo Oct 29 '11 at 22:41
@juanpablo - For variations on the theme play with the filetype and the <buffer> option (throw it out if necessary). If neither works the way you expect, throw a little description in here, and i'll do my best to help. –  ldigas Oct 29 '11 at 22:50
thanks <buffer> is the key, I added you answer to my tex/vim template ;) –  juanpablo Oct 30 '11 at 0:37
@juanpablo - Glad it helped :) –  ldigas Oct 30 '11 at 1:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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