{"id":15063354,"url":"https://github.com/jirutka/zsh-shift-select","last_synced_at":"2025-06-20T02:37:44.163Z","repository":{"id":48964914,"uuid":"462445126","full_name":"jirutka/zsh-shift-select","owner":"jirutka","description":"Select text in Zsh command line using Shift, as in many text editors and GUI programs","archived":false,"fork":false,"pushed_at":"2022-07-28T22:29:27.000Z","size":417,"stargazers_count":151,"open_issues_count":8,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-08T20:34:51.114Z","etag":null,"topics":["shift-select","zle-widgets","zsh","zsh-plugin"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jirutka.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-22T19:29:42.000Z","updated_at":"2025-05-29T10:16:42.000Z","dependencies_parsed_at":"2022-09-04T23:01:54.734Z","dependency_job_id":null,"html_url":"https://github.com/jirutka/zsh-shift-select","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jirutka/zsh-shift-select","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fzsh-shift-select","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fzsh-shift-select/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fzsh-shift-select/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fzsh-shift-select/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jirutka","download_url":"https://codeload.github.com/jirutka/zsh-shift-select/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jirutka%2Fzsh-shift-select/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260867710,"owners_count":23074913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["shift-select","zle-widgets","zsh","zsh-plugin"],"created_at":"2024-09-24T23:55:34.817Z","updated_at":"2025-06-20T02:37:39.143Z","avatar_url":"https://github.com/jirutka.png","language":"Shell","funding_links":[],"categories":["Plugins","Shell"],"sub_categories":["ZSH on Windows"],"readme":"= Zsh Shift Select Mode\n:proj-name: zsh-shift-select\n:gh-name: jirutka/{proj-name}\n// Enable kbd:[] macro\n:experimental:\n\nEmacs https://www.gnu.org/software/emacs/manual/html_node/emacs/Shift-Selection.html[shift-select mode] for Zsh – select text in the command line using kbd:[Shift] as in many text editors, browsers and other GUI programs.\n\nThis plugin does not override any existing widgets and binds only **shift**ed keys (see \u003c\u003cKey Bindings\u003e\u003e).\nIt creates a new `shift-select` keymap that is automatically activated when the shift selection is invoked (using any of the defined **shift**ed keys) and deactivated (the current keymap switches back to `main`) on any key that is not defined in the `shift-select` keymap.\nThanks to this approach, it does not interfere with other plugins (for example, it works with https://github.com/zsh-users/zsh-autosuggestions[zsh-autosuggestions] without any change).\n\nKey bindings for moving the cursor _without_ selection (e.g. kbd:[Ctrl] + arrows, kbd:[Home] etc.) are out of scope of this plugin.footnote:[You can take inspiration from https://github.com/jirutka/alpine-zsh-config/blob/master/zshrc.d/50-key-bindings.zsh[key bindings in alpine-zsh-config].]\nSo is synchronization with the system clipboard.footnote:[For an example, see https://github.com/jirutka/alpine-zsh-config/blob/master/zshrc.d/70-clipboard.zsh[clipboard integration in alpine-zsh-config].]\n\nimage::media/demo.gif[Example of using zsh-shift-select]\n\n\n== Key Bindings\n\n=== List of keys defined in the `emacs` and `shift-select` keymap:\n\n* kbd:[Shift + Left Arrow] – select one character to the left\n* kbd:[Shift + Right Arrow] – select one character to the right\n* kbd:[Shift + Up Arrow] – select one line up\n* kbd:[Shift + Down Arrow] – select one line down\n* kbd:[Shift + Home] or kbd:[Shift + Ctrl + A] – select to the beginning of a line\n* kbd:[Shift + End] or kbd:[Shift + Ctrl + E] – select to the end of a line\n* kbd:[Shift + Ctrl + Left Arrow] ^\u003c\u003cmacos\u003e\u003e^ – select to the beginning of a word\n* kbd:[Shift + Ctrl + Right Arrow] ^\u003c\u003cmacos\u003e\u003e^ – select to the end of a word\n* kbd:[Shift + Ctrl + Home] ^\u003c\u003cmacos\u003e\u003e^ – select to the beginning of an input buffer\n* kbd:[Shift + Ctrl + End] ^\u003c\u003cmacos\u003e\u003e^ – select to the end of an input buffer\n\n[[macos, ]]\n_^^ The last four actions use kbd:[Shift + Option] instead of kbd:[Shift + Ctrl] on macOS._\n\n\n=== List of keys defined in the `shift-select` keymap only:\n\n* kbd:[Delete] or kbd:[Backspace] – delete selected text\n\nIf you want to add custom key bindings to manipulate with active selection, define them in the `shift-select` keymap (`bindkey -M shift-select ...`).\n\nTIP: You can use default kbd:[Alt + W] or kbd:[Ctrl + W] key bindings to copy (`copy-region-as-kill`) or cut (`backward-kill-word`) selected text to the “kill buffer”, and kbd:[Ctrl + Y] to paste (`yank`) the contents of the “kill buffer”.\n\n\n== Terminals Compatibility\n\nSome keys may not work in your terminal by default.\nTo find out if this is the case, run `cat` (without any arguments) in your terminal and press the key sequence in question.\nIf nothing is printed, it means that your terminal or operating system has intercepted the key sequence.\n\nThis plugin has been tested in the following terminals:\n\n|===\n| Terminal  | State\n\n| Alacritty | ✔️ works out-of-box\n| Kitty     | ⚙️ kbd:[Shift + Ctrl] doesn’t work out-of-box, apply \u003c\u003cKitty, fix\u003e\u003e\n| WezTerm   | ⚙️ kbd:[Shift + Ctrl + arrows] doesn’t work out-of-box, apply \u003c\u003cWezTerm, fix\u003e\u003e\n|===\n\n\n=== Kitty\n\nhttps://sw.kovidgoyal.net/kitty/[Kitty] uses kbd:[Shift + Ctrl] as the modifier for all its shortcuts (https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.kitty_mod[kitty_mod]) by default.\nAdd the following snippet to your `kitty.conf` to unmap the key strokes used by this plugin.\n\n[source]\n----\n# Don't intercept the following key strokes to make zsh-shift-select work.\nmap ctrl+shift+left no_op\nmap ctrl+shift+right no_op\nmap ctrl+shift+home no_op\nmap ctrl+shift+end no_op\n----\n\n\n=== WezTerm\n\nhttps://wezfurlong.org/wezterm/[WezTerm] uses kbd:[Shift + Ctrl + Left Arrow] and kbd:[Shift + Ctrl + Right Arrow] to activate a pane in the left and right direction, respectively (see https://wezfurlong.org/wezterm/config/default-keys.html[Default Key Assignments] in the docs).\nIf you want to use these keys in Zsh instead, you can disable the default assignments in your `wezterm.lua`:\n\n[source, lua]\n----\nreturn {\n  keys = {\n    { key = 'LeftArrow', mods = 'CTRL|SHIFT', action = 'DisableDefaultAssignment' },\n    { key = 'RightArrow', mods = 'CTRL|SHIFT', action = 'DisableDefaultAssignment' },\n  },\n}\n----\n\n\n== Installation\n\n=== Using sheldon\n\nIf you use https://github.com/rossmacarthur/sheldon[sheldon] plugin manager, run the following command:\n\n[source, sh, subs=\"+attributes\"]\nsheldon add {proj-name} --github {gh-name}\n\n\n=== Using zgenom\n\nIf you use https://github.com/jandamm/zgenom[zgenom] (successor of https://github.com/tarjoilija/zgen[zgen]) plugin manager, add `zgenom load \"{gh-name}\"` to your `.zshrc`.\n\n\n=== Using Oh My Zsh\n\nIf you use https://github.com/ohmyzsh/ohmyzsh[Oh My Zsh] framework:\n\n. Clone this repository into `$ZSH_CUSTOM/plugins` (by default `~/.oh-my-zsh/custom/plugins`):\n+\n[source, sh, subs=\"+attributes\"]\ngit clone https://github.com/{gh-name}.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/{proj-name}\n\n. Add the plugin to the list of plugins for Oh My Zsh to load (inside `$ZDOTDIR/.zshrc`, by default `~/.zshrc`):\n+\n[source, sh, subs=\"+attributes\"]\nplugins=(\n    # other plugins...\n    {proj-name}\n)\n\n. Start a new terminal session.\n\n\n=== On Alpine Linux\n\nIf you use https://alpinelinux.org/[Alpine Linux] v3.16+ or Edge, you can install {proj-name} via `apk` and load it using the plugin loader provided in the default Zsh configuration on Alpine (see `/etc/zsh/zshrc`).\n\n. Install {proj-name} package (as root).\n[source, sh, subs=\"+attributes\"]\napk add {proj-name}\n\n. Symlink {proj-name} plugin to your Zsh plugins directory footnote:[Alternatively, you can add `ZSH_LOAD_SYSTEM_PLUGINS=yes` to your `.zshenv` to automatically load all Zsh plugins installed from Alpine packages.]:\n[source, sh, subs=\"+attributes\"]\nmkdir -p ~/.local/share/zsh/plugins\nln -s /usr/share/zsh/plugins/{proj-name} ~/.local/share/zsh/plugins/\n\n\n=== Manually (Git Clone)\n:plugin-dir: ~/.local/share/zsh/plugins/{proj-name}\n\n. Clone this repository somewhere on your machine. This guide will assume `{plugin-dir}`.\n+\n[source, sh, subs=\"+attributes\"]\ngit clone https://github.com/{gh-name} {plugin-dir}\n\n. Add the following to your `$ZDOTDIR/.zshrc` (by default `~/.zshrc`):\n+\n[source, sh, subs=\"+attributes\"]\nsource {plugin-dir}/{proj-name}.plugin.zsh\n\n. Start a new terminal session.\n\n\n== References\n\n* https://stackoverflow.com/questions/5407916/zsh-zle-shift-selection[Zsh zle shift selection – StackOverflow] (the first inspiration, but the used approach is different)\n* https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html[Zsh Line Editor]\n\n\n== License\n\nThis project is licensed under http://opensource.org/licenses/MIT/[MIT License].\nFor the full text of the license, see the link:LICENSE[LICENSE] file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjirutka%2Fzsh-shift-select","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjirutka%2Fzsh-shift-select","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjirutka%2Fzsh-shift-select/lists"}