If I have a commandline like this:
sunday.exe monday tuesday-wednesday
I would like to delete to the last space, or essentially the last argument. I tried Ctrl + Backspace
, but it deletes only to the first hyphen. Is this possible?
If I have a commandline like this:
sunday.exe monday tuesday-wednesday
I would like to delete to the last space, or essentially the last argument. I tried Ctrl + Backspace
, but it deletes only to the first hyphen. Is this possible?
To view current delimiters:
(get-PSReadLIneOption).WordDelimiters
To remove the "-" character (current session):
(get-PSREadLIneOption).WordDelimiters = (get-PSREadLIneOption).WordDelimiters -replace '-'
To restore defaults:
(get-PSREadLIneOption).WordDelimiters = @'
;:,.[]{}()/\|^&*-=+'"–—―
'@
Not something native in PowerShell.
You'd have to mess with PSReadline customizations.
about_PSReadLine
BackwardWord
Move the cursor back to the start of the current word, or if between words, the start of the previous word. Word boundaries are defined by a configurable set of characters.
Cmd: <Ctrl+LeftArrow> Emacs: <Alt+b>, <Escape,b> Vi insert mode: <Ctrl+LeftArrow> Vi command mode: <Ctrl+LeftArrow>
And remember that PSReadline is only a consolehost thing, not the ISE or VSCode which would require separate configuration or add-on.