By default, supertab is inserting a regular tab when the previous character is a space.
I would like to keep this behaviour but with the following exception: if the previous character is a space but the preceding word is import, autocomplete.
For instance (| denotes the cursor position)
from numpy import |<tab>should display completions,for |<tab>should insert a tab.
I'm aware of g:SuperTabNoCompleteAfter but I'm not sure how to obtain the desired result.
supertab has the ability to consider the preceding text to choose a completion type. You need to teach the plugin about the
importcontext, and configure it to use a custom completion, e.g. user completion (<C-x><C-u>). Then implement the corresponding completion (or find another plugin that already does this), and you should be good.References
:help supertab-defaultcompletion:help supertab-completioncontexts:help complete-functions.