Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH v2 (complete): Implement zle -P



I'd forgotten that I originally suggested "zle -P" ...

On Sep 1,  8:07am, Mikael Magnusson wrote:
}
} I can now do this (which is why I originally found this old thread, if
} anyone was curious):
} 
} function _start_paste() {
}   local content
}   local a b
}   local oldcutbuf="$CUTBUFFER"
}   # I haven't quite decided how I want to control quoting yet.
}   [[ $_SPACE_AFTER_PASTE_QUOTE = 1 ]]; a=$?
}   (( $+NUMERIC )) || [[ $KEYS = $'\e\e'* ]]; b=$?
}   zle .$WIDGET -N content
}   if [[ $a -ne $b ]]; then
}     CUTBUFFER=${(q-)content}' '
}   else
}     CUTBUFFER=$content
}   fi
}   zle .yank
}   CUTBUFFER="$oldcutbuf"
} }
} zle -P bracketed-paste bracketed-paste _start_paste

So I think this is:

autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic
zstyle :bracketed-paste-magic paste-finish quote-paste
zstyle -e :bracketed-paste-magic:finish quote-style \
    '() { local a b;
          [[ $_SPACE_AFTER_PASTE_QUOTE = 1 ]]; a=$?;
          (( $+NUMERIC )) || [[ $KEYS = $'\''\e\e'\''* ]]; b=$? ;
          [[ $a -ne $b ]] } && reply=(q-) || reply=(none)'

BTW what's the point of doing "zle .$WIDGET ..." when the only widget
this can possibly work with is .bracketed-paste ?



Messages sorted by: Reverse Date, Date, Thread, Author