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

Improve auto completion for shell commands #12883

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sumandora
Copy link

This makes the very first argument of shell commands (like run-shell-command or pipe) auto complete programs instead of files.

This works relatively well for the commands themselves, however for the shell prompts (so the action pipe or pipe-to) this is pretty hard to do, because there the completions functions get the full line as input. This makes it impossible to figure out what argument you are editing, since you are missing the cursor position. (For command mode, this is handled by the command mode prompt itself, so the input for completion functions is just the argument which the user is editing right now.

Thinking about it, the pipe action might be able to be replaced using a macro that effectively does "@:pipe ", since the shell actions duplicate the commands from command mode.

For now, I handle this by basically completing the first argument to be a program and the rest are just seen as one big file. The previous behavior was to just see the entire prompt as a single big file, so I think this is sane.

shell-completion.mp4

This makes the very first argument of shell commands (like
run-shell-command or pipe) auto complete programs instead of files.
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.

1 participant