Skip to content

Commit bd5317b

Browse files
night556JacksonTian
authored andcommitted
fix: zsh completion script
1 parent 3d2c51b commit bd5317b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
### Master
44

5+
- fix: zsh completion script
6+
57
### 3.0.46
68

79
- update: meta data

cli/completion_installer.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,14 @@ func (z zshInstaller) Install(cmd, bin string) error {
123123
return fmt.Errorf("already installed in %s", z.rc)
124124
}
125125

126-
bashCompInit := "autoload -U +X bashcompinit && bashcompinit"
127-
if !lineInFile(z.rc, bashCompInit) {
128-
completeCmd = bashCompInit + "\n" + completeCmd
126+
compInit := "autoload -U +X compinit && compinit -i"
127+
bashCompInit := "autoload -U +X bashcompinit && bashcompinit -i"
128+
if !lineInFile(z.rc, compInit) {
129+
if !lineInFile(z.rc, bashCompInit) {
130+
completeCmd = compInit + "\n" + bashCompInit + "\n" + completeCmd
131+
} else {
132+
completeCmd = compInit + "\n" + completeCmd
133+
}
129134
}
130135

131136
return appendToFile(z.rc, completeCmd)

0 commit comments

Comments
 (0)