Oni: Pressing tab does not complete autocompletion but inserts a tab instead

Created on 28 Mar 2018  路  3Comments  路  Source: onivim/oni

According to https://github.com/onivim/oni/wiki/Shortcuts#auto-completion, pressing should select the autocompletion option, but it inserts a tab instead.

I'm currently using the following override in my init.vim:

inoremap <silent> <tab> <C-o>:call OniCommand('contextMenu.select')<CR>

However, this prevents me from using tab to insert an indent when there is no completion menu.

The default behavior should be fixed so that it aligns with what the wiki says and allows to use tab as both indent and completion depending on whether there's a completion menu visible. In fact, it would be better if during completion, it cycled through the options.

Most helpful comment

@dlee in order to complete with tab I have the following mapping in my config.tsx

oni.input.bind(["<enter>", "<tab>"], "contextMenu.select");

This works to allow both using tab to indent and to complete.
Re. tab to cycle though I agree, not sure what other people's feelings on this are but we can use this issue to track perhaps switching the default behaviour as I think @bryphe was looking to replicate vscodes behaviour but I personally much prefer vim's behaviour

All 3 comments

@dlee in order to complete with tab I have the following mapping in my config.tsx

oni.input.bind(["<enter>", "<tab>"], "contextMenu.select");

This works to allow both using tab to indent and to complete.
Re. tab to cycle though I agree, not sure what other people's feelings on this are but we can use this issue to track perhaps switching the default behaviour as I think @bryphe was looking to replicate vscodes behaviour but I personally much prefer vim's behaviour

As @Akin909 pointed out, most vim users will prefer to add tabs in the middle of an edit instead of opening the autocomplete menu. Since this is an easy enough snippet to put in your configuration I am closing this one.

For further reference a wiki page or configuration option can be provided if this seems like a big enough issue.

A year into the future, and this issue was driving me crazy.

As per @badosu solution, after referring to the Oni API, I added the following line into my Oni config.tsx:

oni.input.bind("<tab>", () => oni.snippets.insertSnippet(" "))

which worked but it didn't allow for successive insertions of TABs quickly. Unfortunately the sequence of keys to insert multiple TABs would be: (, , a) then again (, , a).

I accidentally found another solution that worked for my needs. Hitting ++ inserts a tab regardless of whether the autocomplete menu appears or not. I'm leaving this solution here in case someone else like me needs it...

Oh also, another alternative solution would have been to add a 200ms delay on the autocomplete dropdown menu, allowing for successive tabs to be inserted using the key but that didn't seem to be easily doable.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bfulop picture bfulop  路  3Comments

badosu picture badosu  路  3Comments

Siilwyn picture Siilwyn  路  3Comments

magopian picture magopian  路  3Comments

IvRRimum picture IvRRimum  路  3Comments