|
1 | | -# `ZSH-EDITING-WORKBENCH` |
| 1 | +<h1 align="center"> |
| 2 | + <a href="https://github.com/z-shell/zi"> |
| 3 | + <img align="center" src="https://github.com/z-shell/zi/raw/main/docs/images/logo.png" alt="Logo" width="60px" height="60px" /> |
| 4 | + </a> ❮ Zsh Editing Workbench ❯ |
| 5 | +</h1> |
| 6 | +<h2 align="center"> |
| 7 | + <p> <samp><code>ZEW</code></samp> provides organized key bindings for various command line editing features. </p> |
| 8 | + <p> Original features are used to make user not depart from mainstream Zsh. </p> |
| 9 | +</h2> |
2 | 10 |
|
3 | | -## Introduction |
| 11 | +<!-- <p><img align="center" src="https://raw.githubusercontent.com/z-shell/z-a-rust/main/docs/images/annex-rust.gif" alt="Zi annex rust" width="100%" height="auto" /></p> --> |
4 | 12 |
|
5 | | -Organized shortcuts for various command line editing operations, plus new |
6 | | -operations (e.g. incremental history word completion). |
| 13 | +<div align="center"></div> |
7 | 14 |
|
8 | | -Incremental history _word_ completing (started with `Alt-h/H` or `Option-h/H` on Mac): |
| 15 | +## 💡 Wiki: [ZEW](https://wiki.zshell.dev/ecosystem/plugins/zsh-editing-workbench) - [Plugins](https://wiki.zshell.dev/ecosystem/category/%EF%B8%8F-plugins) |
9 | 16 |
|
10 | | -## Installation With [Zinit](https://github.com/z-shell/zinit) |
| 17 | +Organized shortcuts for various command line editing operations, plus new operations (e.g. incremental history word completion). |
11 | 18 |
|
12 | | -Add `zinit load z-shell/zsh-editing-workbench` to `.zshrc`. The config files will be available in `~/.config/zew`. |
| 19 | +Incremental history _word_ completing (started with<kbd><kbd>Alt</kbd>+<kbd>h</kbd></kbd>, <kbd><kbd>Alt</kbd>+<kbd>H</kbd></kbd> or <kbd><kbd>Option</kbd>+<kbd>h</kbd></kbd>, <kbd><kbd>Option</kbd>+<kbd>H</kbd></kbd> on Mac). |
13 | 20 |
|
14 | | -## Installation With Zgen |
| 21 | +| Key(s) | Description | |
| 22 | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | |
| 23 | +| <kbd><kbd>Alt</kbd>+<kbd>w</kbd></kbd> | Delete a **shell word** [^1] | |
| 24 | +| <kbd><kbd>Alt</kbd>+<kbd>t</kbd></kbd> | Transpose (swap) **shell words** | |
| 25 | +| <kbd><kbd>Alt</kbd>+<kbd>m</kbd></kbd> | Copy previous **shell word**, or word before that, etc. when used multiple times | |
| 26 | +| <kbd><kbd>Alt</kbd>+<kbd>M</kbd></kbd> | Just copy previous **shell word** without iterating to previous ones | |
| 27 | +| <kbd><kbd>Alt</kbd>+<kbd>.</kbd></kbd> | Copy last **shell word** from previous line, or line before that, etc. when used multiple times; can be combined with <kbd><kbd>Alt</kbd>+<kbd>m</kbd></kbd> | |
| 28 | +| <kbd><kbd>Ctrl</kbd>+<kbd>W</kbd></kbd> | Delete word according to configured **word style** [^2]: | |
| 29 | +| <kbd><kbd>Alt</kbd>+<kbd>r</kbd></kbd> | Transpose (swap) words according to configured **word style** (cursor needs to be placed on beginning of word to swap) | |
| 30 | +| <kbd><kbd>Alt</kbd>+<kbd>/</kbd></kbd> | Complete **some word** [^3] from history | |
| 31 | +| <kbd><kbd>Alt</kbd>+<kbd>h</kbd></kbd>, <kbd><kbd>Alt</kbd>+<kbd>H</kbd></kbd> | Complete **shell word** from history (custom version) | |
| 32 | +| <kbd><kbd>Alt</kbd>+<kbd>J</kbd></kbd> | Break line | |
| 33 | +| <kbd><kbd>Alt</kbd>+<kbd>\_</kbd></kbd> | Undo | |
| 34 | +| | |
| 35 | + |
| 36 | +### Installation With [Zi](https://github.com/z-shell/zi) |
| 37 | + |
| 38 | +Add `zi load z-shell/zsh-editing-workbench` to `.zshrc`. The config files will be available in `~/.config/zew`. |
| 39 | + |
| 40 | +### Installation With Zgen |
15 | 41 |
|
16 | 42 | Add `zgen load z-shell/zsh-editing-workbench` to `.zshrc` and issue a `zgen reset` (this assumes that there is a proper `zgen save` construct in `.zshrc`). |
17 | 43 | The config files will be available in `~/.config/zew`. |
18 | 44 |
|
19 | | -## Installation With Antigen |
| 45 | +### Installation With Antigen |
20 | 46 |
|
21 | | -Add `antigen bundle z-shell/zsh-editing-workbench` to `.zshrc`. There also |
22 | | -should be `antigen apply`. The config files will be in `~/.config/znt`. |
| 47 | +Add `antigen bundle z-shell/zsh-editing-workbench` to `.zshrc`. There also should be `antigen apply`. The config files will be in `~/.config/znt`. |
23 | 48 |
|
24 | | -## Manual Installation |
| 49 | +### Manual Installation |
25 | 50 |
|
26 | | -After extracting `ZEW` to `{some-directory}` add following two lines |
27 | | -to `~/.zshrc`: |
| 51 | +After extracting `ZEW` to `{some-directory}` add following two lines to `~/.zshrc`: |
28 | 52 |
|
29 | | -```zsh |
| 53 | +```shell |
30 | 54 | fpath+=( {some-directory} ) |
31 | 55 | source "{some-directory}/zsh-editing-workbench.plugin.zsh" |
32 | 56 | ``` |
33 | 57 |
|
34 | | -As you can see, no plugin manager is needed to use the `*.plugin.zsh` |
35 | | -file. The above two lines of code are all that almost **all** plugin |
36 | | -managers do. In fact, what's actually needed is only: |
| 58 | +As you can see, no plugin manager is needed to use the `*.plugin.zsh` file. The above two lines of code are all that almost **all** plugin managers do. In fact, what's actually needed is only: |
37 | 59 |
|
38 | | -```zsh |
| 60 | +```shell |
39 | 61 | source "{some-directory}/zsh-editing-workbench.plugin.zsh" |
40 | 62 | ``` |
41 | 63 |
|
42 | | -because `ZEW` detects if it is used by **any** plugin manager and can |
43 | | -handle `$fpath` update by itself. |
| 64 | +<details> |
| 65 | +<summary>Configure terminals</summary> |
44 | 66 |
|
45 | | -## Configuring terminals |
| 67 | +- **XTerm** |
46 | 68 |
|
47 | | -### **XTerm** |
| 69 | +To make <kbd>Alt</kbd> key work like expected under `XTerm` add `XTerm*metaSendsEscape: true` to your resource file, e.g.: |
48 | 70 |
|
49 | | -To make `Alt` key work like expected under `XTerm` add `XTerm*metaSendsEscape: true` to your resource file, e.g.: |
50 | | - |
51 | | -```zsh |
| 71 | +```shell |
52 | 72 | echo 'XTerm*metaSendsEscape: true' >> ~/.Xresources |
53 | 73 | ``` |
| 74 | + |
| 75 | +- **Konsole** |
| 76 | + |
| 77 | +To make <kbd>Alt</kbd> key work like expected under `Konsole` add `Konsole*keysym.Meta: Meta` to your resource file, e.g.: |
| 78 | + |
| 79 | +```shell |
| 80 | +echo 'Konsole*keysym.Meta: Meta' >> ~/.config/konsolerc |
| 81 | +``` |
| 82 | + |
| 83 | +</details> |
| 84 | + |
| 85 | +[^1]: A **shell word** is a text that Zsh would see as single segment. For example `$(( i + 1 ))` is a single **shell word**. |
| 86 | +[^2]: |
| 87 | + A **word style** defines a way Zsh recognizes segments (words) of text in commands that want to use the style information. |
| 88 | + |
| 89 | + - The style can be configured in zew.conf to be one of: |
| 90 | + - bash words are built up of alphanumeric characters only. |
| 91 | + - normal as in normal shell operation: word characters are alphanumeric characters plus any characters present in the string given by the parameter `$WORDCHARS`. |
| 92 | + - shell words are complete shell command arguments, possibly including complete quoted strings, or any tokens special to the shell. |
| 93 | + - whitespace words are any set of characters delimited by whitespace. |
| 94 | + - default restore the default settings; this is the same as 'normal' with default `$WORDCHARS` value. |
| 95 | + |
| 96 | +[^3]: **Some word** is in general a sophisticated word, but not a **shell word**, because of limitations in Zsh history word completion. **Some word** is rather not build from special characters, it works well for normal characters. |
0 commit comments