I installed the typescript plugin via
git clone https://github.com/leafgarland/typescript-vim.git ~/.vim/bundle/typescript-vim
and inserted
au BufRead,BufNewFile *.ts setfiletype typescript
into by ~/.vim.rc
. Linting via Syntastic and tsc/tslint works well, and
:set syntax
shows syntax=typescript
. However,
:syntax
shows No Syntax items defined for this buffer
and highlighting doesn't work.
Any idea what's going wrong?
After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.
vim-jsx-pretty does have TypeScript support, but I had some performance issues when highlighting large TSX files. For projects that use styled components, I use styled-components/vim-styled-components which highlights CSS inside the styled and css template strings.
VIM is an alternative and advanced version of VI editor that enables Syntax highlighting feature in VI. Syntax highlighting means it can show some parts of text in another fonts and colors. VIM doesn't show whole file but have some limitations in highlighting particular keywords or text matching a pattern in a file.
A collection of language packs for Vim. One to rule them all, one to find them, one to bring them all and in the darkness bind them. It won't affect your startup time, as scripts are loaded only on demand*. It installs and updates 120+ times faster than the 599 packages it consists of.
What was missing from ~/.vimrc
is a specification of where to find the plugin, i.e.,
Plugin 'leafgarland/typescript-vim'
Highlighting works now.
Vim 8 has native package loading. Leave .vimrc
alone and just do this:
$ mkdir -p ~/.vim/pack/typescript/start $ cd ~/.vim/pack/typescript/start $ git clone https://github.com/leafgarland/typescript-vim.git
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With