In a bash shell script you can prompt the user for input and enable readline completion for the user with the -e flag. (e.g. read -e -p 'GET YOUR FILE: ' file would allow a the user to use tab-completion to find the file.)
ZSH's completion is more…
I have a custom function and zsh gives me default tab completion for it.
It completes paths from current working directory. That's great, but I'd
like the completion (only for this particular function) to behave a
little bit differently: as if I was…
I have a script called , that takes a finite set of subcommands. Let's say this set is (foo bar qux). So the following are the acceptable CLI invocations this script:
, foo
, bar
, qux
(Each of the above may take further optional arguments to the…
Given two commands:
command1 - which has completions already set up for it
commmand2- which is a wrapper function, that in the end calls command1 ARG
How do I make command2 complete in the same manner as command1 ARG1 would without writing a…
When using the up and down arrow in my terminal (iTerm 2 on Mac OS Catalina), I can browse through my last commands using the up and down arrows.
I use ZSH (Oh-my-zsh to be precise) and if I type e.g. vim then press up, it will browse my history for…
So I'm not exactly sure whether this is something wrong with optparse-applicative's script or if I'm using it wrong.
In the optparse-applicative readme, it states that programs are made available with automatic completion scripts, with options for…
I am writing my own completions for a program.
I would like to be able to complete quoted words, maintaining the double or single quotes in the completion.
#compdef foo
_foo {
local strings
strings=(\
foo\
bar\
…
Main question
I would like to add powerline characters at the start and at the end of the selected completion, like this:
Started the completion menu by inserting c and pressing the TAB key.
Moved right in the completion menu by pressing the…
I am trying to create a completion where one of my completions will be dynamically generated depending on the values of the other flags. For example
local state
_arguments \
'-f[fabric]:fabric:->fabrics' \
'-c[containers/application where log…
I have a command xssh that is a wrapper of the original ssh command. I need a Zsh completion for this command, and the completion rules are exactly the same as zsh. So what I add a the following to the _xssh file
#compdef xssh
compdef xssh=ssh
I…
I have a ZSH completion script called
#compdef kubens
_arguments "1: :(- $(kubectl get namespaces -o=jsonpath='{range .items[*].metadata.name}{@}{"\n"}{end}'))"
This provides completion to the kubens command. However if user provides a certain…
I'm trying to write an autocomplete function for a custom executable that takes file arguments from a particular folder.
$ ./my_executable
should provide the files in folder /home/me/argument_files.
I got that to work with:
compdef '_files -W…
I would like to be able to type a filename in zsh, hit tab, and see a list of files that match that name in any subdirectories of my current directory. Then I could tab through those results and hit enter to select a certain file, just like the…
When I use Zsh file completion on my downloads directory, it would be useful if it would show the files sorted by modification time.
This command will do so for all file completions:
zstyle ':completion:*' file-sort modification
How would I apply…
Context
This concerns ZSH tilde expansion (as in bash tilde expansion).
Example: ~http is expanded to /srv/http which is (roughly) the home for user http set in /etc/passwd.
What I want to do
I would like to configure ZSH in order to get any…