An open API service indexing awesome lists of open source software.

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

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)