typescript-vim
typescript-vim copied to clipboard
No syntax Highlighting
Hi. I've installed this according to the "Usage" section, but my editor text is still 100% green. How do you enable syntax highlighting? Thanks.
Hi. Usually you enable syntax highlighting by adding syntax enable
to your vimrc. If you haven't done that then I suggest you start with https://github.com/tpope/vim-sensible which gives you the minimum sensible config for getting started with vim.
If you have enabled that then I will need some more information about your setup.
Same for me. When I check :set ft?
the output is filetype=xml
. By setting set syntax=typescript
, everything works just fine.
what version of vim are you using? The default vim runtime files do set an xml filetype for .ts files, this plugin should override that but obviously isn't in some cases.
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 16 2016 19:43:13)
MacOS X (unix) version
Included patches: 1-1724
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +tag_binary
+arabic +file_in_path +mouse_sgr +tag_old_static
+autocmd +find_in_path -mouse_sysmouse -tag_any_white
-balloon_eval +float +mouse_urxvt -tcl
-browse +folding +mouse_xterm +terminfo
++builtin_terms -footer +multi_byte +termresponse
+byte_offset +fork() +multi_lang +textobjects
+channel -gettext -mzscheme +timers
+cindent -hangul_input +netbeans_intg +title
-clientserver +iconv +packages -toolbar
+clipboard +insert_expand +path_extra +user_commands
+cmdline_compl +job +perl +vertsplit
+cmdline_hist +jumplist +persistent_undo +virtualedit
+cmdline_info +keymap +postscript +visual
+comments +langmap +printer +visualextra
+conceal +libcall +profile +viminfo
+cryptv +linebreak +python +vreplace
+cscope +lispindent -python3 +wildignore
+cursorbind +listcmds +quickfix +wildmenu
+cursorshape +localmap +reltime +windows
+dialog_con +lua +rightleft +writebackup
+diff +menu +ruby -X11
+digraphs +mksession +scrollbind -xfontset
-dnd +modify_fname +signs -xim
-ebcdic +mouse +smartindent -xsmp
+emacs_tags -mouseshape +startuptime -xterm_clipboard
+eval +mouse_dec +statusline -xterm_save
+ex_extra -mouse_gpm -sun_workshop -xpm
+extra_search -mouse_jsbterm +syntax
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H -F/usr/local/Frameworks -DMACOS_X_UNIX -Os -w -pipe -march=native -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang -L. -L/usr/local/lib -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -o vim -lm -lncurses -liconv -framework Cocoa -L/usr/local/lib -llua -fstack-protector -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -F/opt/local/Library/Frameworks -framework Python -lruby.2.0.0 -lobjc
I have same problem, I fix it by adding command to set filetype to typescript whenever file extension *.ts
is opened.
autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript
Place the command on your vimrc
.
Having the same problem with vim 8.0 - set ft?
returns xml, and I had to manually set the type to typescript
If you installed this plugin with Vundle make sure that filetype off
is before the Vundle section in your .vimrc and 1. filetype plugin indent on
and 2. syntax on
are after call vundle#end()
. If any of the two are set before the Vundle section ftdetect will not be sourced, and therefore no highlighting active. I hope that helps.
@mike-kfed Awesome sauce! Weird that syntax highlighting worked for me for the many other plugins I have installed...
If you add autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript
to your vim RC and dont have syntax highlighting, try running verbose set filetype
In my case I saw filetype=typescript^M
. I somehow had a windows line ending, while using vim through mingw/msys.
the solution was to run dos2unix ~/.vim/bundle/typescript-vim/ftdetect/typescript.vim
another tips for vundle users: care your bundle_groups and the scope where your Plug 'leafgarland/typescript-vim'
declared.
I have same problem, I fix it by adding command to set filetype to typescript whenever file extension
*.ts
is opened.
autocmd BufNewFile,BufRead *.ts setlocal filetype=typescript
Place the command on your
vimrc
.
thanks after toiling for days I finally fixed it thanks a lot
I also have this issue, I tried all of the recommended solutions above. The filetype is correctly set to typescript, however i still have no syntax highlighting.
I have the same issue as @joshjconlin, vim v8.1m using iterm2 and solarized theme
are you using vim-polyglot?
i disabled it for typescript files and everything started working.
I re-did my installation with vim-plug
and got it to work, I was trying to use the built in package loader for vim 8 before