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

Nithin/snippets #425

Merged
merged 10 commits into from
Apr 12, 2024
Merged

Nithin/snippets #425

merged 10 commits into from
Apr 12, 2024

Conversation

nithinmuthukumar
Copy link
Collaborator

@nithinmuthukumar nithinmuthukumar commented Apr 7, 2024

Snippets are substitutions that apply in the line when a trigger key is pressed. Encompasses #209, however it is not purely visual.

@nithinmuthukumar nithinmuthukumar changed the title Nithin/alias expand Nithin/snippets Apr 8, 2024
@nithinmuthukumar nithinmuthukumar marked this pull request as ready for review April 8, 2024 03:45
@nithinmuthukumar
Copy link
Collaborator Author

This is a preliminary impl just to keep it simple.
TODO:

  • Add position of cursor after command is entered.
  • Regex

Copy link
Owner

@MrPicklePinosaur MrPicklePinosaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just trying out the ls expansion, most of the time I would also like to add a space if I were to keep typing after the snippet has expanded. like if I wanted to type ls home I would want the space to be insert automatically. Maybe we add option to append a space, maybe we detect this and only insert once you start typing. I'm not sure how generic this logic would be, and maybe we should wait for more use cases and implement more powerful snippets.

Otherwise looks good 👍

@nithinmuthukumar
Copy link
Collaborator Author

nithinmuthukumar commented Apr 12, 2024

Just trying out the ls expansion, most of the time I would also like to add a space if I were to keep typing after the snippet has expanded. like if I wanted to type ls home I would want the space to be insert automatically. Maybe we add option to append a space, maybe we detect this and only insert once you start typing. I'm not sure how generic this logic would be, and maybe we should wait for more use cases and implement more powerful snippets.

Otherwise looks good 👍

Could just simply add a space in the snippet itself to get this behaviour, or add an option in SnippetInfo. This shouldn't be automatic for the cases where that is not preferred behaviour, such as gc mapping to git commit -m " where the user would like to type in the message right after the quote.

Will also throw up a few issues for the TODO left for this

@nithinmuthukumar nithinmuthukumar merged commit 055ec5e into master Apr 12, 2024
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