Skip to content

Commit

Permalink
Make shell alias expansion the default behaviour
Browse files Browse the repository at this point in the history
Adjusted the documentation on how to opt out of the alias expansion
feature.
  • Loading branch information
reegnz committed Nov 23, 2021
1 parent acadd6d commit 1ea213c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ This zsh plugin gives you jq superpowers!
This plugin requires [fzf](https://github.com/junegunn/fzf) to be available
on your PATH.

The project consists of two components:
The project consists of the following components:

- a `jq-repl` command
- a `jq-paths` command
- a `jq.plugin.zsh` providing line-editor feature using `jq-repl`

- a `jq.plugin.zsh` providing line-editor feature utilizing `jq-repl`

### [zplug](https://github.com/zplug/zplug)

Expand Down Expand Up @@ -77,8 +77,19 @@ During interactive querying, the following shortcuts can be used:

## Troubleshooting

### Pressing alt-j creates a `` symbol in iTerm2
### MacOS: Pressing alt-j creates a `` symbol in iTerm2

- `Cmd + ,` to enter preferences
- Go to Profiles
- select your profile from the pane on the left hand side
- go to the keys tab
- Set Left Option (⌥ ) Key to `Esc+`

### Disable expanding shell aliases

Cmd + , to enter preferences
Go to Profiles, select your profile from the pane on the left hand side, then go to the keys tab.
Set Left Option (⌥) Key to Esc+
The plugin automatically expands shell aliases in a command before passing it
to `jq-repl`. To disable, put the following line into your `.zshrc`:

```
JQ_ZSH_PLUGIN_EXPAND_ALIASES=0
```
2 changes: 1 addition & 1 deletion jq.plugin.zsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if [[ -o zle ]]; then

__get_query() {
if [ "${JQ_ZSH_PLUGIN_EXPAND_ALIASES:-0}" -eq 1 ]; then
if [ "${JQ_ZSH_PLUGIN_EXPAND_ALIASES:-1}" -eq 1 ]; then
unset 'functions[_jq-plugin-expand]'
functions[_jq-plugin-expand]=${LBUFFER}
(($+functions[_jq-plugin-expand])) && COMMAND=${functions[_jq-plugin-expand]#$'\t'}
Expand Down

0 comments on commit 1ea213c

Please sign in to comment.