mattn / emmet-vim

emmet for vim: http://emmet.io/
http://mattn.github.io/emmet-vim
MIT License
6.42k stars 411 forks source link

Why html:5 can't expand with `sudo vim /var/www/html/test.ph'? #386

Closed hwypengsir closed 7 years ago

hwypengsir commented 7 years ago

Here is my vim configuration.

cat .vimrc
filetype plugin indent on
let g:user_emmet_install_global = 0
autocmd FileType html,css,php EmmetInstall

html:5 can be expanded into whole proper format when to edit with vim test.php, Why html:5 can not be expanded into whole proper format when to edit with sudo vim /var/www/html/test.ph?

mattn commented 7 years ago

What OS did you use?

sudo command impersonate user. On some OS or distribution, sudo command does not pass some environment variables.

hwypengsir commented 7 years ago

debian8

mattn commented 7 years ago

Then please try

$ sudo vim

and :scriptnames

Maybe some plugins should not be loaded.

hwypengsir commented 7 years ago

sudo vim :scriptnames 1: /usr/share/vim/vimrc 2: /usr/share/vim/vim74/debian.vim 3: /usr/share/vim/vim74/plugin/getscriptPlugin.vim 4: /usr/share/vim/vim74/plugin/gzip.vim 5: /usr/share/vim/vim74/plugin/matchparen.vim 6: /usr/share/vim/vim74/plugin/netrwPlugin.vim 7: /usr/share/vim/vim74/plugin/rrhelper.vim 8: /usr/share/vim/vim74/plugin/spellfile.vim 9: /usr/share/vim/vim74/plugin/tarPlugin.vim 10: /usr/share/vim/vim74/plugin/tohtml.vim 11: /usr/share/vim/vim74/plugin/vimballPlugin.vim 12: /usr/share/vim/vim74/plugin/zipPlugin.vim

vim :scriptnames ~
1: /usr/share/vim/vimrc 2: /usr/share/vim/vim74/debian.vim 3: ~/.vimrc 4: /usr/share/vim/vim74/filetype.vim 5: /usr/share/vim/vim74/ftplugin.vim 6: /usr/share/vim/vim74/indent.vim 7: ~/.vim/plugin/emmet.vim 8: /usr/share/vim/vim74/plugin/getscriptPlugin.vim 9: /usr/share/vim/vim74/plugin/gzip.vim 10: /usr/share/vim/vim74/plugin/matchparen.vim 11: /usr/share/vim/vim74/plugin/netrwPlugin.vim 12: /usr/share/vim/vim74/plugin/rrhelper.vim 13: /usr/share/vim/vim74/plugin/spellfile.vim 14: /usr/share/vim/vim74/plugin/tarPlugin.vim 15: /usr/share/vim/vim74/plugin/tohtml.vim 16: /usr/share/vim/vim74/plugin/vimballPlugin.vim 17: /usr/share/vim/vim74/plugin/zipPlugin.vim

How to fix now?

mattn commented 7 years ago

there are several way to do it. so please read man sudo.