1

I like the incsearch and hlsearch options in Vim, so early on in my .vimrc file, I have the following lines:

augroup allfiles
    autocmd FileType * :set nocindent noexpandtab incsearch hlsearch
augroup END

For most file formats (e.g., any .txt, .tex, .sql, or .pl file, and for .vimrc itself), this works fine, but when I'm editing a .csv file (often exported by Excel, but not always), these options aren't on when I start Vim. I can manually enable them, but I usually forget until I've already started trying to search for something, and then I have to stop what I'm doing and enable those options.

I'm curious why they're disabled by default for this specific file type.

I have no augroup or autocmd lines in my .vimrc file that are specific to .csv files, so I don't think I'm disabling this later on in the config file.

In case it matters: I'm using version 8.1.3741 via Ubuntu on WSL2.

1 Answer 1

4

The event "FileType" is triggered after :h 'filetype' option is set for a buffer. And if it's not then, well, not.

The "csv" file type (detection only) was added just few days ago (v9.0.0049). So, no surprise it's not working on your setup.

You can update your Vim or just add this bit yourself, see :h ftdetect.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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