I have set autoindent and set tw=90 and set fo=t. Additionally I have working autocompletion that means when I type one character a popup menu come in. Because of popup menu in some situations, where all these 3 things happen to work together, it gives some very unpleasant random effect.


I have a line like this that is less than tw

<some indentation>sdjfl ... sdkf Some

Then I add some text and have a cursor in the specified position in insert mode

<some indentation>sdjfl ... sdkfslfj <cursor> Some

Then I type a character like here

<some indentation>sdjfl ... sdkfslfj I Some

And vim wraps should wrap and indent me text like this

<some indentation>sdjfl ... sdkfslfj 
<some indentation>I<cursor> Some

Unfortunately, I have this result

<some indentation>sdjfl ... sdkfslfj 
<some indentation>I<cursor>Some

Or very often and more unfortunately I have this result

<some indentation>sdjfl ... sdkfslfj 
<some indentation>SI<cursor>ome

I figured out that when I turn off autocompletion, than I have many correct result, and sometime this results where it cuts the space before cursor.

Help me to solve this, please?

The options and version of my vim

--- Options ---
  autoindent          guioptions=agit     laststatus=0        showbreak=↪       textwidth=90
  background=dark     helplang=en         linebreak           showcmd             timeoutlen=700
  backup              hidden            nomore              noshowmode            ttimeoutlen=900
  comments=b:#,fb:-   history=1000        mouse=a             smartcase           ttyfast
  confirm             hlsearch            number              smartindent         updatetime=800
  copyindent          ignorecase          previewheight=30    softtabstop=2       wildignore=*.pyc
  cursorcolumn        iminsert=0          ruler               splitbelow          wildmenu
  cursorline          incsearch           scroll=26           splitright          window=55
  expandtab         nojoinspaces          scrolloff=3         suffixesadd=.py
  filetype=python     keywordprg=pydoc    shiftwidth=2        syntax=python
  commentstring=# %s
  grepprg=grep -nH --color
  guifont=Powerline Consolas 13
  makeprg=make -f ~/Documents/Tests/Makefile

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec  9 2014 17:36:41)
Included patches: 1-488
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by buildd@
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
+acl             +dialog_con_gui  +insert_expand   +mouse_sgr       +ruby            +vertsplit
+arabic          +diff            +jumplist        -mouse_sysmouse  +scrollbind      +virtualedit
+autocmd         +digraphs        +keymap          +mouse_urxvt     +signs           +visual
+balloon_eval    +dnd             +langmap         +mouse_xterm     +smartindent     +visualextra
+browse          -ebcdic          +libcall         +multi_byte      -sniff           +viminfo
++builtin_terms  +emacs_tags      +linebreak       +multi_lang      +startuptime     +vreplace
+byte_offset     +eval            +lispindent      -mzscheme        +statusline      +wildignore
+cindent         +ex_extra        +listcmds        +netbeans_intg   -sun_workshop    +wildmenu
+clientserver    +extra_search    +localmap        +path_extra      +syntax          +windows
+clipboard       +farsi           +lua             +perl            +tag_binary      +writebackup
+cmdline_compl   +file_in_path    +menu            +persistent_undo +tag_old_static  +X11
+cmdline_hist    +find_in_path    +mksession       +postscript      -tag_any_white   -xfontset
+cmdline_info    +float           +modify_fname    +printer         +tcl             +xim
+comments        +folding         +mouse           +profile         +terminfo        +xsmp_interact
+conceal         -footer          +mouseshape      +python          +termresponse    +xterm_clipboard
+cryptv          +fork()          +mouse_dec       -python3         +textobjects     -xterm_save
+cscope          +gettext         +mouse_gpm       +quickfix        +title           +xpm
+cursorbind      -hangul_input    -mouse_jsbterm   +reltime         +toolbar         
+cursorshape     +iconv           +mouse_netterm   +rightleft       +user_commands   
  • " Additionally I have working autocompletion" - as far as I remember Vim doesn't have native autocompletion; it does has generic completion, but is is triggered by some shortcuts (:help compl-generic). Are you using some plugin for autocompletion?
    – mMontu
    Nov 6, 2015 at 13:32
  • Yes, I use Ycm.
    – Yuki
    Nov 6, 2015 at 13:34

1 Answer 1


As the problem just happens when you are using the Ycm plugin, it is certainly something related to that plugin. You should check plugin documentation. In special, the FAQ section reports that some plugins that may cause interference:

    9. FAQ |youcompleteme-faq|
   1. I used to be able to 'import vim' in '.ycm_extra_conf.py', but now can't |import-vim|
   18. YCM conflicts with UltiSnips TAB key usage |youcompleteme-ycm-conflicts-with-ultisnips-tab-key-usage|
   19. Why isn't YCM just written in plain VimScript, FFS? |youcompleteme-why-isnt-ycm-just-written-in-plain-vimscript-ffs|
   20. Why does YCM demand such a recent version of Vim? |youcompleteme-why-does-ycm-demand-such-recent-version-of-vim|
   21. I get annoying messages in Vim's status area when I type |youcompleteme-i-get-annoying-messages-in-vims-status-area-when-i-type|
   22. Nasty bugs happen if I have the 'vim-autoclose' plugin installed |vim-sub-autoclose|

You could also search the current and closed issues on the bug tracker. If any of these solves your problem, you should open a new issue there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.