mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
feat: simpler cli interface
This commit is contained in:
parent
ec317cf00b
commit
112043f805
|
@ -71,10 +71,10 @@ RUN chmod 777 -R /home/${USERNAME}/.config
|
|||
|
||||
# Override vscode's own Bash prompt with oh-my-posh:
|
||||
RUN sed -i 's/^__bash_prompt$/#&/' /home/${USERNAME}/.bashrc && \
|
||||
echo "eval \"\$(oh-my-posh prompt init bash --config $POSH_THEME)\"" >> /home/${USERNAME}/.bashrc
|
||||
echo "eval \"\$(oh-my-posh init bash --config $POSH_THEME)\"" >> /home/${USERNAME}/.bashrc
|
||||
|
||||
# Override vscode's own ZSH prompt with oh-my-posh:
|
||||
RUN echo "eval \"\$(oh-my-posh prompt init zsh --config $POSH_THEME)\"" >> /home/${USERNAME}/.zshrc
|
||||
RUN echo "eval \"\$(oh-my-posh init zsh --config $POSH_THEME)\"" >> /home/${USERNAME}/.zshrc
|
||||
|
||||
# Set container timezone:
|
||||
ARG TZ="UTC"
|
||||
|
|
|
@ -6,6 +6,6 @@ Import-Module Terminal-Icons
|
|||
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
|
||||
|
||||
$env:POSH_GIT_ENABLED=$true
|
||||
oh-my-posh prompt init pwsh --config $env:POSH_THEME | Invoke-Expression
|
||||
oh-my-posh init pwsh --config $env:POSH_THEME | Invoke-Expression
|
||||
|
||||
# NOTE: You can override the above env var from the devcontainer.json "args" under the "build" key.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Activate oh-my-posh prompt:
|
||||
oh-my-posh prompt init fish --config $POSH_THEME | source
|
||||
oh-my-posh init fish --config $POSH_THEME | source
|
||||
|
||||
# NOTE: You can override the above env vars from the devcontainer.json "args" under the "build" key.
|
||||
|
|
2
.github/ISSUE_TEMPLATE/bug.yml
vendored
2
.github/ISSUE_TEMPLATE/bug.yml
vendored
|
@ -56,7 +56,7 @@ body:
|
|||
id: logs
|
||||
attributes:
|
||||
label: Log output
|
||||
description: Please copy and paste the output generated by `Write-PoshDebug (PowerShell)`, or `oh-my-posh prompt debug` for other shells.
|
||||
description: Please copy and paste the output generated by `Write-PoshDebug (PowerShell)`, or `oh-my-posh debug` for other shells.
|
||||
render: shell
|
||||
validations:
|
||||
required: true
|
||||
|
|
|
@ -55,7 +55,7 @@ installed locally, we download the default theme, cache and use it to get you up
|
|||
When using PowerShell for example, this is all it takes from now on:
|
||||
|
||||
```powershell
|
||||
oh-my-posh prompt init pwsh | Invoke-Expression
|
||||
oh-my-posh init pwsh | Invoke-Expression
|
||||
```
|
||||
|
||||
:::info remote config
|
||||
|
|
|
@ -67,7 +67,7 @@ properties below - defaults to ` `
|
|||
Invoke Oh My Posh in your `$PROFILE` and add the following line below.
|
||||
|
||||
```powershell
|
||||
oh-my-posh prompt init pwsh --config $env:POSH_THEMES_PATH/jandedobbeleer.omp.json | Invoke-Expression
|
||||
oh-my-posh init pwsh --config $env:POSH_THEMES_PATH/jandedobbeleer.omp.json | Invoke-Expression
|
||||
// highlight-start
|
||||
Enable-PoshLineError
|
||||
// highlight-end
|
||||
|
|
|
@ -50,7 +50,7 @@ theme.
|
|||
:::
|
||||
|
||||
```bash
|
||||
oh-my-posh prompt print primary --config sample.json --shell uni
|
||||
oh-my-posh print primary --config sample.json --shell uni
|
||||
```
|
||||
|
||||
If all goes according to plan, you should see the prompt being printed out on the line below. In case you see a lot of
|
||||
|
|
|
@ -76,7 +76,7 @@ For example:
|
|||
|
||||
```powershell
|
||||
# $PROFILE
|
||||
oh-my-posh prompt init pwsh --config ~\wildertheme.json | Invoke-Expression
|
||||
oh-my-posh init pwsh --config ~\wildertheme.json | Invoke-Expression
|
||||
Enable-PoshTooltips
|
||||
```
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ properties below - defaults to `{{ .Shell }}> `
|
|||
Invoke Oh My Posh in your `$PROFILE` and add the following line below.
|
||||
|
||||
```powershell
|
||||
oh-my-posh prompt init pwsh --config $env:POSH_THEMES_PATH/jandedobbeleer.omp.json | Invoke-Expression
|
||||
oh-my-posh init pwsh --config $env:POSH_THEMES_PATH/jandedobbeleer.omp.json | Invoke-Expression
|
||||
// highlight-start
|
||||
Enable-PoshTransientPrompt
|
||||
// highlight-end
|
||||
|
|
|
@ -7,7 +7,7 @@ sidebar_label: 💅🏼 Customize
|
|||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem"
|
||||
|
||||
The standard prompt initialization sets Oh My Posh' [default theme][default-theme]. This configuration is downloaded
|
||||
The standard initialization sets Oh My Posh' [default theme][default-theme]. This configuration is downloaded
|
||||
and kept up-to-date with Oh My Posh' version every time the shell starts. To change/alter the configuration, you need to
|
||||
add the `--config` command-line option to change the configuration to use a specific file.
|
||||
|
||||
|
@ -32,7 +32,7 @@ downloaded the configuration file to your user's home folder):
|
|||
<TabItem value="powershell">
|
||||
|
||||
```powershell
|
||||
oh-my-posh prompt init pwsh --config ~/.jandedobbeleer.omp.json | Invoke-Expression
|
||||
oh-my-posh init pwsh --config ~/.jandedobbeleer.omp.json | Invoke-Expression
|
||||
```
|
||||
|
||||
Once altered, reload your profile for the changes to take effect.
|
||||
|
@ -45,7 +45,7 @@ Once altered, reload your profile for the changes to take effect.
|
|||
<TabItem value="cmd">
|
||||
|
||||
```lua title="oh-my-posh.lua"
|
||||
load(io.popen('oh-my-posh prompt init cmd --config ~/.jandedobbeleer.omp.json'):read("*a"))()
|
||||
load(io.popen('oh-my-posh init cmd --config ~/.jandedobbeleer.omp.json'):read("*a"))()
|
||||
```
|
||||
|
||||
Once altered, restart cmd for the changes to take effect.
|
||||
|
@ -54,7 +54,7 @@ Once altered, restart cmd for the changes to take effect.
|
|||
<TabItem value="zsh">
|
||||
|
||||
```bash
|
||||
eval "$(oh-my-posh prompt init zsh --config ~/.jandedobbeleer.omp.json)"
|
||||
eval "$(oh-my-posh init zsh --config ~/.jandedobbeleer.omp.json)"
|
||||
```
|
||||
|
||||
Once altered, reload your profile for the changes to take effect.
|
||||
|
@ -67,7 +67,7 @@ exec zsh
|
|||
<TabItem value="bash">
|
||||
|
||||
```bash
|
||||
eval "$(oh-my-posh prompt init bash --config ~/.jandedobbeleer.omp.json)"
|
||||
eval "$(oh-my-posh init bash --config ~/.jandedobbeleer.omp.json)"
|
||||
```
|
||||
|
||||
Once altered, reload your profile for the changes to take effect.
|
||||
|
@ -80,7 +80,7 @@ exec bash
|
|||
<TabItem value="fish">
|
||||
|
||||
```bash
|
||||
oh-my-posh prompt init fish --config ~/.jandedobbeleer.omp.json | source
|
||||
oh-my-posh init fish --config ~/.jandedobbeleer.omp.json | source
|
||||
```
|
||||
|
||||
Once altered, reload your config for the changes to take effect.
|
||||
|
@ -95,20 +95,20 @@ Once altered, reload your config for the changes to take effect.
|
|||
**Nu < 0.32.0**
|
||||
|
||||
```bash
|
||||
config set prompt "= `{{$(oh-my-posh prompt print primary --config ~/.jandedobbeleer.omp.json | str collect)}}`"
|
||||
config set prompt "= `{{$(oh-my-posh print primary --config ~/.jandedobbeleer.omp.json | str collect)}}`"
|
||||
```
|
||||
|
||||
**Nu >= 0.32.0**
|
||||
|
||||
```bash
|
||||
config set prompt "(oh-my-posh prompt print primary --config ~/.jandedobbeleer.omp.json | str collect)"
|
||||
config set prompt "(oh-my-posh print primary --config ~/.jandedobbeleer.omp.json | str collect)"
|
||||
```
|
||||
|
||||
**Nu >= 0.60.0**
|
||||
|
||||
```bash
|
||||
let-env PROMPT_COMMAND = { oh-my-posh prompt print primary --config ~/.jandedobbeleer.omp.json }
|
||||
let-env PROMPT_COMMAND_RIGHT = { oh-my-posh prompt print right --config ~/.jandedobbeleer.omp.json }
|
||||
let-env PROMPT_COMMAND = { oh-my-posh print primary --config ~/.jandedobbeleer.omp.json }
|
||||
let-env PROMPT_COMMAND_RIGHT = { oh-my-posh print right --config ~/.jandedobbeleer.omp.json }
|
||||
```
|
||||
|
||||
Once altered, restart nu shell for the changes to take effect.
|
||||
|
|
|
@ -38,7 +38,7 @@ notepad $PROFILE
|
|||
Then add the following line.
|
||||
|
||||
```powershell
|
||||
oh-my-posh prompt init pwsh | Invoke-Expression
|
||||
oh-my-posh init pwsh | Invoke-Expression
|
||||
```
|
||||
|
||||
Once added, reload your profile for the changes to take effect.
|
||||
|
@ -71,7 +71,7 @@ Use the full path to the config file, not the relative path.
|
|||
:::
|
||||
|
||||
```lua title="oh-my-posh.lua"
|
||||
load(io.popen('oh-my-posh prompt init cmd'):read("*a"))()
|
||||
load(io.popen('oh-my-posh init cmd'):read("*a"))()
|
||||
```
|
||||
|
||||
Once added, restart cmd for the changes to take effect.
|
||||
|
@ -82,7 +82,7 @@ Once added, restart cmd for the changes to take effect.
|
|||
Add the following to `~/.zshrc`:
|
||||
|
||||
```bash
|
||||
eval "$(oh-my-posh prompt init zsh)"
|
||||
eval "$(oh-my-posh init zsh)"
|
||||
```
|
||||
|
||||
Once added, reload your profile for the changes to take effect.
|
||||
|
@ -97,7 +97,7 @@ source ~/.zshrc
|
|||
Add the following to `~/.bashrc` (could be `~/.profile` or `~/.bash_profile` depending on your environment):
|
||||
|
||||
```bash
|
||||
eval "$(oh-my-posh prompt init bash)"
|
||||
eval "$(oh-my-posh init bash)"
|
||||
```
|
||||
|
||||
Once added, reload your profile for the changes to take effect.
|
||||
|
@ -122,7 +122,7 @@ It's advised to be on the latest version of fish. Versions below 3.1.2 have issu
|
|||
Initialize Oh My Posh in `~/.config/fish/config.fish`:
|
||||
|
||||
```bash
|
||||
oh-my-posh prompt init fish | source
|
||||
oh-my-posh init fish | source
|
||||
```
|
||||
|
||||
Once added, reload your config for the changes to take effect.
|
||||
|
@ -139,20 +139,20 @@ Set the prompt and restart nu shell:
|
|||
**Nu < 0.32.0**
|
||||
|
||||
```bash
|
||||
config set prompt "= `{{$(oh-my-posh prompt print primary | str collect)}}`"
|
||||
config set prompt "= `{{$(oh-my-posh print primary | str collect)}}`"
|
||||
```
|
||||
|
||||
**Nu >= 0.32.0**
|
||||
|
||||
```bash
|
||||
config set prompt "(oh-my-posh prompt print primary | str collect)"
|
||||
config set prompt "(oh-my-posh print primary | str collect)"
|
||||
```
|
||||
|
||||
**Nu >= 0.60.0**
|
||||
|
||||
```bash
|
||||
let-env PROMPT_COMMAND = { oh-my-posh prompt print primary }
|
||||
let-env PROMPT_COMMAND_RIGHT = { oh-my-posh prompt print right }
|
||||
let-env PROMPT_COMMAND = { oh-my-posh print primary }
|
||||
let-env PROMPT_COMMAND_RIGHT = { oh-my-posh print right }
|
||||
```
|
||||
|
||||
Restart nu shell for the changes to take effect.
|
||||
|
|
|
@ -188,5 +188,5 @@ function Set-PoshPrompt {
|
|||
$global:omp_global_sessionstate = $PSCmdlet.SessionState
|
||||
|
||||
$poshCommand = Get-PoshCommand
|
||||
(& $poshCommand prompt init pwsh --config="$config") | Invoke-Expression
|
||||
(& $poshCommand init pwsh --config="$config") | Invoke-Expression
|
||||
}
|
||||
|
|
|
@ -56,5 +56,5 @@ var debugCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
func init() { // nolint:gochecknoinits
|
||||
promptCmd.AddCommand(debugCmd)
|
||||
rootCmd.AddCommand(debugCmd)
|
||||
}
|
|
@ -38,7 +38,7 @@ See the documentation to initialize your shell: https://ohmyposh.dev/docs/prompt
|
|||
func init() { // nolint:gochecknoinits
|
||||
initCmd.Flags().BoolVarP(&print, "print", "p", false, "print the init script")
|
||||
_ = initCmd.MarkPersistentFlagRequired("config")
|
||||
promptCmd.AddCommand(initCmd)
|
||||
rootCmd.AddCommand(initCmd)
|
||||
}
|
||||
|
||||
func runInit(shellName string) {
|
|
@ -122,5 +122,5 @@ func init() { // nolint:gochecknoinits
|
|||
printCmd.Flags().StringVar(&command, "command", "", "tooltip command")
|
||||
printCmd.Flags().BoolVarP(&plain, "plain", "p", false, "plain text output (no ANSI)")
|
||||
printCmd.Flags().BoolVar(&eval, "eval", false, "output the prompt for eval")
|
||||
promptCmd.AddCommand(printCmd)
|
||||
rootCmd.AddCommand(printCmd)
|
||||
}
|
|
@ -11,8 +11,8 @@ import (
|
|||
// promptCmd represents the prompt command
|
||||
var promptCmd = &cobra.Command{
|
||||
Use: "prompt",
|
||||
Short: "Set up the prompt for your shell",
|
||||
Long: `Set up the prompt for your shell
|
||||
Short: "Set up the prompt for your shell (deprecated)",
|
||||
Long: `Set up the prompt for your shell (deprecated)
|
||||
Allows to initialize one of the supported shells, or to set the prompt manually for a custom shell.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
_ = cmd.Help()
|
||||
|
@ -20,5 +20,9 @@ Allows to initialize one of the supported shells, or to set the prompt manually
|
|||
}
|
||||
|
||||
func init() { // nolint:gochecknoinits
|
||||
// legacy support
|
||||
promptCmd.AddCommand(initCmd)
|
||||
promptCmd.AddCommand(debugCmd)
|
||||
promptCmd.AddCommand(printCmd)
|
||||
rootCmd.AddCommand(promptCmd)
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ func Init(env environment.Environment) string {
|
|||
shell := env.Flags().Shell
|
||||
switch shell {
|
||||
case PWSH, PWSH5:
|
||||
return fmt.Sprintf("(@(&\"%s\" prompt init %s --config=\"%s\" --print) -join \"`n\") | Invoke-Expression", executable, shell, env.Flags().Config)
|
||||
return fmt.Sprintf("(@(&\"%s\" init %s --config=\"%s\" --print) -join \"`n\") | Invoke-Expression", executable, shell, env.Flags().Config)
|
||||
case ZSH, BASH, FISH, CMD:
|
||||
return PrintInit(env)
|
||||
default:
|
||||
|
|
|
@ -12,7 +12,7 @@ fi
|
|||
# start timer on command start
|
||||
PS0='$(::OMP:: get millis > "$TIMER_START")'
|
||||
# set secondary prompt
|
||||
PS2="$(::OMP:: prompt print secondary --config="$POSH_THEME" --shell=bash)"
|
||||
PS2="$(::OMP:: print secondary --config="$POSH_THEME" --shell=bash)"
|
||||
|
||||
function _omp_hook() {
|
||||
local ret=$?
|
||||
|
@ -25,7 +25,7 @@ function _omp_hook() {
|
|||
omp_elapsed=$((omp_now-omp_start_time))
|
||||
rm -f "$TIMER_START"
|
||||
fi
|
||||
PS1="$(::OMP:: prompt print primary --config="$POSH_THEME" --shell=bash --error="$ret" --execution-time="$omp_elapsed" --stack-count="$omp_stack_count" | tr -d '\0')"
|
||||
PS1="$(::OMP:: print primary --config="$POSH_THEME" --shell=bash --error="$ret" --execution-time="$omp_elapsed" --stack-count="$omp_stack_count" | tr -d '\0')"
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ set --global omp_transient 0
|
|||
function fish_prompt
|
||||
set --local omp_status_cache_temp $status
|
||||
if test "$omp_transient" = "1"
|
||||
::OMP:: prompt print transient --config $POSH_THEME --shell fish --error $omp_status_cache --execution-time $omp_duration --stack-count $omp_stack_count
|
||||
::OMP:: print transient --config $POSH_THEME --shell fish --error $omp_status_cache --execution-time $omp_duration --stack-count $omp_stack_count
|
||||
return
|
||||
end
|
||||
set --global omp_status_cache $omp_status_cache_temp
|
||||
|
@ -25,7 +25,7 @@ function fish_prompt
|
|||
set --global --export omp_last_status_generation $status_generation
|
||||
end
|
||||
|
||||
::OMP:: prompt print primary --config $POSH_THEME --shell fish --error $omp_status_cache --execution-time $omp_duration --stack-count $omp_stack_count
|
||||
::OMP:: print primary --config $POSH_THEME --shell fish --error $omp_status_cache --execution-time $omp_duration --stack-count $omp_stack_count
|
||||
end
|
||||
|
||||
function fish_right_prompt
|
||||
|
@ -35,11 +35,11 @@ function fish_right_prompt
|
|||
return
|
||||
end
|
||||
if test -n "$omp_tooltip_command"
|
||||
::OMP:: prompt print tooltip --config $POSH_THEME --shell fish --command $omp_tooltip_command
|
||||
::OMP:: print tooltip --config $POSH_THEME --shell fish --command $omp_tooltip_command
|
||||
set omp_tooltip_command ""
|
||||
return
|
||||
end
|
||||
::OMP:: prompt print right --config $POSH_THEME --shell fish --error $omp_status_cache --execution-time $omp_duration --stack-count $omp_stack_count
|
||||
::OMP:: print right --config $POSH_THEME --shell fish --error $omp_status_cache --execution-time $omp_duration --stack-count $omp_stack_count
|
||||
end
|
||||
|
||||
function postexec_omp --on-event fish_postexec
|
||||
|
|
|
@ -78,12 +78,12 @@ local function get_posh_prompt(rprompt)
|
|||
if rprompt then
|
||||
prompt = "right"
|
||||
end
|
||||
local prompt_exe = string.format('%s prompt print %s --shell=cmd --config=%s %s %s', omp_exe(), prompt, omp_config(), execution_time_option(), error_level_option(), rprompt)
|
||||
local prompt_exe = string.format('%s print %s --shell=cmd --config=%s %s %s', omp_exe(), prompt, omp_config(), execution_time_option(), error_level_option(), rprompt)
|
||||
return run_posh_command(prompt_exe)
|
||||
end
|
||||
|
||||
local function get_posh_tooltip(command)
|
||||
local prompt_exe = string.format('%s prompt print tooltip --shell=cmd --config=%s --command="%s"', omp_exe(), omp_config(), command)
|
||||
local prompt_exe = string.format('%s print tooltip --shell=cmd --config=%s --command="%s"', omp_exe(), omp_config(), command)
|
||||
local tooltip = run_posh_command(prompt_exe)
|
||||
if tooltip == "" then
|
||||
-- If no tooltip, generate normal rprompt.
|
||||
|
@ -137,7 +137,7 @@ function p:rightfilter(prompt)
|
|||
return cached_prompt.right, false
|
||||
end
|
||||
function p:transientfilter(prompt)
|
||||
local prompt_exe = string.format('%s prompt print transient --config=%s', omp_exe(), omp_config())
|
||||
local prompt_exe = string.format('%s print transient --config=%s', omp_exe(), omp_config())
|
||||
prompt = run_posh_command(prompt_exe)
|
||||
if prompt == "" then
|
||||
prompt = nil
|
||||
|
|
|
@ -32,7 +32,7 @@ Remove-Variable omp_value -Confirm:$false
|
|||
Remove-Variable omp_config -Confirm:$false
|
||||
|
||||
# set secondary prompt
|
||||
$secondaryPrompt = @(&"::OMP::" prompt print secondary --config="$Env:POSH_THEME" 2>&1) -join "`n"
|
||||
$secondaryPrompt = @(&"::OMP::" print secondary --config="$Env:POSH_THEME" 2>&1) -join "`n"
|
||||
Set-PSReadLineOption -ContinuationPrompt $secondaryPrompt
|
||||
|
||||
function global:Set-PoshContext {}
|
||||
|
@ -62,13 +62,13 @@ function global:Initialize-ModuleSupport {
|
|||
$omp = "::OMP::"
|
||||
$config, $cleanPWD, $cleanPSWD = Get-PoshContext
|
||||
if ($env:POSH_TRANSIENT -eq $true) {
|
||||
$standardOut = @(&$omp prompt print transient --error="$global:ERRORCODE" --pwd="$cleanPWD" --pswd="$cleanPSWD" --execution-time="$global:EXECUTIONTIME" --config="$config" 2>&1)
|
||||
$standardOut = @(&$omp print transient --error="$global:ERRORCODE" --pwd="$cleanPWD" --pswd="$cleanPSWD" --execution-time="$global:EXECUTIONTIME" --config="$config" 2>&1)
|
||||
$standardOut -join "`n"
|
||||
$env:POSH_TRANSIENT = $false
|
||||
return
|
||||
}
|
||||
if (Test-Path variable:/PSDebugContext) {
|
||||
$standardOut = @(&$omp prompt print debug --pwd="$cleanPWD" --pswd="$cleanPSWD" --config="$config" 2>&1)
|
||||
$standardOut = @(&$omp print debug --pwd="$cleanPWD" --pswd="$cleanPSWD" --config="$config" 2>&1)
|
||||
$standardOut -join "`n"
|
||||
return
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ function global:Initialize-ModuleSupport {
|
|||
$global:omp_lastHistoryId = $history.Id
|
||||
}
|
||||
$terminalWidth = $Host.UI.RawUI.WindowSize.Width
|
||||
$standardOut = @(&$omp prompt print primary --error="$global:ERRORCODE" --pwd="$cleanPWD" --pswd="$cleanPSWD" --execution-time="$global:EXECUTIONTIME" --stack-count="$stackCount" --config="$config" --terminal-width=$terminalWidth 2>&1)
|
||||
$standardOut = @(&$omp print primary --error="$global:ERRORCODE" --pwd="$cleanPWD" --pswd="$cleanPSWD" --execution-time="$global:EXECUTIONTIME" --stack-count="$stackCount" --config="$config" --terminal-width=$terminalWidth 2>&1)
|
||||
# make sure PSReadLine knows we have a multiline prompt
|
||||
$extraLines = $standardOut.Count - 1
|
||||
if ($extraLines -gt 0) {
|
||||
|
@ -119,7 +119,7 @@ Set-Item -Path Function:prompt -Value $Prompt -Force
|
|||
function global:Write-PoshDebug {
|
||||
$omp = "::OMP::"
|
||||
$config, $cleanPWD, $cleanPSWD = Get-PoshContext
|
||||
$standardOut = @(&$omp prompt debug --config="$config" 2>&1)
|
||||
$standardOut = @(&$omp debug --config="$config" 2>&1)
|
||||
$standardOut -join "`n"
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ function global:Enable-PoshTooltips {
|
|||
$cursor = $null
|
||||
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$command, [ref]$cursor)
|
||||
$command = $command -replace "`"", "'"
|
||||
$standardOut = @(&$omp prompt print tooltip --pwd="$cleanPWD" --pswd="$cleanPSWD" --config="$config" --command="$command" 2>&1)
|
||||
$standardOut = @(&$omp print tooltip --pwd="$cleanPWD" --pswd="$cleanPSWD" --config="$config" --command="$command" 2>&1)
|
||||
Write-Host $standardOut -NoNewline
|
||||
$host.UI.RawUI.CursorPosition = $position
|
||||
}
|
||||
|
@ -195,8 +195,8 @@ function global:Enable-PoshTransientPrompt {
|
|||
|
||||
function global:Enable-PoshLineError {
|
||||
$omp = "::OMP::"
|
||||
$validLine = @(&$omp prompt print valid --config="$Env:POSH_THEME" 2>&1) -join "`n"
|
||||
$errorLine = @(&$omp prompt print error --config="$Env:POSH_THEME" 2>&1) -join "`n"
|
||||
$validLine = @(&$omp print valid --config="$Env:POSH_THEME" 2>&1) -join "`n"
|
||||
$errorLine = @(&$omp print error --config="$Env:POSH_THEME" 2>&1) -join "`n"
|
||||
Set-PSReadLineOption -PromptText $validLine, $errorLine
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ function global:Get-PoshThemes() {
|
|||
$themes | ForEach-Object -Process {
|
||||
Write-Host "Theme: $(Get-Hyperlink -uri $_.fullname -name $_.BaseName.Replace('.omp', ''))"
|
||||
Write-Host ""
|
||||
& $omp prompt print primary --config $($_.FullName) --pwd $PWD --shell pwsh
|
||||
& $omp print primary --config $($_.FullName) --pwd $PWD --shell pwsh
|
||||
Write-Host ""
|
||||
Write-Host ""
|
||||
}
|
||||
|
@ -273,6 +273,6 @@ function global:Get-PoshThemes() {
|
|||
Write-Host ""
|
||||
Write-Host "To change your theme, adjust the init script in $PROFILE."
|
||||
Write-Host "Example:"
|
||||
Write-Host " oh-my-posh prompt init pwsh --config $Path/jandedobbeleer.omp.json | Invoke-Expression"
|
||||
Write-Host " oh-my-posh init pwsh --config $Path/jandedobbeleer.omp.json | Invoke-Expression"
|
||||
Write-Host ""
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ export POWERLINE_COMMAND="oh-my-posh"
|
|||
export CONDA_PROMPT_MODIFIER=false
|
||||
|
||||
# set secondary prompt
|
||||
PS2="$(::OMP:: prompt print secondary --config="$POSH_THEME" --shell=zsh)"
|
||||
PS2="$(::OMP:: print secondary --config="$POSH_THEME" --shell=zsh)"
|
||||
|
||||
function prompt_ohmyposh_preexec() {
|
||||
omp_start_time=$(::OMP:: get millis)
|
||||
|
@ -17,7 +17,7 @@ function prompt_ohmyposh_precmd() {
|
|||
omp_now=$(::OMP:: get millis)
|
||||
omp_elapsed=$(($omp_now-$omp_start_time))
|
||||
fi
|
||||
eval "$(::OMP:: prompt print primary --config="$POSH_THEME" --error="$omp_last_error" --execution-time="$omp_elapsed" --stack-count="$omp_stack_count" --eval --shell=zsh)"
|
||||
eval "$(::OMP:: print primary --config="$POSH_THEME" --error="$omp_last_error" --execution-time="$omp_elapsed" --stack-count="$omp_stack_count" --eval --shell=zsh)"
|
||||
unset omp_start_time
|
||||
unset omp_now
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ function self-insert() {
|
|||
zle .self-insert
|
||||
return
|
||||
fi
|
||||
tooltip=$(::OMP:: prompt print tooltip --config="$POSH_THEME" --shell=zsh --command="$BUFFER")
|
||||
tooltip=$(::OMP:: print tooltip --config="$POSH_THEME" --shell=zsh --command="$BUFFER")
|
||||
# ignore an empty tooltip
|
||||
if [[ ! -z "$tooltip" ]]; then
|
||||
RPROMPT=$tooltip
|
||||
|
@ -70,7 +70,7 @@ _posh-zle-line-init() {
|
|||
local -i ret=$?
|
||||
(( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[2]
|
||||
|
||||
eval "$(::OMP:: prompt print transient --error="$omp_last_error" --execution-time="$omp_elapsed" --stack-count="$omp_stack_count" --config="$POSH_THEME" --eval --shell=zsh)"
|
||||
eval "$(::OMP:: print transient --error="$omp_last_error" --execution-time="$omp_elapsed" --stack-count="$omp_stack_count" --config="$POSH_THEME" --eval --shell=zsh)"
|
||||
zle .reset-prompt
|
||||
|
||||
# If we received EOT, we exit the shell
|
||||
|
|
Loading…
Reference in a new issue