diff --git a/src/ansi/ansi_writer.go b/src/ansi/ansi_writer.go
index e56603a6..898dd2fe 100644
--- a/src/ansi/ansi_writer.go
+++ b/src/ansi/ansi_writer.go
@@ -138,7 +138,7 @@ func (w *Writer) Init(shellName string) {
w.osc99 = "\\[\x1b]9;9;%s\x1b\\\\\\]"
w.osc7 = "\\[\x1b]7;file://%s/%s\x1b\\\\\\]"
w.osc51 = "\\[\x1b]51;A;%s@%s:%s\x1b\\\\\\]"
- case "zsh":
+ case shell.ZSH, shell.TCSH:
w.format = "%%{%s%%}"
w.linechange = "%%{\x1b[%d%s%%}"
w.right = "%%{\x1b[%dC%%}"
diff --git a/src/cli/init.go b/src/cli/init.go
index fa85438b..96dabeb3 100644
--- a/src/cli/init.go
+++ b/src/cli/init.go
@@ -29,6 +29,7 @@ See the documentation to initialize your shell: https://ohmyposh.dev/docs/instal
"pwsh",
"cmd",
"nu",
+ "tcsh",
},
Args: NoArgsOrOneValidArg,
Run: func(cmd *cobra.Command, args []string) {
diff --git a/src/shell/constants.go b/src/shell/constants.go
index e6082786..64712649 100644
--- a/src/shell/constants.go
+++ b/src/shell/constants.go
@@ -9,4 +9,5 @@ const (
CMD = "cmd"
NU = "nu"
GENERIC = "shell"
+ TCSH = "tcsh"
)
diff --git a/src/shell/init.go b/src/shell/init.go
index 45f33ead..9b16e883 100644
--- a/src/shell/init.go
+++ b/src/shell/init.go
@@ -31,6 +31,9 @@ var cmdInit string
//go:embed scripts/omp.nu
var nuInit string
+//go:embed scripts/omp.tcsh
+var tcshInit string
+
const (
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"
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)
case NU:
createNuInit(env)
@@ -218,6 +221,10 @@ func PrintInit(env platform.Environment) string {
executable = quoteNuStr(executable)
configFile = quoteNuStr(configFile)
script = nuInit
+ case TCSH:
+ executable = quotePosixStr(executable)
+ configFile = quotePosixStr(configFile)
+ script = tcshInit
default:
return fmt.Sprintf("echo \"No initialization script available for %s\"", shell)
}
diff --git a/src/shell/scripts/omp.tcsh b/src/shell/scripts/omp.tcsh
new file mode 100644
index 00000000..fa3f727f
--- /dev/null
+++ b/src/shell/scripts/omp.tcsh
@@ -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`;
+
diff --git a/website/docs/configuration/block.mdx b/website/docs/configuration/block.mdx
index 1bb4b59e..f0354716 100644
--- a/website/docs/configuration/block.mdx
+++ b/website/docs/configuration/block.mdx
@@ -82,7 +82,7 @@ Tells the engine what to do with the block. There are two options:
- `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.
- Supported on zsh, bash, PowerShell, cmd and fish.
+ Supported on zsh, bash, PowerShell, cmd, nu and fish.
### Newline
diff --git a/website/docs/installation/customize.mdx b/website/docs/installation/customize.mdx
index 9bfe212b..1ce1b326 100644
--- a/website/docs/installation/customize.mdx
+++ b/website/docs/installation/customize.mdx
@@ -77,10 +77,13 @@ to reflect your use-case.
{ label: 'bash', value: 'bash', },
{ label: 'fish', value: 'fish', },
{ label: 'nu', value: 'nu', },
+ { label: 'tcsh', value: 'tcsh', },
]
}>
+Adjust or add the following line in your `$PROFILE`:
+
```powershell
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
+Adjust or add the following line in `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"))()
```
@@ -119,6 +124,8 @@ Once altered, restart cmd for the changes to take effect.
+Adjust or add the following line to `~/.zshrc`:
+
```bash
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`.
:::
+Adjust or add the following line in `~/.bashrc` (could be `~/.profile` or `~/.bash_profile` depending on your environment):
+
```bash
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.
:::
+Adjust or add the following line in `~/.config/fish/config.fish`:
+
```bash
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.
:::
-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
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.
+
+
+
+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
+```
+
diff --git a/website/docs/installation/prompt.mdx b/website/docs/installation/prompt.mdx
index eeeb7781..87cd3279 100644
--- a/website/docs/installation/prompt.mdx
+++ b/website/docs/installation/prompt.mdx
@@ -25,6 +25,7 @@ oh-my-posh get shell
{ label: 'bash', value: 'bash', },
{ label: 'fish', value: 'fish', },
{ label: 'nu', value: 'nu', },
+ { label: 'tcsh', value: 'tcsh', },
]
}>
@@ -186,6 +187,21 @@ source /mylocation/myscript.nu
Once added, restart Nushell for the changes to take effect.
+
+
+
+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
+```
+