zsh-users
 help / color / mirror / code / Atom feed
* (temporary) disable bracketed_paste
@ 2017-05-05 17:55 Piotr Karbowski
  2017-05-05 20:13 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Piotr Karbowski @ 2017-05-05 17:55 UTC (permalink / raw)
  To: zsh-users

Hi,

I'd like to know how to temporary disable zle_bracketed_paste. Best 
would be if I could disable it for a moment, and restore afterward. I 
have hooked fzy into hotkey via zle, which I use often, however, when I 
spawn fzy via zle, and paste with middle click, with 'foo' I am getting 
'[200~foo[201' instead.

I tried to `unset zle_bracketed_paste` but it does work only on the root 
of .zshrc, if I wrap it within function, it does not do a thing.

Here's my fzy thing

# Insert path selected with fzy into command line on ^F press.
_select_path_with_fzy() {
     local selected_path
     if ! command -v fzy >/dev/null 2>&1; then
         echo 'No fzy binary found in $PATH.'
         return 1
     fi
     echo
     selected_path="$(find -L . | cut -c 3- | fzy)"
     if [ "${selected_path}" ]; then
         LBUFFER+="${(q)selected_path}"
     fi
     zle reset-prompt
}
zle -N _select_path_with_fzy
bindkey "^F" _select_path_with_fzy

-- Piotr.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: (temporary) disable bracketed_paste
  2017-05-05 17:55 (temporary) disable bracketed_paste Piotr Karbowski
@ 2017-05-05 20:13 ` Bart Schaefer
  2017-05-05 21:32   ` Piotr Karbowski
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2017-05-05 20:13 UTC (permalink / raw)
  To: zsh-users

On May 5,  7:55pm, Piotr Karbowski wrote:
} 
} I'd like to know how to temporary disable zle_bracketed_paste. Best 
} would be if I could disable it for a moment, and restore afterward.
[...]
} I tried to `unset zle_bracketed_paste` but it does work only on the root 
} of .zshrc, if I wrap it within function, it does not do a thing.

zle_bracketed_paste is used when ZLE begins and when ZLE ends, because
it has to be in effect before any paste action occurs.

The value of $zle_bracketed_paste is an array containing the on/off
controls for the feature.  So all you need is for example

    print -nr ${zle_bracketed_paste[2]} >/dev/tty  # Toggle off
    {
      #
      # Do whatever it is you need to do
      #
    } always {
      print -nr ${zle_bracketed_paste[1]} >/dev/tty  # Toggle on
    }

The "always" is just for sanity in case of early exit from whatever it
is you need to do.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: (temporary) disable bracketed_paste
  2017-05-05 20:13 ` Bart Schaefer
@ 2017-05-05 21:32   ` Piotr Karbowski
  0 siblings, 0 replies; 3+ messages in thread
From: Piotr Karbowski @ 2017-05-05 21:32 UTC (permalink / raw)
  To: Bart Schaefer, zsh-users

On 05/05/2017 10:13 PM, Bart Schaefer wrote:
> print -nr ${zle_bracketed_paste[1]} >/dev/tty

Works like it's supposed to. Thank you.

-- Piotr.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-05 21:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05 17:55 (temporary) disable bracketed_paste Piotr Karbowski
2017-05-05 20:13 ` Bart Schaefer
2017-05-05 21:32   ` Piotr Karbowski

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).