From 1ea213cda8e2c02bb9e045cda06e474b66e48cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Reegn?= Date: Tue, 23 Nov 2021 11:33:18 +0100 Subject: [PATCH] Make shell alias expansion the default behaviour Adjusted the documentation on how to opt out of the alias expansion feature. --- README.md | 25 ++++++++++++++++++------- jq.plugin.zsh | 2 +- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index df777f8..814f9d6 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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 +``` diff --git a/jq.plugin.zsh b/jq.plugin.zsh index 932a914..4f81d60 100755 --- a/jq.plugin.zsh +++ b/jq.plugin.zsh @@ -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'}