mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
parent
dd32018836
commit
bb15f078bb
|
@ -138,7 +138,7 @@ func (w *Writer) Init(shellName string) {
|
||||||
w.osc99 = "\\[\x1b]9;9;%s\x1b\\\\\\]"
|
w.osc99 = "\\[\x1b]9;9;%s\x1b\\\\\\]"
|
||||||
w.osc7 = "\\[\x1b]7;file://%s/%s\x1b\\\\\\]"
|
w.osc7 = "\\[\x1b]7;file://%s/%s\x1b\\\\\\]"
|
||||||
w.osc51 = "\\[\x1b]51;A;%s@%s:%s\x1b\\\\\\]"
|
w.osc51 = "\\[\x1b]51;A;%s@%s:%s\x1b\\\\\\]"
|
||||||
case "zsh":
|
case shell.ZSH, shell.TCSH:
|
||||||
w.format = "%%{%s%%}"
|
w.format = "%%{%s%%}"
|
||||||
w.linechange = "%%{\x1b[%d%s%%}"
|
w.linechange = "%%{\x1b[%d%s%%}"
|
||||||
w.right = "%%{\x1b[%dC%%}"
|
w.right = "%%{\x1b[%dC%%}"
|
||||||
|
|
|
@ -29,6 +29,7 @@ See the documentation to initialize your shell: https://ohmyposh.dev/docs/instal
|
||||||
"pwsh",
|
"pwsh",
|
||||||
"cmd",
|
"cmd",
|
||||||
"nu",
|
"nu",
|
||||||
|
"tcsh",
|
||||||
},
|
},
|
||||||
Args: NoArgsOrOneValidArg,
|
Args: NoArgsOrOneValidArg,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
|
|
@ -9,4 +9,5 @@ const (
|
||||||
CMD = "cmd"
|
CMD = "cmd"
|
||||||
NU = "nu"
|
NU = "nu"
|
||||||
GENERIC = "shell"
|
GENERIC = "shell"
|
||||||
|
TCSH = "tcsh"
|
||||||
)
|
)
|
||||||
|
|
|
@ -31,6 +31,9 @@ var cmdInit string
|
||||||
//go:embed scripts/omp.nu
|
//go:embed scripts/omp.nu
|
||||||
var nuInit string
|
var nuInit string
|
||||||
|
|
||||||
|
//go:embed scripts/omp.tcsh
|
||||||
|
var tcshInit string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
noExe = "echo \"Unable to find Oh My Posh executable\""
|
noExe = "echo \"Unable to find Oh My Posh executable\""
|
||||||
)
|
)
|
||||||
|
@ -167,7 +170,7 @@ func Init(env platform.Environment) string {
|
||||||
}
|
}
|
||||||
command := "(@(& %s init %s --config=%s --print%s) -join \"`n\") | Invoke-Expression"
|
command := "(@(& %s init %s --config=%s --print%s) -join \"`n\") | Invoke-Expression"
|
||||||
return fmt.Sprintf(command, quotePwshStr(executable), shell, quotePwshStr(env.Flags().Config), additionalParams)
|
return fmt.Sprintf(command, quotePwshStr(executable), shell, quotePwshStr(env.Flags().Config), additionalParams)
|
||||||
case ZSH, BASH, FISH, CMD:
|
case ZSH, BASH, FISH, CMD, TCSH:
|
||||||
return PrintInit(env)
|
return PrintInit(env)
|
||||||
case NU:
|
case NU:
|
||||||
createNuInit(env)
|
createNuInit(env)
|
||||||
|
@ -218,6 +221,10 @@ func PrintInit(env platform.Environment) string {
|
||||||
executable = quoteNuStr(executable)
|
executable = quoteNuStr(executable)
|
||||||
configFile = quoteNuStr(configFile)
|
configFile = quoteNuStr(configFile)
|
||||||
script = nuInit
|
script = nuInit
|
||||||
|
case TCSH:
|
||||||
|
executable = quotePosixStr(executable)
|
||||||
|
configFile = quotePosixStr(configFile)
|
||||||
|
script = tcshInit
|
||||||
default:
|
default:
|
||||||
return fmt.Sprintf("echo \"No initialization script available for %s\"", shell)
|
return fmt.Sprintf("echo \"No initialization script available for %s\"", shell)
|
||||||
}
|
}
|
||||||
|
|
11
src/shell/scripts/omp.tcsh
Normal file
11
src/shell/scripts/omp.tcsh
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
setenv POWERLINE_COMMAND "oh-my-posh";
|
||||||
|
setenv POSH_THEME "::CONFIG::";
|
||||||
|
|
||||||
|
set USER_PRECMD = "`alias precmd`";
|
||||||
|
set USER_POSTCMD = "`alias postcmd`";
|
||||||
|
set POSH_PRECMD = 'set POSH_CMD_STATUS = $status;set POSH_PATH = ::OMP::;set POSH_END_TIME = `$POSH_PATH get millis`;set POSH_DURATION = 0;if ( $POSH_START_TIME != -1 ) @ POSH_DURATION = $POSH_END_TIME - $POSH_START_TIME;set prompt = "`$POSH_PATH print primary --shell=tcsh --config=$POSH_THEME --error=$POSH_CMD_STATUS --execution-time=$POSH_DURATION`";set POSH_START_TIME = -1';
|
||||||
|
set POSH_POSTCMD = 'set POSH_START_TIME = `::OMP:: get millis`';
|
||||||
|
alias precmd "$POSH_PRECMD;$USER_PRECMD";
|
||||||
|
alias postcmd "$POSH_POSTCMD;$USER_POSTCMD";
|
||||||
|
set POSH_START_TIME = `::OMP:: get millis`;
|
||||||
|
|
|
@ -82,7 +82,7 @@ Tells the engine what to do with the block. There are two options:
|
||||||
|
|
||||||
- `prompt` renders one or more segments
|
- `prompt` renders one or more segments
|
||||||
- `rprompt` renders one or more segments aligned to the right of the cursor. Only one `rprompt` block is permitted.
|
- `rprompt` renders one or more segments aligned to the right of the cursor. Only one `rprompt` block is permitted.
|
||||||
Supported on zsh, bash, PowerShell, cmd and fish.
|
Supported on zsh, bash, PowerShell, cmd, nu and fish.
|
||||||
|
|
||||||
### Newline
|
### Newline
|
||||||
|
|
||||||
|
|
|
@ -77,10 +77,13 @@ to reflect your use-case.
|
||||||
{ label: 'bash', value: 'bash', },
|
{ label: 'bash', value: 'bash', },
|
||||||
{ label: 'fish', value: 'fish', },
|
{ label: 'fish', value: 'fish', },
|
||||||
{ label: 'nu', value: 'nu', },
|
{ label: 'nu', value: 'nu', },
|
||||||
|
{ label: 'tcsh', value: 'tcsh', },
|
||||||
]
|
]
|
||||||
}>
|
}>
|
||||||
<TabItem value="powershell">
|
<TabItem value="powershell">
|
||||||
|
|
||||||
|
Adjust or add the following line in your `$PROFILE`:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
oh-my-posh init pwsh --config ~/jandedobbeleer.omp.json | Invoke-Expression
|
oh-my-posh init pwsh --config ~/jandedobbeleer.omp.json | Invoke-Expression
|
||||||
```
|
```
|
||||||
|
@ -105,6 +108,8 @@ to only require remote scripts to be signed using `Set-ExecutionPolicy RemoteSig
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value="cmd">
|
<TabItem value="cmd">
|
||||||
|
|
||||||
|
Adjust or add the following line in `oh-my-posh.lua`:
|
||||||
|
|
||||||
```lua title="oh-my-posh.lua"
|
```lua title="oh-my-posh.lua"
|
||||||
load(io.popen('oh-my-posh init cmd --config C:/Users/Posh/jandedobbeleer.omp.json'):read("*a"))()
|
load(io.popen('oh-my-posh init cmd --config C:/Users/Posh/jandedobbeleer.omp.json'):read("*a"))()
|
||||||
```
|
```
|
||||||
|
@ -119,6 +124,8 @@ Once altered, restart cmd for the changes to take effect.
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value="zsh">
|
<TabItem value="zsh">
|
||||||
|
|
||||||
|
Adjust or add the following line to `~/.zshrc`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
eval "$(oh-my-posh init zsh --config ~/jandedobbeleer.omp.json)"
|
eval "$(oh-my-posh init zsh --config ~/jandedobbeleer.omp.json)"
|
||||||
```
|
```
|
||||||
|
@ -136,6 +143,8 @@ exec zsh
|
||||||
Use the full path to the config file, not the relative path or `~` as a shorthand for `$HOME`.
|
Use the full path to the config file, not the relative path or `~` as a shorthand for `$HOME`.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
Adjust or add the following line in `~/.bashrc` (could be `~/.profile` or `~/.bash_profile` depending on your environment):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
eval "$(oh-my-posh init bash --config ~/jandedobbeleer.omp.json)"
|
eval "$(oh-my-posh init bash --config ~/jandedobbeleer.omp.json)"
|
||||||
```
|
```
|
||||||
|
@ -153,6 +162,8 @@ exec bash
|
||||||
Oh My Posh requires fish v3.4.0 or higher.
|
Oh My Posh requires fish v3.4.0 or higher.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
Adjust or add the following line in `~/.config/fish/config.fish`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
oh-my-posh init fish --config ~/jandedobbeleer.omp.json | source
|
oh-my-posh init fish --config ~/jandedobbeleer.omp.json | source
|
||||||
```
|
```
|
||||||
|
@ -170,7 +181,7 @@ Once altered, reload your config for the changes to take effect.
|
||||||
Oh My Posh requires Nushell v0.73.0 or higher.
|
Oh My Posh requires Nushell v0.73.0 or higher.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
Add the following line to the Nushell env file (`$nu.env-path`):
|
Adjust or add the following line to the Nushell env file (`$nu.env-path`):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
oh-my-posh init nu --config ~/jandedobbeleer.omp.json
|
oh-my-posh init nu --config ~/jandedobbeleer.omp.json
|
||||||
|
@ -197,6 +208,21 @@ source /mylocation/myscript.nu
|
||||||
|
|
||||||
Once altered, restart Nushell for the changes to take effect.
|
Once altered, restart Nushell for the changes to take effect.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="tcsh">
|
||||||
|
|
||||||
|
Adjust or add the following line at the end of `~/.tcshrc`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
eval `oh-my-posh init tcsh --config ~/jandedobbeleer.omp.json`
|
||||||
|
```
|
||||||
|
|
||||||
|
Once added, reload your profile for the changes to take effect.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
exec tcsh
|
||||||
|
```
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ oh-my-posh get shell
|
||||||
{ label: 'bash', value: 'bash', },
|
{ label: 'bash', value: 'bash', },
|
||||||
{ label: 'fish', value: 'fish', },
|
{ label: 'fish', value: 'fish', },
|
||||||
{ label: 'nu', value: 'nu', },
|
{ label: 'nu', value: 'nu', },
|
||||||
|
{ label: 'tcsh', value: 'tcsh', },
|
||||||
]
|
]
|
||||||
}>
|
}>
|
||||||
<TabItem value="powershell">
|
<TabItem value="powershell">
|
||||||
|
@ -186,6 +187,21 @@ source /mylocation/myscript.nu
|
||||||
|
|
||||||
Once added, restart Nushell for the changes to take effect.
|
Once added, restart Nushell for the changes to take effect.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="tcsh">
|
||||||
|
|
||||||
|
Add the following at the end of `~/.tcshrc`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
eval `oh-my-posh init tcsh`
|
||||||
|
```
|
||||||
|
|
||||||
|
Once added, reload your profile for the changes to take effect.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
exec tcsh
|
||||||
|
```
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue