Skip to content

Commit

Permalink
Use compctl for better zsh autocompletion
Browse files Browse the repository at this point in the history
  • Loading branch information
disq committed May 16, 2017
1 parent f393ec4 commit 99f7043
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions complete/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ var shellSetups = map[string]shellSetupType{
"zsh": {
configFile: ".zshrc",
requiredLines: []string{
"autoload -U +X bashcompinit && bashcompinit",
"complete -C %binary %command",
// From http://blogs.perl.org/users/perlancar/2014/11/comparing-programmable-tab-completion-in-bash-zsh-tcsh-and-fish.html
`_s5cmd_completer() { read -l; local cl="$REPLY"; read -ln; local cp="$REPLY"; reply=(` + "`" + `COMP_SHELL=zsh COMP_LINE="$cl" COMP_POINT="$cp" %binary` + "`" + `) }`,
`compctl -K _s5cmd_completer s5cmd`,
},
},
}
Expand Down

0 comments on commit 99f7043

Please sign in to comment.