VSCodeVim / VSCodeVim/Vim

How to Clear Vim's Undo History?

Open
#7,947 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Hi, I'm trying to see if a can remap shift+ZZ to just clear vim's history, save the file, and keep the tab open. This all works except for clearing the undo history, i.e. vim.vimState.historyTracker.removeMarks ( just a shot in the dark looking at the plugin code not sure how / if this is exposed to the editor in a way you could execute like what's seen below ). Is there anyway to reset the undo history?

settings.json

    ...,   
    "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": ["Z", "Z"],
            "commands": [
                "vim.vimState.historyTracker.removeMarks",
                "workbench.action.files.save"
            ]
        }
    ],
    ...,

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the VSCodeVim keybinding handling and the vim.vimState.historyTracker.removeMarks reference shown in the issue. Check whether undo-history reset is exposed as an executable command for settings.json mappings; done means a Shift+ZZ mapping can clear the history, save the file, and keep the tab open.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vim, vscode
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.