0

I just realized that the standard setting of is actual not 'going back one space', but deleting everything selected. Is there some basic way to get that some functionality in Vim visual mode, without resorting to in normal mode.

Also I noticed that was even listed in :map, which I found odd...

EDIT: Okay, I now tried it with vim -u NONE and then :map, which showed me that...

v  <BS>          "-d
v  <D-x>         "*d
v  <D-c>         "*y
v  <D-v>         "-d"*P
n  <D-v>         "*P

These are the only mappings, but why are these mapping there anyway? I tried vunmap <bs> but that doesn't work (it still doesn't go back like I want it to)

EDIT2: Okay so I made a screencapture to show my dilemma. It should be self explanatory: On the left I call vim normally, load all my plugins, but then disable my mappings. When I start visual mode I can use <bs> (and <space>) to change lines.

On the right, using vim -u NONE I can't do that.

There must be some setting to set that behavior...

Vim picture

  • So, when you press backspace you want the selection to reduce by one character? Also, are you using Vim on linux or on windows? – Durga Swaroop Jul 15 '16 at 3:41
  • 1
    Try these two settings if that is the case. set backspace=2 and set backspace=indent,eol,start. – Durga Swaroop Jul 15 '16 at 3:42
  • 2
    This is the default behavior for me. Are you sure that you don't have <BS> mapped to delete? Try it when stating vim with vim -u NONE. – Tumbler41 Jul 15 '16 at 5:12
  • 1
    Yeah. The default behavior of <BS> in visual mode is to move the cursor to the previous letter. It does nothing else. So, may be can you take a screen grab of what's happening when you press <BS> ? – Durga Swaroop Jul 15 '16 at 7:08
  • 3
    Also I noticed that was even listed in :map, which I found odd If by that you mean that you see <BS> mapped in visual mode you got your answer: The default behavior of <BS> in visual mode is to do the same as h, if you observe a different behavior it means that you (or a plugin) remapped the key in visual mode. – statox Jul 15 '16 at 7:25
1

Okay I just figured it out, it's set by the compatible option...

It sets the whichwrap option, which actually controls this behavior. The vi default is "", while the vim default is "b,s", which is the space and the backspace key.

  • Haha. I would have never guessed it because of compatible. Why do you have it set anyway? One of the first things told in Vim tutorials is to have set nocompatible as the first line of your vimrc file. – Durga Swaroop Jul 15 '16 at 14:11
  • Of course I had compatible set, but I was testing a plugin I wrote and was confused about that irrational behavior (because I tested it using vim -u NONE and than :sourceing the plugin) – hgiesel Jul 15 '16 at 14:36

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.