-
Couldn't load subscription status.
- Fork 165
Description
sample error text (slightly edited for readability):
Error detected while processing modelines[2075]
..OptionSet Autocommands for "tabstop"
..function indent_guides#process_autocmds[2]
..indent_guides#enable[8]
..indent_guides#init_script_vars[7]
..indent_guides#capture_highlight:
line 1:
E12: Command not allowed from exrc/vimrc in current dir or tag search
E12: Command not allowed from exrc/vimrc in current dir or tag search
E12: Command not allowed from exrc/vimrc in current dir or tag search
steps to reproduce (approx).:
- start nvim with this plugin and modeline enabled
- open a file containing modeline (by
:ecommand)
looks like when this plugin is triggered from OptionSet event via modeline, it is run inside sandbox where indent_guides#capture_highlight() function errors out because execute() function is not allowed inside sandbox.
vim-indent-guides/autoload/indent_guides.vim
Lines 255 to 259 in 9a106c7
| function! indent_guides#capture_highlight(group_name) abort | |
| let l:output = execute('hi ' . a:group_name, 'silent') | |
| let l:output = substitute(l:output, '\n', '', '') | |
| return l:output | |
| endfunction |
one possible solution is to use some function like synIDattr() and related functions (synIDtrans(), hlID()) to directly query any needed highlight color values instead of execute()ing and parsing :highlight output.
those functions exists in regular vim for quite some time and appears to be sandbox safe, so it should be safe to use.