-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Command Snippet #6412
Comments
From CLI perspective, there is PSReadline and bash_completions, and other shell related autocompletion software. From settings perpective, there's already a json schema that's added that VSCode will intelligently recognize and provide suggestions for. It even recently added trailing comma support. |
So, this is probably something that would be best served by whatever commandline app you're using. As @WSLUser mentioned, you can (probably) configure PSReadline to do something like this for powershell, If your preferred shell is <shameless self plug> The docs aren't great, and it hasn't been updated in a while (but that's because I don't really think it needs to be), but that might scratch your itch. </shameless self plug> |
I believe Click was created for similar in cmd but the latest version is not stable and is abandoned. If you're not using in cmder though, it will be fine. |
I think there is important point that everyone is missing when telling us to rely on the shell completion functions. I want to be able to use snippets that are independent of the shell configuration. As an example, I often run awk '{ print $1 }' | while read... on server where I cannot create aliases or change any config, I would like to be able to type in 'a$1' for example and expand it to the predefined snippet. I'm often connecting to the systems where the completion is fully disabled and I run a lot of repetitive task that can't be scripted (terminal hijacking is always disabled). I'm really convinced this is a needed feature. |
I agree with @rmansnacks - have heard of one or two peers using "Ditto" clipboard manager for storing snippets in kind of a global way. I wouldn't be sure if there are any drawbacks to it, but wanted to comment in case anyone, like me, comes back here looking for "Windows Terminal Snippets". Hope this helps someone. |
This comment has been minimized.
This comment has been minimized.
We're also more general-purpose tracking this in #1595, so go toss your 👍 on that thread |
You could also theoretically create a command like: { "command": { "action": "sendInput", "input": "awk '{ print $1 }' | while read...\r" }, "keys":"ctrl+a", "name": "a$1" }, and then you could use the command palette to send that snippet really simply. So you'd just press Ctrl+Shift+P (to open the command palette),a,$,1,enter and it'd send that snippet to the terminal. Or leave out the |
Hey, that's brilliant - I'm excited to give it a try. Thanks so much, @zadjii-msft !! |
Description of the new feature/enhancement
Create command snippets like IDE snippets. Users can type something and then press tab to complete automatically. This is basically very simmilar with directory / file auto complete.
This will be very useful for long commands.
Proposed technical implementation details (optional)
User can configure their snippet in settings.json, for ex:
The text was updated successfully, but these errors were encountered: