Skip to content

Commit

Permalink
rename to pre exec native
Browse files Browse the repository at this point in the history
  • Loading branch information
MenkeTechnologies committed Sep 24, 2021
1 parent a81f207 commit 4a34cab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# zsh-expand
This plugin expands regular aliases, global aliases, incorrect spellings and phrases, globs, command/process substitution, =command expansion, history expansion and $parameters with the spacebar key. The plugin uses only zsh with no pipes nor external commands for maximum speed.
This plugin expands regular aliases, global aliases and incorrect spellings and phrases with the spacebar key. Native expansions such as globs, command/process substitution, =command expansion, history expansion and $parameters are also expanded by default but can be turned off. The plugin uses only zsh with no pipes nor external commands for maximum speed.

Expansion of regular aliases is done in the command/first position of a statement and after certain commands (sudo, env, zpwr) when in other positions in a statement

Expand All @@ -9,7 +9,7 @@ Expansion on aliases and global aliases occurs when cursor is on position right

Expansion on history, globs, parameters and mispellings occurs when cursor is on position right of expansion candidate. A space after expansion candidate will prevent expansion on spacebar.

There is optional expansion of unexpanded line into history on accepting current line. See [below](#optional-expansion-of-unexpanded-line-into-history-on-enter).
There is optional expansion of unexpanded line into history on accepting current line with enter key. Expansion occurs for aliases not spelling correction. Globs and other expansions can be optionally enabled on accepting line. See [below](#optional-expansion-of-unexpanded-line-into-history-on-enter).

## Demo
[![asciicast](https://asciinema.org/a/FteYBtHg5F9oOT7vNkbGlZfjT.svg)](https://asciinema.org/a/FteYBtHg5F9oOT7vNkbGlZfjT)
Expand Down Expand Up @@ -64,6 +64,12 @@ If `ZPWR_EXPAND_TO_HISTORY=true` then after running a command line with an unexp

This uses the exact same rules as expand on spacebar so `sudo gco` will expand to `sudo git checkout` into history if you have `alias gco=git checkout` etc...

Globs and the other native expansions are expanded on accept line with:
```sh
# globs etc expand before command line is accepted
export ZPWR_EXPAND_PRE_EXEC_NATIVE=true
```

## Install for Zinit
> `~/.zshrc`
```sh
Expand Down
2 changes: 1 addition & 1 deletion zpwrExpandLib.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function zpwrExpandSupernaturalSpace() {
if [[ $ZPWR_EXPAND_NATIVE == true ]]; then
if [[ $LBUFFER[-1] != ' ' ]]; then
if [[ $triggerKey == "${ZPWR_VARS[ENTER_KEY]}" ]]; then
if [[ $ZPWR_EXPAND_PRE_EXEC_GLOB == true ]]; then
if [[ $ZPWR_EXPAND_PRE_EXEC_NATIVE == true ]]; then
zpwrExpandWordStopHistoryExpansion
fi
else
Expand Down

0 comments on commit 4a34cab

Please sign in to comment.