tpope/vim-projectionist

Undo tab completion

Closed this issue · 1 comments

When using projection navigation commands (:Efoo, :Ebar, :Sfoo, etc.) tab complete is a great way to show suggestion for the text you typed so far but often none of the suggestions in the list matches what I need. Normally command line tab completion can be reverted with CTRL-P while being on the first match or with CTRL-N while being on the last. This is not the case for the file tab completion the plugin provides which forces me to close the suggestions list with CTRL-E and cleanup manually the insertion that was made due to the selected item. Is there a better way to do that and am I missing something?

tpope commented

This completion function is working for me like you expect:

function! TestComplete(A, L, P) abort
  return ['a1', 'a2']
endfunction

command! -nargs=* -complete=customlist,TestComplete TestComplete echo <q-args>
TestComplete a<Tab>

This one isn't:

function! TestComplete(A, L, P) abort
  call glob('a*')
  return ['a1', 'a2']
endfunction

command! -nargs=* -complete=customlist,TestComplete TestComplete echo <q-args>
TestComplete a<Tab>

That is, invoking the glob() function anywhere inside completion function removes the ability to CTRL-P away the completion result, even if we completely ignore the return value.

Calling this a Vim bug. I leave it to you to follow up upstream.