Remapping the GOTO Line function from `G` to `<Enter>` in normal mode
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
Current Attempt
When remapping the GOTO LINE function, the extension assumes I mean 'G' as in jump to end of file. Rather than 'Shift-G' which would be GOTO LINE.
I'm trying to remap the ENTER key inside normal mode to .
Basically trying to reproduce this: http://vim.wikia.com/wiki/Jump_to_a_line_number
This is what I have so far inside my settings.json:
"vim.normalModeKeyBindings": [
{
"before": ["<CR>"],
"after": ["G"]
},
So, if I give it a number in normal mode and do 12 + Enter then it should goto line 12. I just get straight to EOF as if I just typed Shift+g on it's own, so it ignores my number.
Possible Idea
I wouldn't mind doing this in the keybindings.json with something like this:
{
"key": "enter",
"command": "vim.gotoline?",
"when": "editorTextFocus && vim.mode != 'Insert'"
}
However I don't know if vim's GOTOLINE function is exposed and if it is I don't know what to write for "command"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the vim.normalModeKeyBindings example in settings.json and the proposed keybindings.json entry; inspect how a numeric prefix is carried into and whether the suggested command exists. Done means that entering a number followed by Enter in normal mode moves to that line instead of jumping to EOF.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100