1

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

1 Answer 1

0
: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.

4
  • 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, 2011 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, 2011 at 22:50
  • thanks <buffer> is the key, I added you answer to my tex/vim template ;)
    – juanpablo
    Oct 30, 2011 at 0:37
  • @juanpablo - Glad it helped :)
    – Rook
    Oct 30, 2011 at 1:57

You must log in to answer this question.

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