'No auto-complete on HTML and CSS files in VIM (YouCompleteMe)

For some reason, I get no autocomplete on html and css files. All works well with other languages, for example JS, Ruby or Python. I've spent close to 2h today trying to fix it but to no avail. I use Vundle and YouCompleteMe to do all of this. You can have a look at my .vimrc file here https://gist.github.com/comatory/73aacac1b0249b8c1c55.

I'm on OS X 10.10.5 and my Vim version is 7.4 (installed via Homebrew). I also use Macvim but it doesn't matter, it doesn't work in either of them.



Solution 1:[1]

Check the value of the paste setting

:verbose set paste? 

will show you the current value for this buffer as well as which plugin set it last.

In my experience, completion doesn't happen if paste is set. Disable with

:set nopaste

Solution 2:[2]

Maybe it is in your filepath blacklist as in default.

Quote from: https://github.com/ycm-core/YouCompleteMe/

The g:ycm_filepath_blacklist option

This option controls for which Vim filetypes (see :h filetype) should filepath completion be disabled. The option value should be a Vim dictionary with keys being filetype strings (like python, cpp, etc.) and values being unimportant (the dictionary is used like a hash set, meaning that only the keys matter).

let g:ycm_filepath_blacklist = {'*': 1}

The * key is special and matches all filetypes. Use this key if you want to completely disable filepath completion:

You can get the filetype of the current file in Vim with :set ft?.

Default: [see next line]

let g:ycm_filepath_blacklist = {
      \ 'html': 1,
      \ 'jsx': 1,
      \ 'xml': 1,
      \}

Solution 3:[3]

I would suggest you use NeoComplete. I tried YouCompleteMe on Vim8, but doesn't work for some reason. NeoComplete does the job for me.

After installing NeoComplete just add, let g:neocomplete#enable_at_startup = 1 to your .vimrrc

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 José Gois
Solution 3 TheEarlyMan