2

I created a (new and empty) file Changelog.txt and Vim started with completely different settings than with any other text file (yellow font, automatic line breaking, maybe more I didn't notice).

As far as I know, nothing in my .vimrc should cause this, unless it is the fault of a plugin (I use undotree and julia-vim). Is this some kind of a default behavior specifically for this filename?

1
  • Run :verbose set filetype? to find where the filetype was set and modify there if possible
    – balki
    Commented Sep 6, 2023 at 13:15

1 Answer 1

2

Vim use the name of the file to detect the filetype of the file.

If the name of the file is ChangeLog.* or ChangeLog it associate it to the changelog file type that has some special settings.

If you want to get rid of this behavior you could add a changelog.vim in your ~/vimfiles/ftdetect folder with the following content:

autocmd BufNewFile,BufRead [cC]hange[lL]og.txt set ft=text

(See :help ftdetect, especially items A.1 through A.3.)

This solution assumes that you have the following line in your vimrc

filetype plugin on

Or that you are using the default.

You can check the value of your configuration using the :filetype command.

3
  • 1
    I would rather place those in ~/.vim/ftdetect/changelog.vim (:help ftdetect, esp. item A.3)
    – D. Ben Knoble
    Commented Sep 6, 2023 at 15:39
  • @BebKnoble this is what I have proposed ~/vimfiles/ftdetect/changelog.vim or in Linux/MacOs ~/.vim/ftdetect/changelog.vim I never know which convention to use when the OP don't mention the OS. Any recommendation? Commented Sep 6, 2023 at 15:49
  • Oof, I think I skipped the paragraph where you already said that. My bad. I'm not aware of a good convention (I sometimes say "in your home directory on runtimepath, but it's wordy). I default to ~/.vim because I'm on nix-ish systems. Your wording is fine.
    – D. Ben Knoble
    Commented Sep 6, 2023 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.