Closed laggardkernel closed 4 years ago
Closed because of inactivity.
I had this same issue, which seems to be caused by the maximum length limit of 50 for lhs
(left-hand side) in the mapping that is defined by the define_entering_mapping
function as described in the documentation:
The maximum length of {lhs} of normal key mappings is 50. Since submode key mappings are built on top of normal key mappings, the maximum length of a submode {lhs} is shorter than 50. Usually 10 or more characters are available, depending on a submode name. And it is enough length because you don't want to type 4 or more keys to execute a command.
The above can also be found with :help submode-bugs
.
Now, the lhs
mapping that you define (<C-w><M-*>
) is way less than 50 characters, but vim-submode actually concatenates this with a lot of stuff before passing it to nnoremap
. In particular, the resulting lhs
is something like <Plug>(submode-before-entering:SUBMODE-NAME:with:YOUR-LHS)
, which is already close to 50 characters. Moreover, it includes the name of the submode, thus the longer the submode name, the fewer characters are available for the mapping.
This is also discussed in issue #2.
It seems that in four of your submode#enter_with
commands (those with the longest mappings), you just hit this length limit resulting in nnoremap
throwing an error. Try changing the name of your submode from tab/window
to t
or something very short, and it will probably work. Conversely, if you change the submode name to something very long, the other commands will fail too.
This is of course a terribly nasty bug and it's not clearly stated in e.g. the README. In the documentation it just states that "Usually 10 or more characters are available, depending on a submode name", however, this is not guaranteed at all and depends entirely on the length of the submode name.
It could probably also be easily fixed by making the prefix that is concatenated with the user-provided mapping much shorter, or imposing a maximum length on the submode name, or just implementing a check with a clear error message that the concatenated lhs
is too long. However, I'm not sure if the maintainer @kana is still actively maintaining this project to accept PRs.
Config
Errors
It seems only the
submode#enter_with
related to<C-w><M-*>
failed. If I disable this part, the corresponding mapping still works as a submode.