Typescript Syntax for Vim
Checkout Tsuquyomi for omni-completion and other features for TypeScript editing.
git clone https://github.com/leafgarland/typescript-vim.git ~/.vim/bundle/typescript-vim
If you want to install manually then you need to copy the files from this
repository into your vim path, see the vim docs for :help
for more information. This might be as simple as copying the files and
~/.vim/ but it depends on your Vim install and operating
Once the files are installed the syntax highlighting and other settings will be
automatically enabled anytime you edit a
it works pretty well but there are cases where it fails. If these bother you or
want to use other indent settings you can disable it by setting a flag in your
let g:typescript_indent_disable = 1
If you want the indenter to automatically indent chained method calls as you type.
something .foo() .bar();
Then add something like
setlocal indentkeys+=0. to your
:help 'indentkeys' in vim for more information.
If you use the
= operator to re-indent code it will always indent
chained method calls - this can be disabled by changing the regex the
indent script uses to identify indented lines. In this case removing '.'
from the regex means that it wont indent lines starting with '.'. Note,
this is not ideal as the regex may change making your setting out of date.
This plugin contains compiler settings to set
The compiler settings enable you to call the
tsc compiler directly from Vim
and display any errors or warnings in Vim's QuickFix window.
To run the compiler, enter
:make, this will run
tsc against the last saved
version of your currently edited file.
The default for
tsc $* %. You can enter other compiler options into your
command line and they will be inserted in place of
There are options to change the compiler name and to insert default options.
let g:typescript_compiler_binary = 'tsc' let g:typescript_compiler_options = ''
You can completely override this plugin's compiler settings with something like
this in your
.vimrc, where you can set makeprg to whatever you want.
autocmd FileType typescript :set makeprg=tsc
Note, this plugin's compiler settings are not used by Syntastic which has its own way of changing the options. See https://github.com/scrooloose/syntastic#faqargs.
You can use something like this in your
.vimrc to make the QuickFix
window automatically appear if
:make has any errors.
autocmd QuickFixCmdPost [^l]* nested cwindow autocmd QuickFixCmdPost l* nested lwindow