15

Firstly, I typed some thing on insert mode, like

Hello

At this stage, if I didn't exit from insert mode, delete works and can delete the whole word if I want.

If I quit insert mode, and open insert mode again, this Hello can't be removed by delete. But the newly typed in content can be removed.

I've renamed my .vimrc, problem still exits.

And I did some test on remote server through iterm, didn't encounter the same issue.

What could be the cause of this problem? How to fix it?

  • With 'delete' you mean backspace? Removing whole words in insert mode can be done with Ctrl-W, try that. If that does nothing, there's something wrong with your vim. I use iTerm 2 and have never had such problems. – oarfish Feb 17 '15 at 14:18
  • Yes, I can use dw or dw+shift in normal mode to delete words. But backspace and ctrl + w both don't work in the second situation I mentioned above. – Zen Feb 17 '15 at 15:07
  • But you can use backspace on the normal command line outside vim? Very weird. – oarfish Feb 17 '15 at 21:00
  • @oarfish, yes, I can, and in remote server vim I don't have such problem, all just happens in a sudden. I can't get the clue for now. – Zen Feb 19 '15 at 2:28
  • What vim version do you have? I have vim 7.4.481, and I can't reproduce the problem. – jan.h Feb 24 '15 at 0:29
16
+50

This is a feature of vim, although IIRC it wouldn't be enabled by default.

backspace is a setting in vim, and you can set three different parameters: indent, eol, and start

If you run :help backspace, it will tell you:

Influences the working of `<BS>`, `<Del>`, `CTRL-W` and `CTRL-U` in Insert
mode.  This is a list of items, separated by commas.  Each item allows
a way to backspace over something:

value     effect
indent    allow backspacing over autoindent
eol       allow backspacing over line breaks (join lines)
start     allow backspacing over the start of insert; CTRL-W and CTRL-U
          stop once at the start of insert.

The one that isn't set for you is start.

If you add set backspace=indent,eol,start to your .vimrc, you'll be able to backspace over anything in insert mode.

  • "feature"... For some reason, I'm seeing it enabled by default on a fresh macOS 10.13 with a brew install of vim latest. This solution still resolves the issue. – Taylor Edmiston Oct 8 '18 at 17:59
7

I also had this, the natural text processing default values were wrong for me.

  • MacBook Pro (15-inch, 2018)
  • 10.14.3 (Mojave)
  • Iterm2 3.2.7

Go to Preferences > Profiles > Keys and load the default preset Natural Text Editing and delete all entries that are about delete and delete behaviour. After that it works as expected.

  • 1
    Same, except I just removed the entries about "Del->", but did not add a "Sends ^H" binding. Then it worked as expected. – DagW Mar 25 at 8:38
  • @DagW confirmed, the ^H binding is unnecessary. – Salyangoz Mar 27 at 19:19
  • 1
    Had to dig too deep into wrong posts just to find this as the right answer, thanks a lot! – RecuencoJones Oct 21 at 7:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .