I'm having some weird vim cursor behavior which I'm unable to solve. While I was editing a file, suddenly the cursor marker moved one or more spaces to the right while the cursor actions still effected the current column the marker was before.

I added a screenshot for clarification:

enter image description here

As you can see, the cursor is on the last curly bracket, but the cursor marker is placed some spaces later. If I would press the delete key, it would erase the curly bracket.

Can someone help me with this (annoying) problem? Any help would be greatly appreciated.


I'm currently using Vim v7-4-801 which was released July 28 this year.

  • Does the effect occur when you jump to the beginning of the line? If not: If you start at the beginning of the line and move letter by letter towards the right, is there a consistent position where the effect appears for the first time? Is there a change if you turn breakindent off? – klimpergeist Aug 8 '15 at 11:23

I had this problem a long time ago with broken characters, which were not displayed correctly. I think I had edited a file under both Unix and Windows and afterwards characters with different encodings showed up in the file.

Things you could try:

  • If your document is supposed to only contain ASCII characters, you could remove every other character (and everything not printable, except tab and space) with the following vim command:

    :%s/[^\t -~]//gc

  • If you want to be more careful, :set list and play with :set listchars=... to make the characters visible.

  • External fix (not optimal but what I used at the time): Open the file in a different editor (I used emacs) and hope that the bad boys are displayed there, so you can remove them.

  • I tried the first and the third method to no avail. I enable :set list by default in my .vimrc file with displayed listchars tab, space and eol but I don't see anything weird. – Tom Gijselinck Aug 7 '15 at 7:42
  • If the first method did not work, then it does not seem to be an encoding issue. I don't currently have any good idea what else it might be. Have you tried deactivating your vim plugins or using plain vi instead of vim? – klimpergeist Aug 7 '15 at 20:38
  • I've tried deactivating all plugins but that didnt change anything. And I only have vim installed on my ubuntu machine. I've tried nano but there the problem doesn't appear. The weird thing is, I've so far only encounterd this problem in this particular case, posted here. – Tom Gijselinck Aug 11 '15 at 13:14

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.