groenewege/vim-less

Highlighting doesn't work automatically with VIM74+vundle

notrev opened this issue · 9 comments

Hi,
I just installed vim-less via vundle, but the syntax highlighting doesn't work automatically.

I've read the issue #6 and tried to do the same thing, but still doesn't work.

When I set the filetype manually it works.

After opening a .less file, the output for :scriptnames is:

  1: /usr/share/vim/vimrc
  2: /usr/share/vim/vim74/debian.vim
  3: /usr/share/vim/vim74/syntax/syntax.vim
  4: /usr/share/vim/vim74/syntax/synload.vim
  5: /usr/share/vim/vim74/syntax/syncolor.vim
  6: /usr/share/vim/vim74/filetype.vim
  7: ~/.vimrc
  8: ~/.vim/myconfs.vim
  9: /usr/share/vim/vim74/syntax/nosyntax.vim
 10: ~/.vim/vundle.vim
 11: ~/.vim/bundle/vundle/autoload/vundle.vim
 12: ~/.vim/bundle/vundle/autoload/vundle/config.vim
 13: ~/.vim/bundle/YouCompleteMe/plugin/youcompleteme.vim
 14: ~/.vim/bundle/emmet-vim/plugin/emmet.vim
 15: ~/.vim/bundle/syntastic/plugin/syntastic/autoloclist.vim
 16: ~/.vim/bundle/syntastic/plugin/syntastic/balloons.vim
 17: ~/.vim/bundle/syntastic/plugin/syntastic/checker.vim
 18: ~/.vim/bundle/syntastic/plugin/syntastic/cursor.vim
 19: ~/.vim/bundle/syntastic/plugin/syntastic/highlighting.vim
 20: ~/.vim/bundle/syntastic/plugin/syntastic/loclist.vim
 21: ~/.vim/bundle/syntastic/plugin/syntastic/modemap.vim
 22: ~/.vim/bundle/syntastic/plugin/syntastic/notifiers.vim
 23: ~/.vim/bundle/syntastic/plugin/syntastic/registry.vim
 24: ~/.vim/bundle/syntastic/plugin/syntastic/signs.vim
 25: ~/.vim/bundle/syntastic/plugin/syntastic.vim
 26: ~/.vim/bundle/syntastic/autoload/syntastic/log.vim
 27: ~/.vim/bundle/syntastic/autoload/syntastic/util.vim
 28: /usr/share/vim/vim74/plugin/getscriptPlugin.vim
 29: /usr/share/vim/vim74/plugin/gzip.vim
 30: /usr/share/vim/vim74/plugin/matchparen.vim
 31: /usr/share/vim/vim74/plugin/netrwPlugin.vim
 32: /usr/share/vim/vim74/plugin/rrhelper.vim
 33: /usr/share/vim/vim74/plugin/spellfile.vim
 34: /usr/share/vim/vim74/plugin/tarPlugin.vim
 35: /usr/share/vim/vim74/plugin/tohtml.vim
 36: /usr/share/vim/vim74/plugin/vimballPlugin.vim
 37: /usr/share/vim/vim74/plugin/zipPlugin.vim
 38: ~/.vim/bundle/powerline/powerline/bindings/vim/plugin/powerline.vim
 39: /usr/share/vim/vim74/scripts.vim
 40: ~/.vim/bundle/YouCompleteMe/autoload/youcompleteme.vim

After setting ft=less, the output for :scriptnames is:

  1: /usr/share/vim/vimrc
  2: /usr/share/vim/vim74/debian.vim
  3: /usr/share/vim/vim74/syntax/syntax.vim
  4: /usr/share/vim/vim74/syntax/synload.vim
  5: /usr/share/vim/vim74/syntax/syncolor.vim
  6: /usr/share/vim/vim74/filetype.vim
  7: ~/.vimrc
  8: ~/.vim/myconfs.vim
  9: /usr/share/vim/vim74/syntax/nosyntax.vim
 10: ~/.vim/vundle.vim
 11: ~/.vim/bundle/vundle/autoload/vundle.vim
 12: ~/.vim/bundle/vundle/autoload/vundle/config.vim
 13: ~/.vim/bundle/YouCompleteMe/plugin/youcompleteme.vim
 14: ~/.vim/bundle/emmet-vim/plugin/emmet.vim
 15: ~/.vim/bundle/syntastic/plugin/syntastic/autoloclist.vim
 16: ~/.vim/bundle/syntastic/plugin/syntastic/balloons.vim
 17: ~/.vim/bundle/syntastic/plugin/syntastic/checker.vim
 18: ~/.vim/bundle/syntastic/plugin/syntastic/cursor.vim
 19: ~/.vim/bundle/syntastic/plugin/syntastic/highlighting.vim
 20: ~/.vim/bundle/syntastic/plugin/syntastic/loclist.vim
 21: ~/.vim/bundle/syntastic/plugin/syntastic/modemap.vim
 22: ~/.vim/bundle/syntastic/plugin/syntastic/notifiers.vim
 23: ~/.vim/bundle/syntastic/plugin/syntastic/registry.vim
 24: ~/.vim/bundle/syntastic/plugin/syntastic/signs.vim
 25: ~/.vim/bundle/syntastic/plugin/syntastic.vim
 26: ~/.vim/bundle/syntastic/autoload/syntastic/log.vim
 27: ~/.vim/bundle/syntastic/autoload/syntastic/util.vim
 28: /usr/share/vim/vim74/plugin/getscriptPlugin.vim
 29: /usr/share/vim/vim74/plugin/gzip.vim
 30: /usr/share/vim/vim74/plugin/matchparen.vim
 31: /usr/share/vim/vim74/plugin/netrwPlugin.vim
 32: /usr/share/vim/vim74/plugin/rrhelper.vim
 33: /usr/share/vim/vim74/plugin/spellfile.vim
 34: /usr/share/vim/vim74/plugin/tarPlugin.vim
 35: /usr/share/vim/vim74/plugin/tohtml.vim
 36: /usr/share/vim/vim74/plugin/vimballPlugin.vim
 37: /usr/share/vim/vim74/plugin/zipPlugin.vim
 38: ~/.vim/bundle/powerline/powerline/bindings/vim/plugin/powerline.vim
 39: /usr/share/vim/vim74/scripts.vim
 40: ~/.vim/bundle/YouCompleteMe/autoload/youcompleteme.vim
 41: /usr/share/vim/vim74/syntax/vim.vim
 42: /usr/share/vim/vim74/syntax/python.vim
 43: ~/.vim/bundle/vim-less/syntax/less.vim
 44: /usr/share/vim/vim74/syntax/css.vim

Looking at it I noticed the only vim-less file loaded is vim-less/syntax/less.vim, and only after the filetype is set manually.

What version of Vundle are you using?
What comand are you doing to include this repo?
What's your runtimepath before loading a less file? :echo substitute(&rtp, ",", "\n", "g")

Vundle version: 0.10.2

To include this repo, I followed the instructions in the README, added "Bundle 'groenewege/vim-less'" to my vimrc and :BundleInstall to install it.

The result of the command :echo substitute(&rtp, ",", "\n", "g") is:

/home/everton/.vim
/home/everton/.vim/bundle/vundle
/home/everton/.vim/bundle/powerline
/home/everton/.vim/bundle/YouCompleteMe
/home/everton/.vim/bundle/emmet-vim
/home/everton/.vim/bundle/syntastic
/home/everton/.vim/bundle/html5.vim
/home/everton/.vim/bundle/vim-less
/var/lib/vim/addons
/usr/share/vim/vimfiles
/usr/share/vim/vim74
/usr/share/vim/vimfiles/after
/var/lib/vim/addons/after
/home/everton/.vim/after
/home/everton/.vim/bundle/vundle/
/home/everton/.vim/bundle/powerline/powerline/bindings/vim
/home/everton/.vim/bundle/vundle/after
/home/everton/.vim/bundle/powerline/after
/home/everton/.vim/bundle/YouCompleteMe/after
/home/everton/.vim/bundle/emmet-vim/after
/home/everton/.vim/bundle/syntastic/after
/home/everton/.vim/bundle/html5.vim/after
/home/everton/.vim/bundle/vim-less/after

In your vimrc, do you have filetype off before loading vundle,
and filetype on after configuring vundle and all of your plugins?

This repo has an ftdetect file in it, but if you turn on filetype detection too early (before the runtimepath is modified) it may not be seen.

@rwstauner, I followed your advice and it is working now, thank you.
Added filetype off before loading vundle plugins and filetype on after.

@rwstauner thank you for your help on the vim-less repository.

happy to help

@rwstauner I don't know if I should open another issue, or continue on this one, but I'm having the same problem which isn't fixed by setting filetype on at the end.

Current .vimrc: https://github.com/mike-engel/vimfiles/blob/c1efaf1f839023055919bcd9c00d73f65be80bc3/vimrc

Any help/suggestions would be appreciated.

@mike-engel the :au! at line 323 is killing any autocommands that aren't inside of a group, which probably isn't what you want. Assuming you just want to make sure your autocommands are only defined once, you should wrap them in an :augroup

@rwstauner That did the trick. Thanks much!