vimtext-files

vim: would like it to turn settings on only for certain file types


I've looked at this but it wasn't too much help. Maybe I didn't read it too well.

Basically what I want is when I open a .txt file the settings:

set wrap
set linebreak

are turned on. How might I go about doing that?

Thanks in advance.

Also, I'm using XP.


Solution

  • My answer to that question still applies:

    Put autocmd commands based on the file suffix in your ~/.vimrc

    autocmd BufRead,BufNewFile   *.txt set wrap linebreak
    

    As Luc says, you might prefer to

    autocmd BufRead,BufNewFile   *.txt setlocal wrap linebreak
    

    if you're likely to open txt and non-txt files at the same time.