Vim run autocmd on all filetypes EXCEPT

后端 未结 5 1814
悲哀的现实
悲哀的现实 2020-12-02 07:55

I have a Vim autocmd that removes trailing whitespace in files before write. I want this almost 100% of the time, but there are a few filetypes that I\'d like it disabled. C

5条回答
  •  -上瘾入骨i
    2020-12-02 08:39

    Another choice of one line way:

    let blacklist = ['rb', 'js', 'pl']
    autocmd BufWritePre * if index(blacklist, &ft) < 0 | do somthing you like
    

    Then you can do something you like for all filetypes except those in blacklist.

提交回复
热议问题