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

后端 未结 3 1347
既然无缘
既然无缘 2021-02-18 15:52

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          


        
3条回答
  •  别那么骄傲
    2021-02-18 16:54

    Put this into ~/.vim/ftdetect/text.vim (this path will be slightly different on windows):

    autocmd BufRead,BufNewFile *.txt setfiletype text
    

    Then put this into ~/.vim/ftplugin/text.vim:

    setlocal wrap
    setlocal linebreak
    

    It's preferable to only do the autocmd once for a filetype, and to separate it from your vimrc file.

提交回复
热议问题