VSCodeVim / Vim

:star: Vim for Visual Studio Code
http://aka.ms/vscodevim
MIT License
13.84k stars 1.31k forks source link

Weird jumps #8409

Open femans opened 1 year ago

femans commented 1 year ago

Describe the bug Often when the cursor is clearly somewhere in a document, and I press one of hte arrow keys or pageup/pagedown, the cursor jumps to the beginning of the document. If I do a combination like dd, it even removes the first line of the document in stead of the line of the cursor. Also, when I use end to jump to the end of the line, it does this, but then if I start typing or editing, it jumps back to where it came from.

To Reproduce I wish I knew. It just happens randomly and a lot.

Expected behavior Edit and move from where I see the cursor.

Environment (please complete the following information):

Additional context Unfortunately I had to disable the plugin because it becomes unworkable. Which may even mean I have to switch out vscode for something else.

iN5iNN3R470R commented 1 year ago

Yes I am also facing this every time and it is super annoying.

Steps to reproduce:

  1. Use page up/down.
  2. Move cursor with arrow keys or h/j/k/l The control goes back to where it started.

VSCode version: 1.78.0 vscodevim version: 1.25.2 OS: Windows 10

eduardomezencio commented 1 year ago

I frequently use vscode's Go Back command instead of ctrl+o, because the emulation of this feature in this extension does not work very well, and the issue reported here affects me a lot now because of this. After using Go Back and then pressing h/j/k/l, the cursor goes back to where it was before Go Back was used, then moves.

Steps to reproduce:

  1. Use vscode's command Go Back (I map it to Alt + left arrow)
  2. Move cursor with arrow keys or h/j/k/l The control goes back to where it started.

VSCode version: 1.78.2 vscodevim version: 1.25.2 OS: Ubuntu

ghrejoe commented 1 year ago

also encountered the same problem

ccastanedaucf commented 1 year ago

I run into this every once in a while when doing anything that jumps around the file (symbol search, next/prev error, git diffs, ect.). Closing and reopening the file seems to fix it - but I also found if you start gb and cancel, the cursor won't jump back (which makes me wonder if it's somehow related to multi-cursors). Great for not having to context switch whenever this happens.

Example settings.json to do this quickly + cancel out the forward movement:

"vim.normalModeKeyBindingsNonRecursive": [
    { "before": [ "<leader>", "<CR>" ], "after": [ "g", "b", "<Esc>", "b" ] }
]
mattijauhiainen commented 1 year ago

Also get this, one way to reproduce this

I feel like this bug has been around for years, and it seems to come and go, but once it starts to appear it happens consistently. Makes the VSCode search unusable, would love to know if somebody has a workaround.

iinuwa commented 1 year ago

Duplicate of #8200?

cpbotha commented 1 month ago

I ran into this today (2024-09-07) via Find.

After closing the Find window, now with my cursor on the line I wished to find, if I press esc, ctrl-c or any motion key, the cursor jumps back to where it was when I invoked the Find function.

Indeed, reopening the file made the problem go away.

d9k commented 6 days ago

Closing and reopening the file seems to fix it

You can bind a keyboard shortcut (it it's not in use) to reload editor tab at keybindings.json. Example:

  {
    "key": "shift+alt+t",
    "command": "runCommands",
    "args": {
      "commands": [
        "workbench.action.closeActiveEditor",
        "workbench.action.reopenClosedEditor"
      ]
    }
  }