Skip to content

Conversation

@CatsDeservePets
Copy link
Collaborator

No description provided.

@CatsDeservePets
Copy link
Collaborator Author

Hello @joelim-work.
This is just a proof of concept. It allows overriding builtin commands and still call their original counterparts.
I am fully aware that this could lead to problems due to states not getting updated through function calls etc.

What it could solve: Altering the behaviour of builtin commands while also inheriting their command line completions. This could allow for better integration of tools like zoxide. It would also allow to solve the “annoyance” I have with maps and map being different commands (and instead switch the behaviour depending on whether parameters are present or not).

Just wanting to know whether this idea might be worth to explore further or not.

@joelim-work
Copy link
Collaborator

This sounds a lot like commmand ... used in shells to execute external commands, bypassing alternate definitions like aliases or shell functions.

I tried your patch but doesn't allow redefining :map since it is parsed as a mapExpr object. Note that the parser expects mapExpr objects to be in a particular form (i.e. map <keys> Expr), so even if you override the command, I assume it can't be called if the parser cannot generate the appropriate command object.

@CatsDeservePets
Copy link
Collaborator Author

It was intended to work just like the command in shells.

You are right about the map expression, I did not consider it (that was the one thing I did not test and just assumed...).

@joelim-work
Copy link
Collaborator

Apart from map which doesn't work, how useful is this feature in practice? I don't remember seeing any issues from users about wanting to define a custom command but the name is already used by a built-in command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants