Vim icon indicating copy to clipboard operation
Vim copied to clipboard

`virtualedit=onemore`

Open jbaxleyiii opened this issue 8 years ago • 18 comments

  • Click thumbs-up 👍 on this issue if you want it!
  • Click confused 😕 on this issue if not having it makes VSCodeVim unusable.

The VSCodeVim team prioritizes issues based on reaction count.


Feature Request:

I was wondering how to set virtualedit=onemore but couldn't find it in the docs / playing around with settings? Is this currently possible? If not it would REALLY be awesome to have!

jbaxleyiii avatar May 03 '17 01:05 jbaxleyiii

Is that so you can move your cursor to the "newline" character and delete it?

Chillee avatar May 03 '17 02:05 Chillee

@Chillee or start an insert after the last character

jbaxleyiii avatar May 03 '17 02:05 jbaxleyiii

https://github.com/Microsoft/vscode/issues/13960

I think we need to wait for an upstream change.

Chillee avatar May 03 '17 03:05 Chillee

Oh gotcha! Thanks!

jbaxleyiii avatar May 03 '17 16:05 jbaxleyiii

Wait actually I'm dumb. This is completely possible to implement right now. Virtualedit in general is impossible, but one more is totally possible.

Hmm. I can't guarantee that how it could be implemented right now is bug free though...

Chillee avatar May 17 '17 05:05 Chillee

Has anyone found a solution for this?

kinnedev avatar Oct 17 '18 15:10 kinnedev

Anyone?

Ryanauger95 avatar Feb 08 '19 16:02 Ryanauger95

I really want this...

ghost avatar May 09 '19 16:05 ghost

I recently started using VSCodeVim instead of my (fairly) extensive vim config. My main apprehensions with the plugin were mapping jk to Esc and using the virtualedit+=onemore feature.

The first one seemed like an easy fix after looking at the documentation, but the second one not so much. I'd really appreciate if you could add the one more character at line endings. For me at least, it's the only reason I'm not switching right away, because I find it very annoying to go into insert mode at the last character and then press the right arrow key to go one more character left in insert mode.

Thanks a ton!

someshkar avatar Jul 07 '19 16:07 someshkar

@someshkar you can use 'A' to go past the end of the line and enter insert mode, or 'a' to go into insert mode after the next character

Ryanauger95 avatar Jul 08 '19 13:07 Ryanauger95

@PiedPieper Wow thanks so much! I've been needing this ever since I started using Vim!

someshkar avatar Jul 12 '19 15:07 someshkar

@Ryanauger95 has a great point if you are going to append to a line.

I, however, would like this functionality so that I can drop into visual mode and delete the carriage return and some leading whitespaces like so:

    // Who does this? :/
    }
    else {

For this, I would do the following:

# Note this works only with whichwrap
:<linenumber>$lvwhhd

This will transform the above lines into:

    } else {

Instead, now I have do the following to get the same results:

:<linenumber>$lvwhhdi<Backspace><Esc>

That extra i<Backspace><Esc> is really messing my workflow up. 😞

I guess when I run into stuff like this, for now, I will just switch back to vim, but it would be nice to have this option in the future so I won't have to switch text editors.

EDIT:

I guess instead of i<Backspace><Esc> I could do dh, but that is still too much typing. 🙂

unacceptable avatar Sep 12 '19 01:09 unacceptable

@ScriptMyJob Why not J?

J-Fields avatar Sep 12 '19 01:09 J-Fields

@J-Fields - My God man! I have been using vim for this long and I didn't know about this! You have changed my life today. 🙂

unacceptable avatar Sep 12 '19 02:09 unacceptable

For future reference: this is possible, but it probably would be a decent lift as the entire codebase assumes you can't be on the EOL character except in visual mode. The first step in an implementation would be to skip the logic in handleSelectionChange that prevents you from selecting past the last character.

J-Fields avatar Jun 23 '20 23:06 J-Fields

Wait actually I'm dumb. This is completely possible to implement right now. Virtualedit in general is impossible, but one more is totally possible.

Hmm. I can't guarantee that how it could be implemented right now is bug free though...

newB here, but maybe this is what you're looking for? The following snippet would go in your settings.json, and has the same functionality(for my use case) as virtualedit onemore. i wanted to be able to hit the '-' to go one character after the eol in normal mode and then press i(force of habit)

    {
      "commands": [
        "workbench.action.showCommands"
      ]
    },
    {
      "before":[
        "-"<-----insert your preferred key, mine is 0 for soft bol and - for eol
      ],
      "commands":[
        "cursorEnd"
      ]
    }
  ],```

elvindsouza avatar Aug 08 '21 04:08 elvindsouza

Hello, where is this at ?
I really want this please.

gruvw avatar Oct 05 '22 21:10 gruvw

@someshkar you can use 'A' to go past the end of the line and enter insert mode, or 'a' to go into insert mode after the next character

Thanks for this.

uncleSlayer avatar Apr 03 '23 09:04 uncleSlayer