I'm using the plugin 'nvim-treesitter/nvim-treesitter', and I can enable syntax highlighting by using the command:

:TSEnable highlight

However, once I close n/vim it reverts back to disabled. I'm using a .vim file for my profile but can't seem to find out how to set it.

call plug#begin()

Plug 'fatih/vim-go'
Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'} " Code completion++
Plug 'preservim/nerdtree' " File explorer
Plug 'vim-airline/vim-airline' " Status bar feature
Plug 'vim-airline/vim-airline-themes'
Plug 'preservim/tagbar' " Tagbar for code navigation
Plug 'jiangmiao/auto-pairs'
Plug 'nvim-treesitter/nvim-treesitter'
Plug 'mhartington/oceanic-next' " Theme
Plug 'https://github.com/ryanoasis/vim-devicons' " Developer Icons

call plug#end()

set t_Co=256
set background=dark
colorscheme OceanicNext
let g:oceanic_next_terminal_bold = 1
let g:oceanic_next_terminal_italic = 1
syntax on

1 Answer 1


What I found I could do was auto-run commands, not sure if that's a bit dirty though.

Inside my init.vim

autocmd VimEnter * TSEnable highlight
  • 1
    Try it without the autocommand (that is, just TSEnable …). Depending on how your plugin manager loads plugins (or lets Vim load them), the autocommand might be required. But this is not « dirty ». It’s almost the same as :filetype on but with a user command.
    – D. Ben Knoble
    May 6 at 18:10
  • Ok cool, just wasn't sure if it was a brute force method or if there was a config item I could set elsewhere. thanks!
    – Ari
    May 6 at 23:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.