You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks a lot for this amazing plugin!
This is actually not an issue, but this might be informative for new users like me.
When I started using vim-beancount, I got the strange behavior as follows. .
I typed Exp:Med and expected it to complete as Expenses:Sub:Medium, but it cannot, and the suggestions are not filled at the correct cursor position (to override my typing).
So it returns -1 when one enters an account name at the beginning of a line, making the completion start from the current cursor location, according to :h complete-function
Negative return values:
-2 To cancel silently and stay in completion mode.
-3 To cancel silently and leave completion mode.
Another negative value: completion starts at the cursor column
This might be intended because in Beancount we never start a directive by an account name anyway. But this has confused (at least) me for a long time. I thought I messed up with other options of omni-completion, and spent a whole day dealing with this issue (I am VIM newbie).
I think it might be better to always return l:loc,
function! beancount#complete(findstart, base) abort
if a:findstart
let l:col = searchpos('\s', 'bn', line('.'))[1]
return l:col
" if l:col == 0
" return -1
" else
" return l:col
" endif
endif
This enables a user to complete account names anywhere. Or maybe return -3 to leave completion mode indicating an account name is entered at a wrong position. I believe either way is less confusing than the original?
Of course, there might be some design purpose which I don't know. In that case, please simply close this issue.
The text was updated successfully, but these errors were encountered:
Varato
changed the title
Better to complete account name anywhere (e.g. at the begining of a line)?
Better to complete account names anywhere (e.g. at the begining of a line)?
Feb 28, 2021
First of all, thanks a lot for this amazing plugin!
This is actually not an issue, but this might be informative for new users like me.
When I started using
vim-beancount
, I got the strange behavior as follows..
I typed
Exp:Med
and expected it to complete asExpenses:Sub:Medium
, but it cannot, and the suggestions are not filled at the correct cursor position (to override my typing).After some dig-in, I found the complete function:
vim-beancount/autoload/beancount.vim
Lines 70 to 78 in 6d762be
So it returns
-1
when one enters an account name at the beginning of a line, making the completion start from the current cursor location, according to:h complete-function
This might be intended because in Beancount we never start a directive by an account name anyway. But this has confused (at least) me for a long time. I thought I messed up with other options of omni-completion, and spent a whole day dealing with this issue (I am VIM newbie).
I think it might be better to always return
l:loc
,This enables a user to complete account names anywhere. Or maybe return
-3
to leave completion mode indicating an account name is entered at a wrong position. I believe either way is less confusing than the original?Of course, there might be some design purpose which I don't know. In that case, please simply close this issue.
The text was updated successfully, but these errors were encountered: