Questions tagged [ftdetect]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers

.dist trick does not work for .neon files

One year has passed since How to get syntactic coloration for dist files, and recently, I have decided to installed the archived/abandoned to get some syntactic ...
  • 143
0 votes
0 answers

Setting ftdetect a given directory

I'm looking for a way to set filetype on load, a loading phase via ftdetect. Right now I can open the files inside a given directory via some utility function that I wrote, and during the opening ...
  • 121
9 votes
1 answer

How to do file type detection based on file contents (e.g. a certain shebang line)?

I have created a few scripts in .vim/ftdetct to e.g. detect the filetype of sshconfig files based on their filename: autocmd BufRead,BufNewFile ~/.ssh/host-* setfiletype sshconfig Now, how can I make ...
  • 1,075
4 votes
2 answers

Is it possible to override the filetype of a text file based on the first line?

I have some specifically formatted text files that I'd like to detect when I start vim. When I load these files now, the filetype is automatically set to text. I only want to override that if the ...
0 votes
1 answer

Why are files in after/ftplugin/ run on every save, and can I work around it?

I have a variety of vimscripts for different filetypes in ~/.vim/after/ftplugin, e.g. text.vim, vim.vim, etc. These contain a variety of settings, mappings, etc. Only recently, I've noticed (not sure ...