lambdalisue / jupyter-vim-binding

Jupyter meets Vim. Vimmer will fall in love.
2.1k stars 136 forks source link

Autocomplete and '.' mess up. #3

Closed TyberiusPrime closed 9 years ago

TyberiusPrime commented 9 years ago

autocompletion (with tab) leads to duplicate content inserted by '.' afterward.

so say you type 'math.fac' and hit tab to complete to 'math.factorial', then you move down a line and hit '.', you get 'math.facmath.factorial' instead of math.factorial.

lambdalisue commented 9 years ago

I cannot reproduce the behaviour. In my case

  1. Type math.fa
  2. Select math.factorial by hitting a down arrow key
  3. Hit Enter to complete

I'm using Python 3 in Firefox 41.0 in Ubuntu 15 64bit.

and hit '.', you get 'math.facmath.factorial'

Why do you hit . instead of Enter? And hitting . lead me to math.fa. without completion menu thus this is an expected behaviour for me.

TyberiusPrime commented 9 years ago

Sorry if my text was unclear, I hit '.' after the completed auto completion to enter math.factorial again on another line. You know, '.', the magic vim 'do the same thing again' button ;).

If you type math.fac + tab, you autocomplete to the only suggestion, math.factorial, no enter necessary.

lambdalisue commented 9 years ago

Now I got it.

  1. Type math.fa
  2. Select math.factorial by hitting a down arrow key
  3. Hit Enter to complete
  4. Hit Enter to insert a new line
  5. Hit Esc to leave an insert mode
  6. Hit . to repeat the previous action

Well, probably there are no hope to fix this. The . repeat feature comes from CodeMirror's Vim mode, Tab completion comes from Jupyter's completion plugin. CodeMirror doesn't aware the completion thus it won't be repeated by CodeMirror's . repeat feature.

CodeMirror itself has it's own autocompletion thus if Jupyter would use CodeMirror's autocompletion in the feature, it would be fixed automatically I hope.