please support imap
Check for existing issues
- [X] Completed
Describe the feature
there are lot of sementic unit in programming language, e.g. -> / <- / := / => .... I don't type two chars , just a shortcut for inputing those unit, vim and emacs can do this with ease.
If applicable, add mockups / screenshots to help present your vision of the feature
No response
@diucicd You should be able to configure these with workspace::SendKeystrokes:
If you're using vim mode:
{
"context": "Editor && vim_mode == insert",
"bindings": {
":": ["workspace::SendKeystrokes", ":="]
}
},
Is this kind of what you want?
{
"context": "Editor && vim_mode == insert",
"bindings": {
":": ["workspace::SendKeystrokes", ":="]
}
}
this works, can not work with ->
{
"context": "Editor && vim_mode == insert",
"bindings": {
":": ["workspace::SendKeystrokes", "->"]
}
}
Ugh! This is what I get for trying to be clever. You can make it work by adding a space between the two:
{
"context": "Editor && vim_mode == insert",
"bindings": {
":": ["workspace::SendKeystrokes", "- >"]
}
}
For the := case you cannot have a space because if you do then the : hits the SendKeystrokes call again and you get no output. For the -> case, we parse that as "IME syntax" (https://github.com/zed-industries/zed/blob/cd73a434ec517f648b321dca113fc84df9201c7c/crates/gpui/src/platform/keystroke.rs#L61) so it maps to nothing. Adding the space causes it to be treated as two separate key presses.
I'll continue thinking about how to make this less terrible (maybe a good place to start would be making it so that this acts more like inoremap by default so that : = works and - > works).
@ConradIrwin thank you very much, now I have =>/:=/<-/-> in my config just like neovim