Skip to content
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

Language specific keymaps #4501

Closed
dariooddenino opened this issue Oct 28, 2022 · 7 comments
Closed

Language specific keymaps #4501

dariooddenino opened this issue Oct 28, 2022 · 7 comments
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@dariooddenino
Copy link
Contributor

It would be useful to be able to add to one of the config files (config.toml or languages.toml?) a language specific keymap that overrides the standard commands.

For example it could be something like this:

config.toml

[keys.normal]
space = { m = ':sh foo' }

languages.toml

[[language]]
name = "rust"
[language.keys.normal]
space = { m = ':sh bar' }

[[language]]
name = "haskell"
[language.keys.normal]
space = { m = ':sh baz'  }
@dariooddenino dariooddenino added the C-enhancement Category: Improvements label Oct 28, 2022
@the-mikedavis
Copy link
Member

Is this useful for keymaps other than binding :sh commands? I can't think of a use-case other than trying to use the same key to run a build or test for different languages. And that use-case could be solved with #3134 and some scripting

@georgesboris
Copy link

I can think of other use cases like shortcuts for common things specific to languages (adding pipelines to langs like elm/elixir. creating lambdas. anything that gets boring, could use movements based on treesitter, etc)

Also, even snippets using sh can be quite different between languages and it would be better to make these work without setting up just/make files - just ny own opinion but I rather not change projects just for my editor needs.

@dariooddenino
Copy link
Contributor Author

Another use case is that I need sometimes to do full rebuilds on Haskell and Purescript.

On Haskell I'm sending a command to a running ghci instance (so I'm using a :sh command).
On Purescript I have to send an LSP command (right now I'm using some custom code, but something like #3140 could help).

I have the two commands bound to different keys, but I'd obviously like them to be on the same one.

@kirawi kirawi added the A-helix-term Area: Helix term improvements label Nov 28, 2022
@sli
Copy link

sli commented Jan 6, 2023

This would work great for me as well because my Godot C# projects differ a bit from my standard C# projects. While dotnet build doesn't mind me passing in arbitrary properties, configuring a keybinding to run a build applies it globally, leaving me with a build command binding that only functions in my C# projects and fails for anything else.

Editor configuration merging would fix this for me, but this solution would work just as well because language config merging is already implemented.

@hnorkowski
Copy link
Contributor

This feature would be very helpful for me.

To give one more use-case:
I am using a hotkey to select the contents of a line without the newline at the end. In languages that use a ; or other symbols at the end of each line I would like to exclude these as well. Another example would be \\ for a newline in latex where I always end a line if I place a \\ somewhere. So I would configure the same keybind for every language to select exactly the contents I need from a line.

@SecretPocketCat
Copy link

Isn't this a dupe of #836?

Also, how would this work with multi-lang files/selections (e.g. vue, svelte)?

@the-mikedavis
Copy link
Member

Ah yeah I agree, #836 is more general and should cover this. I think that's probably how this should be solved in the future: language specific config of any sort rather than just keybindings.

@the-mikedavis the-mikedavis closed this as not planned Won't fix, can't repro, duplicate, stale Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

7 participants