-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interpretation/handling of abstract commands feels unnecessarily strict #148
Comments
Thanks for the suggestions.
|
Number 2 is now crossed over. It sounds like it would have potential for breaking things. 🙂 |
I am also not entirely sure yet about 1. Not allowing unmapped abstract commands helps to spot typos like the following:
The user likely wants to map the |
Ah but I meant the other way around. To have abstract actions defined but not used in any mappings. 🙂 |
For instance, my use case is that I might have a set of abstract actions defined like below. Notice I have [class = JetBrainsIDE]
close_tab >> Alt{W}
close_tool_window >> Shift{Escape}
find >> Control{F}
find_in_files >> (Control Shift){F}
replace >> Control{R}
replace_in_files >> (Control Shift){R}
show_actions >> _Alt{A}
show_context_actions >> _Alt{Enter}
show_hover_info >> Control{F1}
show_quick_documentation >> Control{Q}
toggle_terminal >> ^ Alt{T}
toggle_problems >> ^ Alt{8}
goto_file >> Alt{P}
goto_symbol >> Alt{S}
goto_declaration >> Control{B}
goto_type_declaration >> (Control Shift){B}
goto_implementation >> Control{Alt{B}}
jump_to_text_start >> Control{Home}
jump_to_text_end >> Control{End}
jump_to_top >> Control{PageUp}
jump_to_bottom >> Control{PageDown}
jump_to_line >> Control{G}
jump_to_character >> Alt{Comma}
jump_to_word >> Control{Comma}
jump_to_matching_brace >> Control{Shift{M}}
jump_to_last_edit_loc >> Alt{Shift{E}}
next_error >> !Escape _Alt{Escape}
prev_error >> !Escape _Alt{Shift{Escape}}
next_function >> _Alt{ArrowDown}
prev_function >> _Alt{ArrowUp}
rollback_change >> (Control Alt){Z}
next_change >> (Control Alt){ArrowDown}
prev_change >> (Control Alt){ArrowUp}
next_difference >> (Control Alt){ArrowDown}
prev_difference >> (Control Alt){ArrowUp}
compare_next_file >> (Alt Shift){N}
compare_prev_file >> (Alt Shift){J}
extend_selection >> _Alt{W}
shrink_selection >> _Alt{Shift{W}}
cut_to_line_end >> !AltGr (Shift Control Alt){Delete}
delete_to_line_end >> !AltGr (Control Alt){Delete}
# join_lines >> _Control{J}
toggle_comment >> !Escape _Control{7}
toggle_block_comment >> !Escape _Control{Shift{7}}
accept_completion >> ^ Tab |
The other way round it would also have drawbacks. Allowing One could use something like the following to temporarily disable a command:
|
I see the issue now and agree it'd just make the situation worse. One way around this would be to enforce this recommendation from the documentation: Line 148 in 6b84248
This could be behind a "strict mode" startup flag or introduced as a breaking change. What do you think? Personally, I doubt the convenience would be worth the trouble for this alone. However, enforcing lower case initial letter for abstract actions sounds like an improvement in itself. It would for example:
|
Neat workaround. I personally would find that a bit cluttering as often the case has been that I want to use the keybinding for some other action. But using the same idea, I will definitely start doing this: None = Virtual99
None >> join_lines
None >> toggle_comment It can be a useful indicator of "TODO" items also. 👍 |
@houmain Ok to close this? |
I am thinking about adding directives some time.
Then I can also add a directive for allowing not mapped identifiers or enforcing some naming conventions. |
Great idea! |
I believe the current handling of abstract commands is too strict and has some limitations that I've found a bit unexpected. This is about two separate issues, but I still decided to create only a single issue. I can split these into separate issues if that's preferred.
1. Unused abstract command makes the config invalid
In some situations this behavior is useful, but it can also create a jarring user experience. I think a warning would be more appropriate. This feels also inconsistent as an unused alias doesn't make the config invalid, even though they can sometimes be used for the same purpose.
There's two situations when I find this especially jarring. First example: when I start remapping a new app, I'd like to first write all the abstract commands I'm expecting to remap. Coming up with intuitive remappings some times takes some time so I might not do them all at once. I then have to comment out the commands and uncomment the commands, while I'd prefer them to be there when I need them.
The other type of situation I find this jarring is when some remap I've done turns out interfering with some other functionality while I'm working. I then usually just comment it out to be fixed later, but I then end up with an invalid config and have to go back and also comment out the abstract command.
2. Abstract commands cannot be combined with other output mappingsA couple of examples which illustrate how this can feel inconsistent or confusing.
Example 1:
✅ Base config
❌ Naive attempt to use abstract command, invalid
✅ The above would be valid using an alias
Example 2:
✅ Debugging a config
❌ Further debugging, invalid config
✅ Same with an alias, valid
The text was updated successfully, but these errors were encountered: