Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace mode can't replace character with 'j' or 'k' #7833

Open
happyTonakai opened this issue Jul 14, 2022 · 2 comments · May be fixed by #8718
Open

Replace mode can't replace character with 'j' or 'k' #7833

happyTonakai opened this issue Jul 14, 2022 · 2 comments · May be fixed by #8718

Comments

@happyTonakai
Copy link

Describe the bug
Cannot replace character with 'j' or 'k' in replace mode.

To Reproduce
Steps to reproduce the behavior:

  1. Press esc to enter normal mode
  2. Press r to enter replace mode
  3. Hit k or j
  4. The cursor jumps up or down

Expected behavior
The current character is replaced with k or j

Environment (please complete the following information):

  • Extension (VsCodeVim) version: v1.23.1
  • VSCode version: 1.69.1
  • OS: Win10 21H1 19043.1826
@nickgerlock
Copy link

Hi, I'm experiencing this same issue, and I think I know the cause in my case (though I'm unsure of how to solve it). In my case, it is caused by having added these commands to keybindings.json in order scroll through lines visually when single lines are split via word wrapping.

  {
    "key": "up",
    "command": "cursorUp",
    "when": "editorTextFocus && vim.active && !inDebugRepl && !suggestWidgetMultipleSuggistions && !suggestWidgetVisible"
  },
  {
    "key": "down",
    "command": "cursorDown",
    "when": "editorTextFocus && vim.active && !inDebugRepl && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
  },
  {
    "key": "k",
    "command": "cursorUp",
    "when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Normal' && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
  },
  {
    "key": "j",
    "command": "cursorDown",
    "when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Normal' && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
  },

It's strange. This issue happens because when doing a one-character replace with r, VS Code/Vim is still in NORMAL mode. If there is any way to detect whether it is currently in "one-character replace" mode, then this could easily be fixed.

@MarcoIeni
Copy link

This issue happens because when doing a one-character replace with r, VS Code/Vim is still in NORMAL mode.

I had the same problem. I looked at the code base a bit. The issue is that when we press r here we don't edit the state, while for example when we press R we do (see here).

If there is any way to detect whether it is currently in "one-character replace" mode, then this could easily be fixed.

Exactly, ideally after we press the first r we should edit the state. E.g. vim.singleReplace == true.

@raineorshine raineorshine linked a pull request Nov 7, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants