typescript-vim icon indicating copy to clipboard operation
typescript-vim copied to clipboard

No syntax Highlighting

Open JimLynchCodes opened this issue 8 years ago • 15 comments

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.

JimLynchCodes avatar Sep 01 '16 18:09 JimLynchCodes

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.

leafgarland avatar Sep 01 '16 19:09 leafgarland

Same for me. When I check :set ft? the output is filetype=xml. By setting set syntax=typescript, everything works just fine.

snipem avatar Sep 04 '16 20:09 snipem

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.

leafgarland avatar Sep 04 '16 21:09 leafgarland

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

snipem avatar Sep 04 '16 21:09 snipem

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.

theikalman avatar Sep 17 '16 20:09 theikalman

Having the same problem with vim 8.0 - set ft? returns xml, and I had to manually set the type to typescript

mkonecny avatar Feb 18 '17 17:02 mkonecny

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 avatar May 23 '17 12:05 mike-kfed

@mike-kfed Awesome sauce! Weird that syntax highlighting worked for me for the many other plugins I have installed...

antgel avatar Jul 28 '17 14:07 antgel

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

Dozer1170 avatar Oct 12 '17 20:10 Dozer1170

another tips for vundle users: care your bundle_groups and the scope where your Plug 'leafgarland/typescript-vim' declared.

shinux avatar Jan 22 '19 17:01 shinux

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

rish15 avatar Dec 08 '19 03:12 rish15

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.

joshjconlin avatar Feb 06 '20 05:02 joshjconlin

I have the same issue as @joshjconlin, vim v8.1m using iterm2 and solarized theme

ahouck avatar Apr 28 '20 00:04 ahouck

are you using vim-polyglot?

i disabled it for typescript files and everything started working.

jrc2139 avatar Jun 22 '20 21:06 jrc2139

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

ahouck avatar Jun 23 '20 18:06 ahouck