https://github.com/tmiland/zsh-script-prefix
Easily prefix your current or previous commands with `./` by pressing esc once
https://github.com/tmiland/zsh-script-prefix
oh-my-zsh oh-my-zsh-config oh-my-zsh-custom oh-my-zsh-plugin
Last synced: 6 months ago
JSON representation
Easily prefix your current or previous commands with `./` by pressing esc once
- Host: GitHub
- URL: https://github.com/tmiland/zsh-script-prefix
- Owner: tmiland
- License: mit
- Created: 2022-12-05T14:02:00.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-05T14:11:58.000Z (almost 3 years ago)
- Last Synced: 2025-02-09T23:27:53.687Z (8 months ago)
- Topics: oh-my-zsh, oh-my-zsh-config, oh-my-zsh-custom, oh-my-zsh-plugin
- Language: Shell
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zsh-script-prefix
Easily prefix your current or previous commands with `./` by pressing esc once.
_Modified version of ohmyzsh_ [plugins/sudo](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/sudo)
## Install
```bash
git clone https://github.com/tmiland/zsh-script-prefix.git "$ZSH_CUSTOM"/plugins/zsh-script-prefix
```To use it, add `zsh-script-prefix` to the plugins array in your zshrc file:
```zsh
plugins=(... zsh-script-prefix)
```## Usage
### Current typed commands
Say you have typed a script name and forgot to add `./` in front:
```bash
$ somescript.sh
```By pressing the esc key once, you will have the same command with `./` prefixed without typing:
```bash
$ ./somescript.sh
```### Previous executed commands
By pressing the esc key once, you will have the same command with `./` prefixed without typing:
```bash
$ somescript.sh
zsh: command not found: somescript.sh
$ ./somescript.sh
```## Key binding
By default, the `zsh-script-prefix` plugin uses Esc as the trigger.
If you want to change it, you can use the `bindkey` command to bind it to a different key:```sh
bindkey -M emacs '' script-prefix-command-line
bindkey -M vicmd '' script-prefix-command-line
bindkey -M viins '' script-prefix-command-line
```where `` is the sequence you want to use. You can find the keyboard sequence
by running `cat` and pressing the keyboard combination you want to use.### Credits
ohmyzsh [plugins/sudo](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/sudo)