when I edit a slim file by line, e.g. vim app/views/sessions/new.html.slim:20 I don't get the syntax highlighting :(, other types of files work fine (e.g. ruby files).

I use slim-template/vim-slim and bogado/file-line:

set tabstop=2
set shiftwidth=2
set expandtab
set autoindent
set nobackup
set nowritebackup
set noswapfile
set nocompatible
set shell=/bin/bash
set viminfo='20,<1000
set backspace=indent,eol,start
set whichwrap+=<,>,[,]

filetype plugin indent on

syntax on

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'gmarik/vundle'
Plugin 'bogado/file-line'
Plugin 'yuezk/vim-js'
Plugin 'maxmellon/vim-jsx-pretty'
Plugin 'tpope/vim-rails'
Plugin 'vim-crystal/vim-crystal'
Plugin 'slim-template/vim-slim'

call vundle#end()

fun! TrimWhitespace()
    let l:save = winsaveview()
    keeppatterns %s/\s\+$//e
    call winrestview(l:save)

autocmd BufWritePre * :call TrimWhitespace()

" Go to the last cursor location when a file is opened, unless this is a
" git commit (in which case it's annoying)
au BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") && &filetype != "gitcommit" |
        \ execute("normal `\"") |
    \ endif
  • Start with How to debug my vimrc
    – D. Ben Knoble
    Commented Nov 17, 2021 at 20:23
  • @D.BenKnoble I found why, it's because the syntax on was before my plugins
    – Dorian
    Commented Nov 18, 2021 at 9:44

1 Answer 1


I needed to put syntax on after the imports of the plugins:

call vundle#end()

filetype plugin indent on
syntax on

Your Answer

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

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