3

The problem is that when I am at the end of the line, and the NeoComplCache prompt up some words. I want to open a new line below by pressing the return key, but I need to press the return key 2 times.

The first time of pressing the return key dismisses the prompt up, and the second time does the supposed job, opening a new line below.

End of the line with prompt up End of the line with prompt up

Press the return key 1 time 1 time

Press the return key 2 times 2 times

I think one of the solution is to disable the auto prompt up. But are there any solutions to solve this annoying problem?

code4j
  • 4,208
  • 5
  • 34
  • 51
  • Have no idea how to answer the question, but I would like to know the settings you use for the statusline... Can you give some info about it please? – skeept Aug 06 '13 at 19:44
  • @skeept it's a awesome plugin called powerline. And you should do the setting `laststatus=2` if you want to always show the status line. By default, vim does not show the status line when there is only 1 window. – code4j Aug 06 '13 at 20:27

1 Answers1

2

Putting this in your .vimrc will cause one enter keystroke to close the popup and enter a newline:

" <CR>: close popup and open a new line.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
  return neocomplcache#smart_close_popup() . "\<CR>"
endfunction

Or try one of the other snippets in this issue: https://github.com/Shougo/neocomplcache.vim/issues/88

jaustin
  • 925
  • 1
  • 7
  • 9