Modern text selection and editing for Zsh command line. Select text with Shift + Arrow keys, type-to-replace, paste-to-replace, mouse selection integration, and clipboard integration for copy/cut/paste like in GUI text editors.
- Overview
- Features
- Quick Start
- Installation
- Configuration
- Terminal Setup
- Platform Compatibility
- Key Bindings Reference
- Common Issues - Quick Fixes
- Troubleshooting
- License
- Acknowledgments
- References
Zsh Edit-Select brings familiar text editor behaviors to your Zsh command line:
- ✅ Shift selection — Select text using Shift + Arrow keys
- ✅ Type-to-replace — Type over selected text to replace it
- ✅ Paste-to-replace — Paste clipboard content over selections
- ✅ Mouse integration — Works with text selected by mouse
- ✅ Clipboard integration — Works with X11 and Wayland
- ✅ Standard shortcuts — Ctrl+A (select all), Ctrl+C (copy), Ctrl+X (cut), Ctrl+V (paste)
Ready to Use: The plugin works immediately after installation with sensible defaults. Use the command
edit-select configto customize clipboard backend, mouse behavior, and keybindings.
Select text using familiar keyboard shortcuts:
| Shortcut | Action |
|---|---|
| Shift + ←/→ | Select character by character |
| Shift + ↑/↓ | Select line by line |
| Shift + Home/End | Select to line start/end |
| Shift + Ctrl + ←/→ | Select word by word |
| Ctrl + A | Select all text (including multi-line commands) |
The plugin intelligently integrates mouse selections:
When Mouse Replacement is Enabled (default):
- ✅ Copy mouse selections with Ctrl+C
- ✅ Cut mouse selections with Ctrl+X
- ✅ Type to replace mouse selections
- ✅ Delete mouse selections with Backspace
- ✅ Paste over mouse selections with Ctrl+V
When Mouse Replacement is Disabled:
- ✅ Copy mouse selections with Ctrl+C (still works)
- ❌ Other operations only work with keyboard selections
Note: Configure mouse behavior with
edit-select config→ Option 2
⚠️ Important Note on Mouse Selection: If your command contains multiple occurrences of the exact same selected text, mouse selection will replace/delete the first matching occurrence in the buffer—not necessarily the one you visually selected. For more reliable selection, especially with duplicate text, use Shift + Arrow keys instead of mouse selection.
Type or paste while text is selected to replace it automatically.
Works with both keyboard and mouse selections (when mouse replacement is enabled).
Standard editing shortcuts:
- Ctrl + C (or Ctrl+Shift+C): Copy selected text
- Ctrl + X: Cut selected text
- Ctrl + V: Paste (replaces selection if any)
The plugin automatically detects your display server:
| Display Server | Tools Used |
|---|---|
| Wayland | wl-copy / wl-paste |
| X11 | xclip |
| macOS | pbcopy / pbpaste |
Oh My Zsh: (for other plugin managers check Installation)
git clone https://github.com/Michael-Matta1/zsh-edit-select.git \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-edit-selectAdd to your .zshrc:
plugins=(... zsh-edit-select)Manual:
git clone https://github.com/Michael-Matta1/zsh-edit-select.git \
~/.local/share/zsh/plugins/zsh-edit-select
# Add to ~/.zshrc:
source ~/.local/share/zsh/plugins/zsh-edit-select/zsh-edit-select.plugin.zshWayland:
# Debian/Ubuntu
sudo apt install wl-clipboard
# Arch Linux
sudo pacman -S wl-clipboard
# Fedora
sudo dnf install wl-clipboardX11:
# Debian/Ubuntu
sudo apt install xclip
# Arch Linux
sudo pacman -S xclip
# Fedora
sudo dnf install xclipSome terminals need configuration to support Shift selection. See Terminal Setup for details.
source ~/.zshrcImportant: You may need to fully close and reopen your terminal (not just source ~/.zshrc) for all features to work correctly, especially in some terminal emulators.
You're ready! Try selecting text with Shift + Arrow keys.
The plugin works immediately with sensible defaults, but you can customize:
- Clipboard backend (Wayland/X11/auto-detect)
- Mouse replacement behavior
- Keybindings (Ctrl+A, Ctrl+V, Ctrl+X)
Run the interactive configuration wizard:
edit-select configOh My Zsh
- Clone the repository:
git clone https://github.com/Michael-Matta1/zsh-edit-select.git \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-edit-select- Add to your
.zshrc:
plugins=(
# ... other plugins
zsh-edit-select
)- Restart your terminal or run:
source ~/.zshrczgenom
Add to your .zshrc:
zgenom load Michael-Matta1/zsh-edit-selectsheldon
Run:
sheldon add zsh-edit-select --github Michael-Matta1/zsh-edit-selectManual Installation
- Clone the repository:
git clone https://github.com/Michael-Matta1/zsh-edit-select.git \
~/.local/share/zsh/plugins/zsh-edit-select- Add to your
.zshrc:
source ~/.local/share/zsh/plugins/zsh-edit-select/zsh-edit-select.plugin.zsh- Restart your terminal or run:
source ~/.zshrcLaunch the interactive configuration wizard:
edit-select configThe wizard provides:
- Clipboard Integration — Choose Wayland, X11, or auto-detect
- Mouse Replacement — Enable/disable mouse selection integration
- Key Bindings — Customize Ctrl+A, Ctrl+V, Ctrl+X shortcuts
- View Configuration — See current settings
- Reset to Defaults — Restore factory settings
All changes are saved to ~/.config/zsh-edit-select/config and persist across sessions.
Configure how the plugin handles mouse selections:
Enabled (default):
- Full integration: type, paste, cut, and delete work with mouse selections
- Best for users who want seamless mouse+keyboard workflow
Disabled:
- Mouse selections can be copied with Ctrl+C
- Typing, pasting, cutting, and deleting only work with keyboard selections
- Best for users who prefer strict keyboard-only editing
Change the mode:
edit-select config # → Option 2: Mouse ReplacementNote: If you have mouse replacement enabled, the repositioning of the text cursor (caret) when clicking with the mouse may become slower on some systems when working with long multi-line commands (typically more than 5 lines). If you care more about fast mouse-click cursor positioning than about the mouse-replacement feature, you can disable mouse replacement using the wizard.
The plugin auto-detects your clipboard backend, but you can override it:
Auto-detect (recommended): Automatically uses the right tool for your display server.
Note: If no clipboard tool is detected, the plugin will still work for text selection and keyboard-based operations, but copy/cut/paste will be disabled.
Manual configuration:
edit-select config # → Option 1: Clipboard IntegrationChoose:
- Wayland — Uses
wl-copy/wl-paste - X11 — Uses
xclip
Customize the main editing shortcuts:
edit-select config # → Option 3: Key BindingsDefault bindings:
- Ctrl + A — Select all
- Ctrl + V — Paste
- Ctrl + X — Cut
Alternative presets:
- Ctrl + Shift + A/V/X — For terminals with Kitty protocol
- Custom — Enter your own key sequences
⚠️ Important: When using custom keybindings (especially with Shift modifiers), you may need to configure your terminal emulator to send the correct escape sequences.
For Kitty:
If you want to use Ctrl + Shift + X for cut, add this to your kitty.conf:
map ctrl+shift+x send_text all \x1b[88;6u
For Other Terminals:
- WezTerm — Use similar key remapping in
wezterm.lua - Alacritty — Use key bindings in
alacritty.yml - VS Code Terminal — Add to
keybindings.json
⚠️ CRITICAL: Before adding these mappings, you MUST remove or comment out any existingctrl+shift+cmappings in your terminal config (such asmap ctrl+shift+c copy_to_clipboardin Kitty). These will conflict and prevent the plugin from working correctly.
To use Ctrl + Shift + C for copying, add the following to your kitty.conf:
map ctrl+shift+c send_text all \x1b[67;6u
If you prefer to use Ctrl + C for copying (like in GUI applications) and Ctrl + Shift + C for interrupt:
# Ctrl+C sends the escape sequence for copying
map ctrl+c send_text all \x1b[67;6u
# Ctrl+Shift+C sends interrupt (default behavior)
map ctrl+shift+c send_text all \x03
For Other Terminals:
- WezTerm — Use similar key remapping in
wezterm.lua - Alacritty — Use key bindings in
alacritty.yml
If your terminal doesn't support key remapping, you can add the following to your ~/.zshrc to use Ctrl +
/ for copying:
x-copy-selection () {
if [[ $MARK -ne $CURSOR ]]; then
local start=$(( MARK < CURSOR ? MARK : CURSOR ))
local length=$(( MARK > CURSOR ? MARK - CURSOR : CURSOR - MARK ))
local selected="${BUFFER:$start:$length}"
print -rn "$selected" | xclip -selection clipboard
fi
}
zle -N x-copy-selection
bindkey '^_' x-copy-selectionYou can change the keybinding to any key you prefer. For example, to use Ctrl + K:
bindkey '^K' x-copy-selectionNote: The
^_sequence represents Ctrl + / (Ctrl + Slash), and^Krepresents Ctrl + K. You can find other key sequences by runningcatin your terminal and pressing the desired key combination.
Bonus Feature: If no text is selected, this manual keybinding will copy the entire current line to the clipboard.
Some terminals intercept Shift key combinations by default. Here's how to configure popular terminals:
Add to kitty.conf:
# Enable Shift selection
map ctrl+shift+left no_op
map ctrl+shift+right no_op
map ctrl+shift+home no_op
map ctrl+shift+end no_op
Add to wezterm.lua:
return {
keys = {
{ key = 'LeftArrow', mods = 'CTRL|SHIFT', action = 'DisableDefaultAssignment' },
{ key = 'RightArrow', mods = 'CTRL|SHIFT', action = 'DisableDefaultAssignment' },
},
}The escape sequences used follow the ANSI/VT terminal protocol.
Add to keybindings.json:
[
{
// Make Ctrl+C sends copy sequence to terminal (CSI 67 ; 6 u)
"key": "ctrl+c",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "\u001b[67;6u" },
"when": "terminalFocus"
},
{
// Make Ctrl+Shift+C sends interrupt signal (ETX control character)
// This is equivalent to the traditional Ctrl+C interrupt behavior
"key": "ctrl+shift+c",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "\u0003" },
"when": "terminalFocus"
},
{
"key": "ctrl+shift+left",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "\u001b[1;6D" },
"when": "terminalFocus"
},
{
"key": "ctrl+shift+right",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "\u001b[1;6C" },
"when": "terminalFocus"
}
]Alacritty doesn't need a tweak to enable Shift/Shift+Ctrl selection, but you will need to configure the copy shortcuts for the clipboard the same as the other terminals.
To check what your terminal sends:
- Run
cat(without arguments) - Press the key combination
- The terminal will display the escape sequence
Use this sequence for custom keybindings in the configuration wizard and replace the "text" values in the configuration of VS Code Terminal.
The Mouse Selection Replacement feature (automatically detecting and replacing mouse-selected text) has varying support across platforms:
- X11 - Complete PRIMARY selection support (recommended for best experience)
- wlroots-based Wayland compositors - Sway, Hyprland, River, Wayfire
- KDE Plasma Wayland - Full PRIMARY selection support
- GNOME Wayland (Mutter) - No PRIMARY selection support
- macOS - No PRIMARY selection concept in the system
- Other Wayland compositors - Support varies
For the most stable and robust experience with all plugin features, X11 is recommended. While Wayland support is improving, PRIMARY selection implementation is inconsistent across compositors.
If Mouse Selection Replacement doesn't work on your platform, disable it with edit-select config → Option 2.
This plugin has been thoroughly and heavily tested on Kitty Terminal on X11 and briefly on other popular terminals.
If you encounter issues on other terminals or platforms, please open an issue with your terminal name, OS, and display server.
These features work universally regardless of platform:
- ✅ Shift+Arrow keys for text selection
- ✅ Ctrl+A (Cmd+A) to select all
- ✅ Ctrl+C (Cmd+C) to copy
- ✅ Ctrl+X (Cmd+X) to cut keyboard selection
- ✅ Ctrl+V (Cmd+V) to paste
- ✅ Delete/Backspace to remove keyboard selection
- ✅ Type or paste to replace keyboard selection
| Key Combination | Action |
|---|---|
| Shift + ← | Select one character left |
| Shift + → | Select one character right |
| Shift + ↑ | Select one line up |
| Shift + ↓ | Select one line down |
| Shift + Home | Select to line start |
| Shift + End | Select to line end |
| Shift + Ctrl + ← | Select to word start |
| Shift + Ctrl + → | Select to word end |
| Ctrl + A | Select all text |
macOS: Use Shift + Option instead of Shift + Ctrl for word navigation
| Key Combination | Action |
|---|---|
| Ctrl + C | Copy selected text |
| Ctrl + X | Cut selected text |
| Ctrl + V | Paste (replaces selection if any) |
| Delete | Delete selected text (selection mode only) |
| Backspace | Delete selected text (selection mode only) |
| Any character | Replace selected text |
| Problem | Quick Fix |
|---|---|
| Shift selection doesn't work | Configure your terminal (see Terminal Setup) |
| Copy doesn't work | Install clipboard tool: wl-clipboard or xclip |
| Mouse replacement slow | Disable it: edit-select config → Option 2 |
| Ctrl+C copies instead of interrupting | Remap in terminal to use Ctrl+Shift+C for copy |
| Can't paste with Ctrl+V | Check terminal keybinding conflicts or use config wizard |
| Configuration wizard doesn't launch | Check plugin installation and file permissions |
Solution: Configure your terminal to pass Shift key sequences. See Terminal Setup.
Verify: Run cat and press Shift+Left. You should see an escape sequence like ^[[1;2D.
Solution: Install the required clipboard tool:
- Wayland:
wl-clipboard - X11:
xclip
Verify: Run wl-copy <<< "test" or xclip -i <<< "test" to check if the tool works.
Solution:
- Check if mouse replacement is enabled:
edit-select config→ View Configuration - Ensure your terminal supports mouse selection (most do)
- Try selecting text with your mouse, then typing—it should replace the selection
If Backspace (or Delete) does not remove a mouse-selected region, this is often due to platform limitations with PRIMARY selection (or lack thereof on macOS). Try one of the following:
- Disable Mouse Replacement:
edit-select config→ Option 2, or setEDIT_SELECT_MOUSE_REPLACEMENT=disabledin your config file. - Use Shift + Arrow keys for selection, which the plugin fully supports.
Solution: Configure your terminal to remap Ctrl+C. See Kitty or VS Code Terminal sections.
Alternative: Use Ctrl+Shift+C for copying, or configure a custom keybinding with edit-select config, or
use the 'Without Terminal Remapping' method if your terminal doesn't support key remapping.
Symptoms: Running edit-select config shows "file not found" error
Solution:
- Check the plugin was installed correctly
- Verify
edit-select-wizard.zshexists in the plugin directory - Ensure the file has read permissions:
chmod +r ~/.oh-my-zsh/custom/plugins/zsh-edit-select/edit-select-wizard.zsh - Try sourcing your
.zshrcagain:source ~/.zshrc - Fully close and reopen your terminal
This project is licensed under the MIT License.
Began as a fork (Michael-Matta1/zsh-shift-select) of jirutka/zsh-shift-select to add the ability to copy selected text, because the jirutka/zsh-shift-select plugin only supported deleting selected text and did not offer copying by default.
This feature was frequently requested by the community, as shown in issue #8 and issue #10.
Since then, the project has evolved with its own new features, enhancements, bug fixes, design improvements, and a fully changed codebase, and it now provides a full editor-like experience.
