Skip to content

Commit 39bd110

Browse files
authored
Fix overriding the default filetype detection (#206)
Vim recognizes the filetype of .editorconfig as editorconfig, not dosini, by default since patch-9.0.1167. It's a superset of the dosini syntax. However editorconfig.vim always overrides it with dosini. To fix this, set the filetype only if Vim hasn't set it yet.
1 parent 1953c0f commit 39bd110

4 files changed

Lines changed: 4 additions & 9 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ To install this plugin, you can use one of the following ways:
1414

1515
Download the [archive][] and extract it into your Vim runtime directory
1616
(`~/.vim` on UNIX/Linux and `$VIM_INSTALLATION_FOLDER\vimfiles` on windows).
17-
You should have 3 sub-directories in this runtime directory now: "autoload",
18-
"doc" and "plugin".
17+
You should have 4 sub-directories in this runtime directory now: "autoload",
18+
"doc", "ftdetect" and "plugin".
1919

2020
### Install as Vim8 plugin
2121

ftdetect/editorconfig.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
autocmd BufNewFile,BufRead .editorconfig setfiletype=dosini

mkzip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22

3-
zip -r editorconfig-vim-$*.zip plugin/* autoload/* doc/*
3+
zip -r editorconfig-vim-$*.zip autoload/* doc/* ftdetect/* plugin/*

plugin/editorconfig.vim

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,6 @@ command! EditorConfigReload call s:UseConfigFiles() " Reload EditorConfig files
285285
" On startup, enable the autocommands
286286
call s:EditorConfigEnable(1)
287287

288-
" Always set the filetype for .editorconfig files
289-
augroup editorconfig_dosini
290-
autocmd!
291-
autocmd BufNewFile,BufRead .editorconfig set filetype=dosini
292-
augroup END
293-
294288
" }}}1
295289

296290
" UseConfigFiles function for different modes {{{1

0 commit comments

Comments
 (0)