Shougo / neocomplete.vim

Next generation completion framework after neocomplcache
2.74k stars 203 forks source link

<c-x><c-u> throws error first and then deletes preceding text if autcomplete off #305

Closed Konfekt closed 9 years ago

Konfekt commented 9 years ago

My .vimrc reads

  let g:neocomplete#disable_auto_complete = 1
  let g:neocomplete#enable_at_startup = 1

Then, for example in a TeX file, hitting <c-x><c-u> on a word with no completion suggestions, Vim throws an error E121: variable words not defined.

If however suggestions existed, then NeoComplete works fine and shows the popup menu. However, afterwards, the second time, it deletes everything up to the last position where <c-x><c-u> was hit and completes by the same word. This stops as soon as insert mode is quit and reentered.

Shougo commented 9 years ago

Please read issue template.

https://github.com/Shougo/neocomplete.vim/issues/236

I cannot understand and reproduce your problem.

Konfekt commented 9 years ago

Ok. Put shortly, if necomplete is enabled, but autocompletion disabled, then user completion by <c-x><c-u> does not work if invoked twice while staying in insert mode. A step by step description follows later.

Shougo commented 9 years ago

I cannot understand it again. You should upload sample Tex file and more detailed description(if possible screenshot).

Konfekt commented 9 years ago

.vimrc:

filetype plugin indent on
syntax enable

set runtimepath+=~/.vim/bundle/neocomplete.vim/

let g:neocomplete#disable_auto_complete = 1
let g:neocomplete#enable_at_startup = 1

Start VIM. Then itest<cr>te gives

test
te*

with * indicating the cursor position. Hit <c-x><c-u> to obtain

test
test*

Type <space>te<c-x><c-u>. Expected:

test
test test*

Obtained:

test
test*
Shougo commented 9 years ago

OK. I get it. It is feature. You must use neocomplete#start_manual_complete() instead of <c-x><c-u>.

inoremap <expr><Tab>  neocomplete#start_manual_complete()
Konfekt commented 9 years ago

Ok. Thank you. Better be documented. I used

  " <TAB> completion
  inoremap <expr> <TAB>  pumvisible() ? "\<C-n>" :
                      \ <SID>check_back_space() ? "\<TAB>" : "\<C-X>\<C-U>"
  function! s:check_back_space()
    let col = col('.') - 1
    return !col || getline('.')[col - 1]  =~ '\s'
  endfunction

and thought it to be smart as it accounts for any kind of user completion.

Shougo commented 9 years ago

It is already documented in examples.

    " For smart TAB completion.
    "inoremap <expr><TAB>  pumvisible() ? "\<C-n>" :
    "        \ <SID>check_back_space() ? "\<TAB>" :
    "        \ neocomplete#start_manual_complete()
    "  function! s:check_back_space() "{{{
    "    let col = col('.') - 1
    "    return !col || getline('.')[col - 1]  =~ '\s'
    "  endfunction"}}}

and thought it to be smart as it accounts for any kind of user completion.

It is impossible because implementation problem.

Konfekt commented 9 years ago

Ok. Perhaps add a comment about the necessity of start_manual_complete instead of user completion.