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

Cursor movement (not jump) opens newly folded range #8939

Open
wolf0403 opened this issue Mar 14, 2024 · 4 comments
Open

Cursor movement (not jump) opens newly folded range #8939

wolf0403 opened this issue Mar 14, 2024 · 4 comments

Comments

@wolf0403
Copy link

Describe the bug
Cursor movement across folded ranges unfolds the lines, instead of move over the folded range like a single line (which is what this was intended to be in vim).

To Reproduce
Steps to reproduce the behavior:

  1. zf, e.g. zf3j
  2. j (to go to next line)

Expected behavior

In VIM, cursor will be moved to the next line after the newly created fold in step 1

In VSCodeVim, moving cursor (j/k) will unfold and move the cursor into the unfolded, "physical" line.

Screenshots
If applicable, add screenshots to help explain your problem.
If remapping-related, please attach log output: https://github.com/VSCodeVim/Vim#debugging-remappings.

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.27.2
  • VSCode version: vscode.dev, 1.87.2
  • OS: macOS, Chrome

Additional context
Add any other context about the problem here.

@shinohara-rin
Copy link
Contributor

I think what you described is the expected behaviour in VSCodeVim and you can use gj and gk instead of j and k to achieve what you expected.

You can create a remap in your settings.json with something like this:

"vim.normalModeKeyBindingsNonRecursive": [
    {
        "before": [
            "j",
        ],
        "after": [
            "g",
            "j"
        ]
    },
    {
        "before": [
            "k",
        ],
        "after": [
            "g",
            "k"
        ]
    }
],

@wolf0403
Copy link
Author

So if I'm understanding you correctly, this difference in behaviour from vim is expected? And why this change? If I'm creating a fold it generally means I know I don't want to look at them unless specifically to, but now that in VSCodeVim the most frequently used cursor moving keys (j/k) will simply expand this. Why is the default behaviour here instead of what vim is doing?

@shinohara-rin
Copy link
Contributor

I can't say for certain why it's implemented this way in VSCodeVim as I didn't write it, but anyway you can always remap it.

@HenryTSZ
Copy link
Contributor

you can add this settings:

"vim.foldfix": true,

to fix the fold bug

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

No branches or pull requests

3 participants