diff --git a/docs/docs/configuration/tooltips.mdx b/docs/docs/configuration/tooltips.mdx index 218bc853..a9b6af38 100644 --- a/docs/docs/configuration/tooltips.mdx +++ b/docs/docs/configuration/tooltips.mdx @@ -49,9 +49,9 @@ You need to extend or create a custom theme with your tooltips. For example: } ``` -This configuration will render a right-aligned git segment when you type `git` or `g` followed by a space. Keep in mind that -this is a blocking call, meaning that if the segment renders slow, you can't type until it's visible. Optimizations in this space -are being explored. +This configuration will render a right-aligned git segment when you type `git` or `g` followed by a space. +A tip should not include any leading or trailing space but an interpolated one can be used, e.g., `g s`. +Keep in mind that this is a blocking call, meaning that if the segment renders slow, you can't type until it's visible. Optimizations in this space are being explored. ## Enable the feature diff --git a/src/shell/scripts/omp.ps1 b/src/shell/scripts/omp.ps1 index 0105c98f..adbcc806 100644 --- a/src/shell/scripts/omp.ps1 +++ b/src/shell/scripts/omp.ps1 @@ -88,7 +88,6 @@ New-Module -Name "oh-my-posh-core" -ScriptBlock { $command = $null $cursor = $null [Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$command, [ref]$cursor) - $command = ($command -split " ")[0] $standardOut = @(Start-Utf8Process $script:OMPExecutable @("print", "tooltip", "--pwd=$cleanPWD", "--pswd=$cleanPSWD", "--config=$env:POSH_THEME", "--command=$command", "--shell-version=$script:PSVersion")) Write-Host $standardOut -NoNewline $host.UI.RawUI.CursorPosition = $position diff --git a/src/shell/scripts/omp.zsh b/src/shell/scripts/omp.zsh index 59ae080b..08d7fe39 100644 --- a/src/shell/scripts/omp.zsh +++ b/src/shell/scripts/omp.zsh @@ -42,7 +42,7 @@ if [ "$TERM" != "linux" ]; then _install-omp-hooks fi -function self-insert() { +function _render_tooltip() { # ignore an empty buffer if [[ -z "$BUFFER" ]]; then zle .self-insert @@ -58,7 +58,8 @@ function self-insert() { } function enable_poshtooltips() { - zle -N self-insert + zle -N _render_tooltip + bindkey " " _render_tooltip } _posh-zle-line-init() {