From 236d433cd86b3f6fb4ba9311fb1abedce19c4db0 Mon Sep 17 00:00:00 2001 From: Kenneth Ballenegger Date: Tue, 14 Mar 2017 15:20:33 -0700 Subject: [PATCH 1/2] Remove *.tsx detection as discussion in issue #110 --- ftdetect/typescript.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftdetect/typescript.vim b/ftdetect/typescript.vim index 481aa47..eef435b 100644 --- a/ftdetect/typescript.vim +++ b/ftdetect/typescript.vim @@ -1 +1 @@ -autocmd BufNewFile,BufRead *.ts,*.tsx setlocal filetype=typescript +autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript From a2db0cb5e7c7be873663365d9aa947d3d34eea15 Mon Sep 17 00:00:00 2001 From: Leaf Garland Date: Wed, 15 Mar 2017 15:00:24 +1300 Subject: [PATCH 2/2] 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 #110 close #111 --- ftdetect/typescript.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ftdetect/typescript.vim b/ftdetect/typescript.vim index eef435b..7c10206 100644 --- a/ftdetect/typescript.vim +++ b/ftdetect/typescript.vim @@ -1 +1,4 @@ -autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript +" use `set filetype` to override default filetype=xml for *.ts files +autocmd BufNewFile,BufRead *.ts set filetype=typescript +" use `setfiletype` to not override any other plugins like ianks/vim-tsx +autocmd BufNewFile,BufRead *.tsx setfiletype typescript