mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +01:00
Document new key bindings
This commit is contained in:
parent
e1fd4da051
commit
b24d4c9db1
1 changed files with 13 additions and 9 deletions
|
|
@ -37,13 +37,13 @@ Say you opened these directories on the terminal:
|
||||||
3 ~
|
3 ~
|
||||||
```
|
```
|
||||||
|
|
||||||
By pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd>, the current working directory or `$CWD` will be from `oh-my-zsh` to `Hacktoberfest`. Press it again and it will be at `Projects`.
|
By pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd>, the current working directory or `$PWD` will be from `oh-my-zsh` to `Hacktoberfest`. Press it again and it will be at `Projects`.
|
||||||
|
|
||||||
And by pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd>, the `$CWD` will be from `Projects` to `Hacktoberfest`. Press it again and it will be at `oh-my-zsh`.
|
And by pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd>, the `$PWD` will be from `Projects` to `Hacktoberfest`. Press it again and it will be at `oh-my-zsh`.
|
||||||
|
|
||||||
Here's a example history table with the same accessed directories like above:
|
Here's a example history table with the same accessed directories like above:
|
||||||
|
|
||||||
| Current `$CWD` | Key press | New `$CWD` |
|
| Current `$PWD` | Key press | New `$PWD` |
|
||||||
| --------------- | ----------------------------------------------------- | --------------- |
|
| --------------- | ----------------------------------------------------- | --------------- |
|
||||||
| `oh-my-zsh` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `Hacktoberfest` |
|
| `oh-my-zsh` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `Hacktoberfest` |
|
||||||
| `Hacktoberfest` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `Projects` |
|
| `Hacktoberfest` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `Projects` |
|
||||||
|
|
@ -53,7 +53,7 @@ Here's a example history table with the same accessed directories like above:
|
||||||
| `Hacktoberfest` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `oh-my-zsh` |
|
| `Hacktoberfest` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `oh-my-zsh` |
|
||||||
| `oh-my-zsh` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `~` |
|
| `oh-my-zsh` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `~` |
|
||||||
|
|
||||||
Note the last traversal, when pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> on a last known `$CWD`, it will change back to the first known `$CWD`, which in the example is `~`.
|
Note the last traversal, when pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> on a last known `$PWD`, it will change back to the first known `$PWD`, which in the example is `~`.
|
||||||
|
|
||||||
Here's an asciinema cast demonstrating the example above:
|
Here's an asciinema cast demonstrating the example above:
|
||||||
|
|
||||||
|
|
@ -61,18 +61,22 @@ Here's an asciinema cast demonstrating the example above:
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
| Function | Description |
|
| Function | Description |
|
||||||
| -------------------- | --------------------------------------------------------------------------------------------------------- |
|
| -------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `insert-cycledleft` | Change `$CWD` to the previous known stack, binded on <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> |
|
| `insert-cycledleft` | Change `$PWD` to the previous known stack, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> |
|
||||||
| `insert-cycledright` | Change `$CWD` to the next known stack, binded on <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> |
|
| `insert-cycledright` | Change `$PWD` to the next known stack, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> |
|
||||||
|
| `insert-cycledup` | Change `$PWD` to the parent folder, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Up</kbd> |
|
||||||
|
| `insert-cycleddown` | Change `$PWD` to the first alphabetical child folder, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Down</kbd> |
|
||||||
|
|
||||||
## Rebinding keys
|
## Rebinding keys
|
||||||
|
|
||||||
You can bind these functions to other key sequences, as long as you know the bindkey sequence. For example, these commands bind to <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> / <kbd>Right</kbd> in `xterm-256color`:
|
You can bind these functions to other key sequences, as long as you know the bindkey sequence. For example, these commands bind to <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>key</kbd> in `xterm-256color`:
|
||||||
|
|
||||||
```zsh
|
```zsh
|
||||||
bindkey '^[[1;4D' insert-cycledleft
|
bindkey '^[[1;4D' insert-cycledleft
|
||||||
bindkey '^[[1;4C' insert-cycledright
|
bindkey '^[[1;4C' insert-cycledright
|
||||||
|
bindkey "\e[1;4A" insert-cycledup
|
||||||
|
bindkey "\e[1;4B" insert-cycleddown
|
||||||
```
|
```
|
||||||
|
|
||||||
You can get the bindkey sequence by pressing <kbd>Ctrl</kbd> + <kbd>V</kbd>, then pressing the keyboard shortcut you want to use.
|
You can get the bindkey sequence by pressing <kbd>Ctrl</kbd> + <kbd>V</kbd>, then pressing the keyboard shortcut you want to use.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue