From 2894bc5798511151b7cd09fdb387032bb6f9c13a Mon Sep 17 00:00:00 2001 From: Jason Shirk Date: Mon, 13 May 2013 09:04:56 -0700 Subject: [PATCH] Add useful information to readme. --- README.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2661107..8f50dbf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,62 @@ PSReadLine ========== -A bash inspiried readline implementation for PowerShell +This module replaces the command line editing experience in PowerShell.exe. +It provides: + +* Syntax coloring +* Simple syntax error notification +* A better multi-line experience (both editing and history) +* Customizable key bindings +* Cmd and emacs modes (neither are fully implemented yet, but both are usable) +* Many configuration options +* Bash style completion (optional in Cmd mode, default in Emacs mode) +* Emacs yank/kill ring +* PowerShell token based "word" movement and kill + +Many planned features are not yet implemented, but in it's current state, the module is very usable. + +The "out of box" experience is meant to be very familiar to PowerShell.exe users - there should be no need to learn any new key strokes. + +Usage +===== + +To start using, just import the module: + +'''powershell +Import-Module PSReadLine +''' + +To use Emacs key bindings, you can use: + +'''powershell +Set-PSReadlineOption -EditMode Emacs +''' + +There are many configuration options, see the options to Set-PSReadlineOption. At some point I'll actually write some documentation. + +To set your own custom keybindings, use the cmdlet Set-PSReadlineKeyHandler. For example, for a better history experience, try: + +'''powershell +Set-PSReadlineKeyHandler -Key ([PSConsoleUtilities.Keys]::UpArrow) -Handler { + [PSConsoleUtilities.PSConsoleReadLine]::HistorySearchBackward() } +Set-PSReadlineKeyHandler -Key ([PSConsoleUtilities.Keys]::DownArrow) -Handler { + [PSConsoleUtilities.PSConsoleReadLine]::HistorySearchForward() } +''' + +With these bindings, up arrow/down arrow will work like PowerShell/cmd if the current command line is blank. If you've entered some text though, it will search the history for commands that start with the currently entered text. + +To enable bash style completion without using Emacs mode, you can use: + +'''powershell +Set-PSReadlineKeyHandler -Key ([PSConsoleUtilities.Keys]::Tab) -Handler { + [PSConsoleUtilities.PSConsoleReadLine]::Complete() } +''' + +See the public methods of [PSConsoleUtilities.PSConsoleReadLine] to see what other built-in functionality you can modify. + +If you want to change the command line in some unimplmented way in your custom key binding, you can use the methods: + +* [PSConsoleUtilities.PSConsoleReadLine]::GetBufferState +* [PSConsoleUtilities.PSConsoleReadLine]::SetBufferState +