vim-force.com
vim-force.com copied to clipboard
Unknown function HTMLIndent
I get this error when I try to edit a visualforce page
Error detected while processing /Users/ahegde/.yadr/vim/bundle/vim-force.com/indent/visualforce.vim:
E700: Unknown function: HtmlIndent
I have overridden my system vim with homebrew vim
This is the output of vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Feb 14 2018 08:39:53) macOS version Included patches: 1-1500 Compiled by Homebrew Huge version without GUI. Features included (+) or not (-): +acl +farsi +mouse_sgr -tag_any_white +arabic +file_in_path -mouse_sysmouse -tcl +autocmd +find_in_path +mouse_urxvt +termguicolors -autoservername +float +mouse_xterm +terminal -balloon_eval +folding +multi_byte +terminfo +balloon_eval_term -footer +multi_lang +termresponse -browse +fork() -mzscheme +textobjects ++builtin_terms -gettext +netbeans_intg +timers +byte_offset -hangul_input +num64 +title +channel +iconv +packages -toolbar +cindent +insert_expand +path_extra +user_commands -clientserver +job +perl +vertsplit +clipboard +jumplist +persistent_undo +virtualedit +cmdline_compl +keymap +postscript +visual +cmdline_hist +lambda +printer +visualextra +cmdline_info +langmap +profile +viminfo +comments +libcall +python +vreplace +conceal +linebreak -python3 +wildignore +cryptv +lispindent +quickfix +wildmenu +cscope +listcmds +reltime +windows +cursorbind +localmap +rightleft +writebackup +cursorshape +lua +ruby -X11 +dialog_con +menu +scrollbind -xfontset +diff +mksession +signs -xim +digraphs +modify_fname +smartindent -xpm -dnd +mouse +startuptime -xsmp -ebcdic -mouseshape +statusline -xterm_clipboard +emacs_tags +mouse_dec -sun_workshop -xterm_save +eval -mouse_gpm +syntax +ex_extra -mouse_jsbterm +tag_binary +extra_search +mouse_netterm +tag_old_static system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/usr/local/share/vim" Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: clang -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o vim -lncurses -liconv -framework AppKit -L/usr/local/lib -llua -mmacosx-version-min=10.12 -fstack-protector-strong -L/usr/local/lib -L/usr/local/Cellar/perl/5.26.1/lib/perl5/5.26.1/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -F/usr/local/opt/python/Frameworks -framework Python -lruby.2.5.0 -lobjc
I have edited my ~/.zshrc to set the vim runtime to the homebrew version -
`$ echo $VIMRUNTIME
/usr/local/Cellar/vim/8.0.1500/share/vim/vim80/`
Hello @anandghegde
Looks like something is not quite right with your vim installation or maybe zsh
somehow uses runtime from built-in OSX vim.
HtmlIndent is a function in runtime/indent/html.vim file. This file is a part of standard vim distribution. So when vim is installed correctly calls to HtmlIndent should work out of the box.
Anyway to set the runtime in one of the ~/.zshrc file? My homebrew vim is installed at /usr/local/Cellar/vim/8.0.1500/share/vim/vim80/
Not a zsh
user here, so I am not sure. You may have to "google" for a bit.
brew install vim -with-override-system-vim
or
echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bash_profile && source ~/.bash_profile
usually do the trick for me when using bash
.
yes, I reinstalled vim with the --with-override-system-vi flag. Still getting the same error. My /usr/local/bin is ahead in the $PATH, so it is using the latest vim from the homebrew installation.
I want to understand this line -
runtime indent/html.vim
Which env. variable is it looking for? Is it $VIMRUNTIME? Do I need to set this in .zshrc or in vundle?
see answers here: https://github.com/vim/vim/blob/master/runtime/doc/repeat.txt#L193 and here: https://github.com/vim/vim/blob/master/runtime/doc/options.txt#L6356
indent/html.vim
by default resides in $VIMRUNTIME/indent/html.vim
check what your :echo $VIMRUNTIME
returns when you run it from vim
.
:echo $VIMRUNTIME
from inside vim gives me /usr/local/share/vim/vim80
and I see an indent/html.vim file in there.
usually :echo $VIMRUNTIME
ends with something like ...some path/runtime
. Yours does not end with .../runtime
for some reason.
for instance, here is the output of my config (I use MacVim not console vim)
/usr/local/Cellar/macvim/8.0-142/MacVim.app/Contents/Resources/vim/runtime
what happens if you run (inside vim)
:source $VIMRUNTIME/indent/html.vim
does it return any error?
If it does not then does this (inside vim) work?
:call HtmlIndent()
:source $VIMRUNTIME/indent/html.vim
doesnt return any error
:call HtmlIndent()
returns unknown function.
if you do :edit $VIMRUNTIME/indent/html.vim
in vim
what does the file header look like?
does it say
Last Change: 2017 Jun 13
the file must look exactly the same as this one.
Yes, it looks exactly like that.
in this case the issue may be either
A. you do not have filetype indent on
in your .vimrc
what does :filetype
return? it should return something like
filetype detection:ON plugin:ON indent:ON
OR
B. your vim config and/or other plugins you use somehow disable standard indent/html.vim
.
html.vim
makes various checks at the beginning of the file and depending on the current config may or may not proceed with full initialisation.
Thanks a lot for the help in debugging this. It turned out to be because of the vim-polyglot plugin that comes bundled with YADR . I removed that plugin and it seems to be working fine.