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

I can set the custom filetype settings for the know file types using the *.vim files in ftplugin directory, e.g. c.vim for (c, cpp, h, hxx), python.vim etc.

But I want to set the file types for the custom file extension like *.text, *.letter, *.journal etc. I tried using text.vim and so on but that didn't work.

share|improve this question
up vote 4 down vote accepted

You are looking for autocommands. Add a line for each custom file extension in your .vimrc:

au! BufRead,BufNewFile *.ext setfiletype ext

Then you can specify settings for .ext files in ftplugin/ext.vim.

PS: Note that autocommands must be defined inside an augroup.

share|improve this answer

You are looking for :h new-filetype.

share|improve this answer
    
Your answer is great but mrucci gave a direct solution. – Xolve Jun 29 '10 at 14:32
1  
Direct, indeed. But incomplete. There exist files dedicated to filetype detection. – Luc Hermitte Jun 29 '10 at 15:16

You must log in to answer this question.

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