File tree Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,24 @@ If you'd like to automatically start inshellisense when you open your shell, run
27
27
``` shell
28
28
# bash
29
29
is init bash >> ~ /.bashrc
30
+
31
+ # zsh
32
+ is init zsh >> ~ /.zshrc
33
+
34
+ # fish
35
+ is init fish >> ~ /.config/fish/config.fish
36
+
37
+ # pwsh
38
+ is init pwsh >> $profile
39
+
40
+ # powershell
41
+ is init powershell >> $profile
42
+
43
+ # xonsh
44
+ is init xonsh >> ~ /.xonshrc
45
+
46
+ # nushell
47
+ is init nu >> $nu .env-path
30
48
```
31
49
32
50
### Usage
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export const supportedShells = [
33
33
Shell . Nushell ,
34
34
] . filter ( ( shell ) => shell != null ) as Shell [ ] ;
35
35
36
- export const initSupportedShells = [ Shell . Bash ] ;
36
+ export const initSupportedShells = supportedShells . filter ( ( shell ) => shell != Shell . Cmd ) ;
37
37
38
38
export const userZdotdir = process . env ?. ZDOTDIR ?? os . homedir ( ) ?? `~` ;
39
39
export const zdotdir = path . join ( os . tmpdir ( ) , `is-zsh` ) ;
@@ -124,10 +124,31 @@ export const getShellPromptRewrites = (shell: Shell) => shell == Shell.Nushell;
124
124
125
125
export const getShellConfig = ( shell : Shell ) : string => {
126
126
switch ( shell ) {
127
+ case Shell . Zsh :
127
128
case Shell . Bash :
128
129
return `if [[ -z "\${ISTERM}" && $- = *i* && $- != *c* ]]; then
129
- is -s bash ; exit
130
+ is -s ${ shell } ; exit
130
131
fi` ;
132
+ case Shell . Powershell :
133
+ case Shell . Pwsh :
134
+ return `$__IsCommandFlag = ([Environment]::GetCommandLineArgs() | ForEach-Object { $_.contains("-Command") }) -contains $true
135
+ $__IsNoExitFlag = ([Environment]::GetCommandLineArgs() | ForEach-Object { $_.contains("-NoExit") }) -contains $true
136
+ $__IsInteractive = -not $__IsCommandFlag -or ($__IsCommandFlag -and $__IsNoExitFlag)
137
+ if ([string]::IsNullOrEmpty($env:ISTERM) -and [Environment]::UserInteractive -and $__IsInteractive) {
138
+ is -s ${ shell }
139
+ Stop-Process -Id $pid
140
+ }` ;
141
+ case Shell . Fish :
142
+ return `if test -z "$ISTERM" && status --is-interactive
143
+ is -s fish ; kill %self
144
+ end` ;
145
+ case Shell . Xonsh :
146
+ return `if 'ISTERM' not in \${...} and $XONSH_INTERACTIVE:
147
+ is -s xonsh ; exit` ;
148
+ case Shell . Nushell :
149
+ return `if "ISTERM" not-in $env and $nu.is-interactive {
150
+ is -s nu ; exit
151
+ }` ;
131
152
}
132
153
return "" ;
133
154
} ;
You can’t perform that action at this time.
0 commit comments