Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set vim updatetime for a specific file type

Tags:

vim

I would like to modify vim's updatetime for files with a specific extension. I've tried accomplishing this by adding the following line to my ~/.vimrc:

autocmd BufRead,BufNewFile *.t set updatetime=60000

This doesn't seem to work. When I open up a file with a .t extension and type :set ut? I see the default updatetime=4000.

like image 944
user1272534 Avatar asked Nov 01 '12 18:11

user1272534


1 Answers

The 'updatetime' setting is a global setting, it is not meant to have different values for different buffers. Why do you want a different value?

You can work around this with autocmds, as you've attempted. However, the BufRead,BufNewFile events will only fire when a buffer is loaded; it won't update the setting as you switch buffers. The correct way is to define two autocmds on BufEnter; a general one to reset the setting, and (following that, so that it is executed after the first!) one that matches your file patterns and manipulates the setting:

autocmd BufEnter * set updatetime=4000
autocmd BufEnter *.t set updatetime=60000
like image 99
Ingo Karkat Avatar answered Oct 28 '22 18:10

Ingo Karkat