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

[Feature Request] Set cursor point #163

Open
JakeElder opened this issue Apr 4, 2021 · 1 comment
Open

[Feature Request] Set cursor point #163

JakeElder opened this issue Apr 4, 2021 · 1 comment
Labels
feature-request Feature Request

Comments

@JakeElder
Copy link

It would be useful to be able to set the cursor point when entering a snippet, IE

$ pet new "git commit -am \"feat(ui): <cursor>\""

This would be a lighter way to enter snippets with one variable

@RamiAwar
Copy link
Collaborator

✨ I think 2 things need to be solved here ✨

1. When we have default values, we need to prioritize letting the user pick default values over giving them an empty parameter with the cursor in the right place.

2. If we have multiple parameters, this feature will no longer make sense (unless we can dynamically control the cursor which I have no idea how to do, might even be impossible as its probably maintained in the shell process memory).

We need a solution that can resolve those two points.

💡 Proposed Solution 💡

Have an optional flag on new commands which you can choose to apply if you know you have no need for a default value and you only have a single parameter (commands like the one you just described, I have a lot of those as well so I can relate).

If you do apply this flag to a new command, you won't be able to set any default parameters (will be ignored, or maybe we can even error out if we detect any). And when you execute this command, then your cursor gets placed in the right position.

I'm just not sure how to manipulate the cursor like this yet. Will have to look into it. Do you know how? @JakeElder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Feature Request
Projects
Status: Todo
Development

No branches or pull requests

2 participants