How to Get Syntax Highlighting for TypeScript in GVIM on Windows

Published 06/04/2016 - Updated 27/07/2023

A profile picture of Gary Lewis Cheetham, the author of this article

Written by

Gary Lewis Cheetham

Automotive marketing specialist from Manchester, UK

Table of Contents [Show]

    urghh… Looks terrible doesn’t it? It’s not provided by default, but if you need to work with a TypeScript project in vim then you’ll certainly need to set up syntax highlighting.

    The good news is that it’s very easy to get going with a vim addon called typescript-vim. This link is all you need if you already have a vim addon manager, but otherwise I’d recommend you install pathogen.

    To install pathogen on Windows, you’ll need to download pathogen.vim from https://github.com/tpope/vim-pathogen/ and place it under %USERPROFILE%vimfilesautoload (for me, that was C:Usersglcheethamvimfilesautoloadpathogen.vim). The easiest way to do this is to execute the following in a shell:

    cd %USERPROFILE%vimfiles
    git clone https://github.com/tpope/vim-pathogen/

    Next, to get pathogen to load on vim startup, you’ll need to place the vimscript code at the top of your vimrc (or %USERPROFILE%_gvimrc for me)

    execute pathogen#infect()
    filetype off
    syntax on
    filetype plugin indent on

    Don’t mind the microbe metaphors, that’s just the author’s sense of humour.

    Now, to install the syntax highlighting plugin, you’ll need to place the files from https://github.com/leafgarland/typescript-vim into %USERPROFILE%vimfilesbundle. Again, the easiest way to do this is git clone:

    cd %USERPROFILE%vimfilesbundle
    git clone https://github.com/leafgarland/typescript-vim

    And… that’s it! Pathogen should now helpfully load the typescript-vim package for you whenever vim starts up – and you’ll be able to carry on working without going cross-eyed.

    Expert advice

    You're reading the GL Digital blog, where auto marketing experts share proven tactics to grow your dealership.

    Struggling to make good video?

    Sometimes it feels like posting on TikTok is a waste of time.

    Build a powerful local brand and watch customers roll in from TikTok.

    About the author

    A profile picture of Gary Lewis Cheetham, the founder of GL Digital Automotive Marketing, smiling outside a car dealership

    Gary Lewis Cheetham is an automotive marketing specialist, born and raised in Oldham, Greater Manchester. Gary Lewis Cheetham is the founder of GL Digital Automotive Marketing. He spent his teenage years working at the family dealership after school, learning the ropes of the car trade from the inside out.

    After moving on to working in marketing, Gary Lewis founded GL Digital in 2020 when he noticed a need for direct-to-consumer marketing platforms within the auto industry. He now strives every day to help independent dealers in the UK and US realise their potential. Gary also loves Formula 1 and motorsport.