sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 21f2a65e6129ad7f7ceecc962749e2d82d037b38
parent ca027cf4653062fea14a6cceff079b09cd351ce2
Author: jeromenerf <jerome.andrieux@gmail.com>
Date:   Mon, 11 Sep 2017 20:02:49 +0200

[st] fix code blocks syntax for right click to plumb patch

Diffstat:
Mst.suckless.org/patches/right_click_to_plumb/index.md | 48++++++++++++++++++++++--------------------------
1 file changed, 22 insertions(+), 26 deletions(-)

diff --git a/st.suckless.org/patches/right_click_to_plumb/index.md b/st.suckless.org/patches/right_click_to_plumb/index.md @@ -11,37 +11,33 @@ The shell current working directory is set by the shell via `OSC 7` (borrowed fr For zsh : -```sh -__vte_urlencode() ( - # This is important to make sure string manipulation is handled - # byte-by-byte. - LC_ALL=C - str="$1" - while [ -n "$str" ]; do - safe="${str%%[!a-zA-Z0-9/:_\.\-\!\'\(\)~]*}" - printf "%s" "$safe" - str="${str#"$safe"}" - if [ -n "$str" ]; then - printf "%%%02X" "'$str" - str="${str#?}" - fi - done -) - -__vte_osc7 () { - printf "\033]7;%s%s\a" "${HOSTNAME:-}" "$(__vte_urlencode "${PWD}")" -} - -[ -n "$ZSH_VERSION" ] && precmd_functions+=(__vte_osc7) -``` + __vte_urlencode() ( + # This is important to make sure string manipulation is handled + # byte-by-byte. + LC_ALL=C + str="$1" + while [ -n "$str" ]; do + safe="${str%%[!a-zA-Z0-9/:_\.\-\!\'\(\)~]*}" + printf "%s" "$safe" + str="${str#"$safe"}" + if [ -n "$str" ]; then + printf "%%%02X" "'$str" + str="${str#?}" + fi + done + ) + + __vte_osc7 () { + printf "\033]7;%s%s\a" "${HOSTNAME:-}" "$(__vte_urlencode "${PWD}")" + } + + [ -n "$ZSH_VERSION" ] && precmd_functions+=(__vte_osc7) The patch itself only adds a `cwd` global and a button3 entry that will run a shell, change directory to cwd and run the plumber with the primary selection. Maybe I should use pass cwd as an argument too, like plan9 plumber does. The plumbing program can be defined via `config.h`: -```h -static char plumber[] = "plumb.sh"; -``` + static char plumber[] = "plumb.sh"; ## Download