I have this global at the top of my .vimrc
:
let DevEnv = { 'enabled' : 0, 'open_dirs' : 0, 'term_bufnr' : 0 }
One of my .vimrc
functions calls:
exec 'bd! ' . g:DevEnv.term_bufnr
Note that g:DevEnv.term_bufnr
has been updated to a non-zero value at one point by another function so that it contains a valid buffer number.
This line works as intended and closes the buffer which is saved at g:DevEnv.term_bufnr
, BUT, when I run :echo errmsg
, I get the aforementioned error. Commenting out this line fixes it. Why am I getting this error if everything works as intended? Have I misused something?
Also, this only seems to show that message if I run bd!
. Using echo
does not display it.
I tried passing g:DevEnv.term_bufnr
through a proxy by doing:
let asd = g:DevEnv.term_bufnr
exec 'bd! ' . asd
Which, also gave the error after the second line was executed. I can only guess it has something to do with the internal workings of bdelete
.
DevEnv
as a global, could that be the problem? – Biggybi Jan 23 at 19:35.vimrc
, is that not the same? – daedsidog Jan 23 at 19:59g:DevEnv['term_bufnr']
or'bd! ' .. g:DevEnv.term_bufnr
with:scriptversion 2
if your Vim is new enough. I think you may be running in to the ".
is ambiguous problem". See:help scriptversion-2
. – Martin Tournoij Jan 23 at 20:54