Questions tagged [ftdetect]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
47 views

How to overwrite ftdetect from a plugin loaded with lazy?

I am using ansible.vim I am loading it with lazy: return { 'pearofducks/ansible-vim', } and this is the configuration I have for ansiblels: ["ansiblels"] = function() ...
nbari's user avatar
  • 131
2 votes
3 answers
471 views

How can I avoid built-in filetype detection?

I have a plugin for detecting and syntax highlighting *.k - source files in a given programming language. My ~/.vimrc contains only: se nocp rtp+=~/k/vim-k " the language plugin sy on And ...
ngn's user avatar
  • 163
0 votes
2 answers
164 views

ftdetect, ftplugin not working as advertised -- what am I missing?

I've been reading documentation and trying experiments to register a new filetype in vim, and apply desired indentation rules -- all to no avail. As an example, say I want to register *.test as ...
StoneThrow's user avatar
0 votes
0 answers
369 views

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 ...
ekiim's user avatar
  • 133
9 votes
1 answer
2k views

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 ...
Shuzheng's user avatar
  • 1,195
4 votes
2 answers
1k views

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 ...
Sam Alleman's user avatar
0 votes
1 answer
183 views

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 ...
Andrew Ferrier's user avatar