Skip to content

Commit a2db0cb

Browse files
committed
Do not override previous filetype for *.tsx
There are other plugins (like ianks/vim-tsx) that set their own filetype for *.tsx files and we don't want to override them. Using `setfiletype` does that by only setting the filetype if it has not already been set. For *.ts files we continue to use `set filetype` as that will overwrite the default for *.ts files. fix leafgarland#110 close leafgarland#111
1 parent 236d433 commit a2db0cb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ftdetect/typescript.vim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript
1+
" use `set filetype` to override default filetype=xml for *.ts files
2+
autocmd BufNewFile,BufRead *.ts set filetype=typescript
3+
" use `setfiletype` to not override any other plugins like ianks/vim-tsx
4+
autocmd BufNewFile,BufRead *.tsx setfiletype typescript

0 commit comments

Comments
 (0)