Ctrl+l works in powershell but NOT in conda powershell

Viewed 18

The exception that I got is the following

Exception:
System.IO.IOException: The parameter is incorrect.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.Console.SetWindowPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
-----------------------------------------------------------------------

Expected behavior is that ctrl+l is equivalent the command clear, i.e. the screen is cleared and the prompt is located in the top of the terminal window. Running on Windows 10, Miniconda 64 bit.

1 Answers

As suggested in the comments, try re-binding the Ctrl+l key handler to a custom scriptblock that simply executes Clear-Host (of which clear is an alias):

Set-PSReadLineKeyHandler -Chord 'Ctrl+l' -ScriptBlock { Clear-Host }
Related