Would it be possible to expose TRANSIENT and FTCS MARKS variables to have profile override of OhMyPoshKeyHandler events? #4932
JayLCypher
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
@JayLCypher the handlers enable functionality and aren't meant to extend (at least not in the current design). You can actually override the current handler with whatever logic you want to add. Initialise oh-my-posh, then create your own handler based on the one we defined. The Set-PSReadLineKeyHandler -Key Enter -BriefDescription 'OhMyPoshEnterKeyHandler' -ScriptBlock {
$executingCommand = $false
try {
$parseErrors = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$null, [ref]$null, [ref]$parseErrors, [ref]$null)
$executingCommand = $parseErrors.Count -eq 0
}
finally {}
[Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
# Write FTCS_COMMAND_EXECUTED after accepting the input - it should still happen before execution
if ($executingCommand) {
Write-Host "$([char]0x1b)]133;C`a" -NoNewline
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I've become addicted to a feature in my Linux distro terminal where I can just write paths directly without needing to cd everywhere.
Sorely missing when zooming in my Terminal on Windows.
I notice you've set up a few OhMyPoshKeyHandlers, however I don't see a way to safely override them keeping their behavior. The ::TRANSIENT:: and ::FTCS_MARKS:: variables are apparently dynamically overwritten on initialization? And there doesn't seem a way to access those variables from outside the omp.ps1 script (at least to my limited knowledge).
So I can only pick one of the Enter KeyHandlers.
Maybe I've been wasting time by trying, still don't fully understand what the event handlers does, but exposing some way to extend the handlers (if they are useful) would be appreciated.
Thanks for any consideration.
Beta Was this translation helpful? Give feedback.
All reactions