Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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. – Rook 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 :) – Rook Oct 30 '11 at 1:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .