philc / philc/vimium

End-of-line comments in key mappings treated like options

Open
#4,665 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
27k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

When including a comment on the same line as a custom key mapping, it is treated like an option. Since v2.2.0, you can observe this in the help dialog, where the options of a command are now displayed in parentheses. For example, using the key map definition map ' Marks.activateGotoMode " alias for backtick:

Image

According to this comment on #3839, this is supposed to be a feature, not a bug:

a "#" which is not at the start of a line doesn't mean a comment, but will be treated as an option of the mapping.

I think this is unintuitive, as the key map syntax closely resembles Vim's, where end-of-line comments are treated as such. At the very least, this is badly documented behavior: The example shown next to the key mappings input field does not make it clear a new line is necessary. Only when the end-of-line comment is included on an unmap line, you get a warning, since its syntax doesn't allow any options.

While I would like to see working end-of-line comments, I can understand if this will not be changed for simplicity's sake, but it would be great to see this behavior clearly documented somewhere.

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

Reproduce the behavior with the map ' Marks.activateGotoMode " alias for backtick example, then inspect the key-mapping parser and the key mappings input-field example. Done means either end-of-line comments no longer appear as mapping options in the help dialog, or the required comment syntax is clearly documented, including the unmap case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.