Enhanced PowerShell Experience with Terminal-Icons and PSReadLine
The Bearsampp PowerShell module includes powerful enhancements that transform your command-line experience with colorful file icons and advanced editing capabilities.
Terminal-Icons Module
Terminal-Icons adds beautiful, colorful icons to your directory listings, making it easier to identify file types at a glance. The module uses Nerd Font glyphs to display icons for different file types, folders, and special files.
What Terminal-Icons Provides
- File Type Icons - Visual indicators for different file extensions (.ps1, .txt, .jpg, .zip, etc.)
- Folder Icons - Special icons for directories and common folder names (src, docs, config, etc.)
- Color Coding - Different colors for different file types (executables, archives, images, etc.)
- Git Integration - Special icons for .git folders and .gitignore files
Visual Example
When you run ls or Get-ChildItem in PowerShell with Terminal-Icons enabled, you'll see something like this:
PS C:\Projects\MyApp> ls Directory: C:\Projects\MyApp Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 12/15/2024 10:30 AM ? bin d---- 12/15/2024 10:30 AM ? config d---- 12/15/2024 10:30 AM ? docs d---- 12/15/2024 10:30 AM ? src -a--- 12/15/2024 10:25 AM 1234 ? README.md -a--- 12/15/2024 10:25 AM 567 ⚙️ package.json -a--- 12/15/2024 10:25 AM 890 ? app.js -a--- 12/15/2024 10:25 AM 2345 ? styles.css -a--- 12/15/2024 10:25 AM 45678 ? archive.zip -a--- 12/15/2024 10:25 AM 123456 ?️ logo.png
Note: Icons and colors will display correctly when using a Nerd Font like CaskaydiaCove NF in your terminal which is included in our coming prerequisites installer
Supported File Types
Terminal-Icons recognizes hundreds of file types and provides appropriate icons for:
- Programming Languages - .ps1, .js, .py, .java, .cs, .cpp, .go, .rs, .php, etc.
- Web Files - .html, .css, .scss, .json, .xml, .yaml, .md
- Images - .png, .jpg, .gif, .svg, .ico, .bmp
- Archives - .zip, .7z, .tar, .gz, .rar
- Documents - .pdf, .doc, .docx, .xls, .xlsx, .ppt, .pptx
- Configuration - .conf, .ini, .cfg, .env, .properties
- Database - .sql, .db, .sqlite
- And many more...
Usage
Terminal-Icons works automatically with standard PowerShell commands:
# List files in current directory ls Get-ChildItem # List files in specific directory ls C:\Projects Get-ChildItem -Path C:\Projects # List with details ls -Force # Shows hidden files Get-ChildItem -Recurse # Shows files recursively
No special commands needed! Terminal-Icons automatically enhances the output of directory listing commands.
PSReadLine Module
PSReadLine provides advanced command-line editing capabilities, making PowerShell feel more like modern code editors with features like syntax highlighting, predictive IntelliSense, and powerful history search.
Key Features
- Syntax Highlighting - Commands, parameters, and strings are color-coded in real-time
- Predictive IntelliSense - Suggests commands based on your history as you type
- Multi-line Editing - Edit complex commands across multiple lines
- History Search - Quickly find and reuse previous commands
- Undo/Redo - Undo mistakes with Ctrl+Z
- Smart Copy/Paste - Enhanced clipboard operations
Default Keybindings
The Bearsampp PowerShell profile configures PSReadLine with the following keybindings:
Navigation & History
| Keybinding | Function | Description |
| ↑ (Up Arrow) | HistorySearchBackward | Search backward through history matching current input |
| ↓ (Down Arrow) | HistorySearchForward | Search forward through history matching current input |
| Tab | MenuComplete | Show completion menu with all available options |
| Ctrl+R | ReverseSearchHistory | Interactive reverse history search |
| Ctrl+S | ForwardSearchHistory | Interactive forward history search |
| F8 | HistorySearchBackward | Alternative history search backward |
Editing
| Keybinding | Function | Description |
| Ctrl+Z | Undo | Undo last edit |
| Ctrl+Y | Redo | Redo last undone edit |
| Ctrl+A | SelectAll | Select all text on the command line |
| Ctrl+C | Copy / CancelLine | Copy selected text or cancel current line |
| Ctrl+V | Paste | Paste from clipboard |
| Ctrl+X | Cut | Cut selected text to clipboard |
| Backspace | BackwardDeleteChar | Delete character before cursor |
| Delete | DeleteChar | Delete character at cursor |
| Ctrl+Backspace | BackwardKillWord | Delete word before cursor |
| Ctrl+Delete | KillWord | Delete word after cursor |
Movement
| Keybinding | Function | Description |
| Home | BeginningOfLine | Move to beginning of line |
| End | EndOfLine | Move to end of line |
| ← / → | BackwardChar / ForwardChar | Move cursor left/right one character |
| Ctrl+← | BackwardWord | Move cursor back one word |
| Ctrl+→ | ForwardWord | Move cursor forward one word |
Special Functions
| Keybinding | Function | Description |
| Enter | AcceptLine | Execute current command |
| Shift+Enter | AddLine | Add new line for multi-line editing |
| Escape | RevertLine | Revert line to original state |
| Ctrl+L | ClearScreen | Clear the screen |
| Ctrl+Space | MenuComplete | Show completion menu |
| Alt+? | WhatIsKey | Show what a key is bound to |
Syntax Highlighting Colors
The Bearsampp PowerShell profile configures the following color scheme:
- Commands - Green
- Parameters - Gray
- Strings - DarkCyan
Predictive IntelliSense
PSReadLine includes predictive IntelliSense that suggests commands based on your command history. As you type, you'll see ghost text showing a prediction:
PS C:\> Get-ChildItem -Path C:\Projects
Press → (Right Arrow) or End to accept the suggestion.
History Configuration
The Bearsampp PowerShell profile configures PSReadLine with:
- Maximum History - 10,000 commands
- No Duplicates - Duplicate commands are not saved
- Persistent History - History is saved between sessions
- History Search - Cursor moves to end when searching
Font Requirements
To display Terminal-Icons correctly, you need a Nerd Font installed. Bearsampp includes CaskaydiaCove NF (Cascadia Code Nerd Font).
Note: The CaskaydiaCove NF font is automatically installed when you run the Bearsampp prerequisites installer, available at https://github.com/Bearsampp/prerequisites/releases. No manual font installation is required.
Customization
Changing PSReadLine Colors
You can customize the syntax highlighting colors by editing the PowerShell profile:
Set-PSReadLineOption -Colors @{ Command = 'Blue' Parameter = 'Yellow' String = 'Magenta' Operator = 'White' Variable = 'Green' Comment = 'DarkGray' }
Changing PSReadLine Edit Mode
The default edit mode is Windows (similar to cmd.exe). You can change it to Emacs or Vi:
# Emacs mode (Linux-style keybindings) Set-PSReadLineOption -EditMode Emacs # Vi mode (Vim-style keybindings) Set-PSReadLineOption -EditMode Vi
Customizing Terminal-Icons
Terminal-Icons can be customized with themes. To see available themes:
# List available themes Get-TerminalIconsTheme # Set a different theme Set-TerminalIconsTheme -Name # Show current theme Show-TerminalIconsTheme
Automatic Updates
Both Terminal-Icons and PSReadLine are automatically updated to their latest versions during the Bearsampp PowerShell module build process. This ensures you always have the newest features and bug fixes.
The modules are downloaded from the PowerShell Gallery and bundled with the PowerShell installation, so no internet connection is required after installation.
Troubleshooting
Icons Not Displaying
If icons appear as boxes or question marks:
- Verify you're using a Nerd Font (CaskaydiaCove NF)
- Check your terminal's font settings
- Restart your terminal after changing fonts
PSReadLine Not Working
If syntax highlighting or keybindings aren't working:
- Check if PSReadLine is loaded:
Get-Module PSReadLine - Verify the profile is loading:
Test-Path $PROFILE - Check for errors:
$Error[0]
Resetting to Defaults
To reset PSReadLine to default settings:
# Remove custom options Remove-PSReadLineKeyHandler -Chord # Or reload the module Remove-Module PSReadLine Import-Module PSReadLine
Additional Resources
Summary
The combination of Terminal-Icons and PSReadLine transforms PowerShell into a modern, visually appealing, and highly productive command-line environment. With colorful file icons, syntax highlighting, predictive IntelliSense, and powerful editing capabilities, you'll find working in PowerShell more efficient and enjoyable.
Both modules are automatically included and configured in the Bearsampp PowerShell installation, requiring no additional setup beyond ensuring you're using a Nerd Font in your terminal.