Vim icon indicating copy to clipboard operation
Vim copied to clipboard

View does not scroll when I jump to top-of-file with :0

Open stevetremblett opened this issue 2 years ago • 4 comments

Describe the bug I use :[line-number] to move around. :0 in vi typically jumps to top-of-file line 1. In Vscode vim the cursor jumps to line 1 but the view does not change. When I take an action that moves the cursor hjkl, THEN the view jumps to top-of-file.

To Reproduce Steps to reproduce the behavior:

1 - open a long code file (longer than the screen) 2- go down far enough to scroll the top lines off the screen. Bottom-of-file is fine 3 - :0 to jump to top-of-file, observe the cursor is disappeared (jumped to line 1) but view does not jump 5 - i for insert mode, observe the view does not jump 6 - move the cursor by typing hello, observe the view jumps to top-of-file

Expected behavior :0 moves the cursor and the view to top-of-file

Screenshots I can demonstrate on a short video if necessary

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.25.2
  • VSCode version:1.81.1
  • OS:darwin x64 22.6.0

Additional context

pasting settings

{
    "editor.cursorStyle": "block",
    "vim.commandLineModeKeyBindings": [],
    "[python]": {
        "editor.formatOnType": true
    },
    "python.terminal.activateEnvInCurrentTerminal": true,
    "terminal.integrated.cursorBlinking": true,
    "terminal.integrated.env.osx": {},
    "terminal.integrated.scrollback": 10000,
    "git.autofetch": true,
    "editor.smoothScrolling": true,
    "editor.cursorSmoothCaretAnimation": "on",
    "editor.cursorSurroundingLines": 10,
    "files.insertFinalNewline": true,
    "files.trimFinalNewlines": true,
    "files.trimTrailingWhitespace": true,
    "workbench.list.scrollByPage": true,
    "workbench.list.smoothScrolling": true,
    "workbench.localHistory.maxFileEntries": 500,
    "workbench.startupEditor": "none",
    "workbench.fontAliasing": "antialiased",
    "cmake.configureOnOpen": false,
    "workbench.editor.highlightModifiedTabs": true,
    "workbench.editor.tabCloseButton": "left",
    "window.clickThroughInactive": false,
    "update.showReleaseNotes": false,
    "telemetry.telemetryLevel": "off",
    "editor.minimap.renderCharacters": false,
    "editor.minimap.enabled": false,
    "editor.folding": false,
    "terminal.integrated.copyOnSelection": true,
    "terminal.integrated.macOptionClickForcesSelection": true,
    "terminal.integrated.shellIntegration.suggestEnabled": true,
    "terminal.integrated.tabStopWidth": 4,
    "terminal.integrated.tabs.showActions": "always",
    "git.confirmSync": false,
    "makefile.makefilePath": "Makefile",
    "python.linting.mypyArgs": [
        "--follow-imports=silent",
        "--ignore-missing-imports",
        "--show-column-numbers",
        "--no-pretty",
        "--strict",
        "--implicit-reexport"
    ],
    "gitlens.plusFeatures.enabled": false,
    "gitlens.remotes": [
        {"domain":"XXXXX", "type":"GitLab"}
    ],
    "gitlens.partners": {},
    "gitlens.telemetry.enabled": false,
    "python.linting.flake8Args": [
        "--max-line-length=132"
    ],
    "flake8.args": [
        "--max-line-length=132"
    ],
    "terminal.integrated.enableMultiLinePasteWarning": false,
    "window.zoomLevel": 2,
    "workbench.colorTheme": "Default High Contrast",
    "vim.cursorStylePerMode.insert": "block",
    "vim.cursorStylePerMode.normal": "block-outline",
    "vim.cursorStylePerMode.replace": "block",
    "vim.incsearch": false,
    "editor.guides.indentation": false

}

stevetremblett avatar Aug 11 '23 20:08 stevetremblett

Also happens with a search that wraps to the top of the file.

stevetremblett avatar Aug 14 '23 18:08 stevetremblett

I took a quick look at this, it looks like this is caused by the "editor.smoothScrolling": true, setting you've got there. It doesn't happen in my VScode.

rpuhalovich avatar Aug 31 '23 23:08 rpuhalovich

Confirmed in my editor. The behaviour disappears after turning off editor.smoothScrolling

stevetremblett avatar Sep 01 '23 06:09 stevetremblett

Disabling editor.smoothScrolling also fixed the persistent issue where, after pressing Enter or double-clicking in the Peek Definition window to navigate, the cursor would move but the viewport would remain in place.

However, this has noticeably degraded the mouse wheel scrolling experience.

enihsyou avatar Sep 01 '25 08:09 enihsyou