diff options
| author | Přemysl Eric Janouch <p@janouch.name> | 2020-09-29 00:55:01 +0200 | 
|---|---|---|
| committer | Přemysl Eric Janouch <p@janouch.name> | 2020-09-29 01:33:19 +0200 | 
| commit | 9a12fd80213c985fc91ee75854918523106377f3 (patch) | |
| tree | c03408842619641ce00af73ef89e7c97ba043d46 /README.adoc | |
| parent | f596bb8f5e9fb0b9e42ad681886f2ab8991e82d4 (diff) | |
| download | sdn-9a12fd80213c985fc91ee75854918523106377f3.tar.gz sdn-9a12fd80213c985fc91ee75854918523106377f3.tar.xz sdn-9a12fd80213c985fc91ee75854918523106377f3.zip | |
Add ability to run helpers externally
So far experimental and essentially undocumented.
Diffstat (limited to 'README.adoc')
| -rw-r--r-- | README.adoc | 25 | 
1 files changed, 15 insertions, 10 deletions
| diff --git a/README.adoc b/README.adoc index e49cbce..5ca0e5f 100644 --- a/README.adoc +++ b/README.adoc @@ -52,9 +52,11 @@ To start using this navigator, put the following in your .zshrc:  ....  sdn-navigate () {    # ... possibly zle-line-init -  eval "`sdn`" -  [ -z "$cd" ] || cd "$cd" -  [ -z "$insert" ] || LBUFFER="$LBUFFER$insert " +  while eval "`sdn`"; do +    [ -z "$cd" ] || cd "$cd" +    [ -z "$insert" ] || LBUFFER="$LBUFFER$insert " +    [ -z "$helper" ] && break +    eval "exec </dev/tty; $helper" || break    zle reset-prompt    # ... possibly zle-line-finish  } @@ -65,19 +67,22 @@ bindkey '\eo' sdn-navigate  bash  ----  Here we can't reset the prompt from within a `bind -x` handler but there is -an acceptable workaround: +an acceptable workaround that sadly submits a blank line:  ....  sdn-navigate () {    SDN_L=$READLINE_LINE SDN_P=$READLINE_POINT    READLINE_LINE= -  eval "`sdn`" -  [[ -z "$cd" ]] || cd "$cd" -  [[ -z "$insert" ]] || { -    SDN_L="${SDN_L:0:$SDN_P}$insert ${SDN_L:$SDN_P}" -    ((SDN_P=SDN_P+${#insert}+1)) -  } +  while eval "`sdn`"; do +    [[ -z "$cd" ]] || cd "$cd" +    [[ -z "$insert" ]] || { +      SDN_L="${SDN_L:0:$SDN_P}$insert ${SDN_L:$SDN_P}" +      ((SDN_P=SDN_P+${#insert}+1)) +    } +    [[ -z "$helper" ]] && break +    eval "$helper" || break +  done  }  sdn-restore () {    READLINE_LINE=$SDN_L READLINE_POINT=$SDN_P | 
