.vimrc Combined key mappings do not work
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
Describe the bug
The following keybinding setup works for both VIM and in VsVim (Visual Studio plugin), but does not yet work in VSCodeVim:
" Shortcut to toggle line number type
nnoremap <Leader>l :set number relativenumber!<CR>
nnoremap <Leader>ll :set number relativenumber!<CR>
" Shortcut to switch line numbers off
nnoremap <Leader>lo :set nonumber norelativenumber<CR>
Instead an error appears in the status bar: E488: trailing characters
I also tried using the approach with multiple commands separated by \| like they did on https://vi.stackexchange.com/questions/3885/how-to-map-two-commands-with-only-one-key, but that does not seem to work either.
To Reproduce
See above.
Expected behavior
Would be great if this could be made to work in VsCodeVim, like in Vim and VsVim.
Currently as a workaround I have just created the above combined keybindings for <Leader>ll and <Leader>lo in my Settings.json as well and this partially works for now, because the Settings.json way supports combined commands pretty well.
However combining this with the single l version <Leader>l in Settings.json the same way as above still does not work (same error E488 in status bar), as long as I am still loading the existing code from vimrc as well by having vim.vimrc.enable still configured to as true (to load my other keybindings that do work)
It is as if the keybinding in vimrc is not properly being overriden by all my bindings Settings.json but in this case it still decides to choose for the .vimrc config that it does not understand.
(Not sure if this is is to be considered a separate issue or actually related)
Environment (please complete the following information):
Same issue happens on both Windows and Linux.
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
Reproduce the mappings with vim.vimrc.enable enabled, including the combined commands and the overlapping l mapping, then trace how VSCodeVim parses vimrc mappings and reports E488. Done means the vimrc mappings work like the equivalent Vim and VsVim mappings, while the Settings.json bindings continue to coexist correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vim, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100