Camel Humps for Navigation, Selection and Deletion by vollsynthetik · Pull Request #3734 · PowerShell/PSReadLine · GitHub
Skip to content

Camel Humps for Navigation, Selection and Deletion - #3734

Open
Ralf Rastlos (vollsynthetik) wants to merge 3 commits into
PowerShell:masterfrom
Darkstar-GmbH:humps
Open

Ralf Rastlos (vollsynthetik) wants to merge 3 commits into
PowerShell:masterfrom
Darkstar-GmbH:humps

Conversation

@vollsynthetik

@vollsynthetik Ralf Rastlos (vollsynthetik) commented Jul 5, 2023 •

Copy link
Copy Markdown

Summary

This PR adds the capabilities of CamelHumps navigation, selection and deletion. At default, all new functions are unbound (opt-in). It is up to the user to bind these functions by replacing the word-based equivalents or by binding to unbound keys.

Overview

The following functions are added:

  • Navigation (CursorMovement)
    • ForwardHump
    • BackwardHump
  • Selection (Selection)
    • SelectForwardHump
    • SelectBackwardHump
  • Deletion (Basic)
    • BackwardKillHump

These work pretty much like their word-based counterparts, but the navigate, select, delete camel humps instead. Camel humps are sub words written by starting in-word uppercase letter, e.g., SelectForwardHump.

Configuration

This gives instructions on how to replace the word-based navigation, selection and deletion by hump-based ones:

Set-PSReadLineKeyHandler -Chord Ctrl+RightArrow -Function ForwardHump

Set-PSReadLineKeyHandler -Chord Ctrl+LeftArrow -Function BackwardHump

Set-PSReadLineKeyHandler -Chord Ctrl+Shift+RightArrow -Function SelectForwardHump

Set-PSReadLineKeyHandler -Chord Ctrl+Shift+LeftArrow -Function SelectBackwardHump

Set-PSReadLineKeyHandler -Chord Ctrl+Backspace -Function BackwardKillHump

Of course all of these functions can be bound to any other desired keys and key combinations.

Microsoft Reviewers: Open in CodeFlow

@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

@vollsynthetik

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant