├── .circleci └── config.yml ├── .envrc ├── .gitignore ├── CHANGELOG.adoc ├── README.adoc ├── UNLICENSE ├── default.nix ├── derivation.nix ├── edit-client ├── nixpkgs.nix ├── overlay.nix ├── plumbing-examples ├── rc ├── plumb.kak └── plumbing.kak ├── release.nix └── test ├── 9 ├── .gitignore ├── functions.bash └── tests.bash /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build-and-test: 4 | docker: 5 | - image: nixorg/nix:circleci 6 | steps: 7 | - checkout 8 | - run: 9 | name: Run release.nix 10 | command: nix-build release.nix 11 | workflows: 12 | version: 2 13 | build-and-deploy: 14 | jobs: 15 | - build-and-test 16 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | use nix 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /result 2 | -------------------------------------------------------------------------------- /CHANGELOG.adoc: -------------------------------------------------------------------------------- 1 | CHANGELOG 2 | ========= 3 | 4 | == https://github.com/eraserhd/kak-plumb/compare/v0.1.1...HEAD[Unreleased] 5 | 6 | * filetype=diff: A click plumbs the path and location of the cursor in the 7 | "new" file. 8 | * Support plumbs with the attribute `action=showdata`, which are generated by 9 | piping text to `9 plumb -i`. 10 | * Highlighting for the plumbing filetype 11 | 12 | == https://github.com/eraserhd/kak-plumb/compare/v0.1.0...v0.1.1[v0.1.1] 13 | 14 | * Add UNLICENSE, `plumbing-examples`, and `edit-client` scripts 15 | * Map normal mode `Enter` to plumb-click 16 | * Add `plumb_wdir` option 17 | 18 | ==== Client 19 | 20 | * Add `edit-client` script. It listens on the plumber's `edit` port and can open 21 | files or run commands based on the attributes the plumber sends it. 22 | * Add `plumbing-examples` 23 | 24 | == v0.1.0 25 | 26 | * First release! 27 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | kak-plumb 2 | ========= 3 | 4 | https://kakoune.org[Kakoune] integration with the 5 | https://9fans.github.io/plan9port/[plan9port] 6 | https://9fans.github.io/plan9port/man/man4/plumber.html[plumber]. 7 | 8 | Plumbing Text and Clicking 9 | -------------------------- 10 | 11 | `Enter` is mapped to plumb the current selections. Multiple selections are 12 | plumbed iteratively. 13 | 14 | If a selection is one character long, it is treated like a Plan 9 "click". 15 | The surrounding (or following) WORD is plumbed instead, and a "click" 16 | attribute is computed with the selection's offset. 17 | 18 | A special case is when `filetype` is `diff`: The location of the cursor 19 | within the diff chunk is used to compute a position in the "new" file, and 20 | this file, line, and column are plumbed. 21 | 22 | `kakoune` is sent as the source. The current working directory is sent 23 | unless overridden by setting the `plumb_wdir` option. Additionally, a 24 | `session` attribute is sent with the value of `%val{session}`. 25 | 26 | Opening Plumbs in Kakoune 27 | ------------------------- 28 | 29 | `edit-client` is a script which will listen to the plumber's `edit` port and 30 | send Kakoune sessions commands it receives. It can be used to open files in 31 | Kakoune when plumbed. 32 | 33 | It should be wrapped with systemd or launchd. Make sure that `kak` and `9` 34 | are in the path and `$NAMESPACE` is set properly. 35 | 36 | See the `plumbing-examples` file for examples of usage. 37 | 38 | Contributing 39 | ------------ 40 | 41 | All new functionality must contain tests. See `test/tests.bash` for details. 42 | -------------------------------------------------------------------------------- /UNLICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | let 2 | pkgs = import { 3 | config = {}; 4 | overlays = [ 5 | (import ./overlay.nix) 6 | ]; 7 | }; 8 | in pkgs.kakounePlugins.kak-plumb 9 | -------------------------------------------------------------------------------- /derivation.nix: -------------------------------------------------------------------------------- 1 | { stdenv, lib, fetchFromGitHub, kakoune-unwrapped, plan9port, ... }: 2 | 3 | stdenv.mkDerivation rec { 4 | pname = "kak-plumb"; 5 | version = "0.1.1"; 6 | 7 | src = ./.; 8 | 9 | installPhase = '' 10 | mkdir -p $out/bin $out/share/kak/autoload/plugins/ 11 | substitute rc/plumb.kak $out/share/kak/autoload/plugins/plumb.kak \ 12 | --replace '9 plumb' '${plan9port}/bin/9 plumb' 13 | cp rc/plumbing.kak $out/share/kak/autoload/plugins/plumbing.kak 14 | substitute edit-client $out/bin/edit-client \ 15 | --replace '9 9p' '${plan9port}/bin/9 9p' \ 16 | --replace 'kak -p' '${kakoune-unwrapped}/bin/kak -p' 17 | chmod +x $out/bin/edit-client 18 | ''; 19 | 20 | meta = with lib; { 21 | description = "Kakoune integration with the Plan 9 plumber"; 22 | homepage = https://github.com/eraserhd/kak-plumb; 23 | license = licenses.unlicense; 24 | maintainers = with maintainers; [ eraserhd ]; 25 | platforms = platforms.all; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /edit-client: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | 9 9p read plumb/edit |while true; do 6 | read -r src 7 | read -r dst 8 | read -r wdir 9 | read -r type 10 | read -r attrs 11 | read -r ndata 12 | LC_ALL=C read -rN $ndata data 13 | 14 | client='%opt{jumpclient}' 15 | evaluate="" 16 | session="" 17 | eval set -- "$attrs" 18 | while [[ $# -ne 0 ]]; do 19 | case "$1" in 20 | client=*) client="${1#client=}";; 21 | evaluate=*) evaluate="${1#evaluate=}";; 22 | session=*) session="${1#session=}";; 23 | esac 24 | shift 25 | done 26 | 27 | dataFile=$(mktemp) 28 | printf %s "$data" >"$dataFile" 29 | 30 | printf ' 31 | evaluate-commands -try-client %s %%{ 32 | try %%{ 33 | set-option window plumb_data %%file{%s} 34 | nop %%sh{rm -f "%s"} 35 | %s 36 | try focus 37 | } catch %%{ 38 | echo -markup "{Error}%%val{error}" 39 | echo -debug "%%val{error}" 40 | } 41 | } 42 | ' "$client" "$dataFile" "$dataFile" "$evaluate" |kak -p "$session" 43 | done 44 | -------------------------------------------------------------------------------- /nixpkgs.nix: -------------------------------------------------------------------------------- 1 | builtins.fetchTarball { 2 | url = "https://github.com/NixOS/nixpkgs/archive/19.09.tar.gz"; 3 | sha256 = "0mhqhq21y5vrr1f30qd2bvydv4bbbslvyzclhw0kdxmkgg3z4c92"; 4 | } 5 | -------------------------------------------------------------------------------- /overlay.nix: -------------------------------------------------------------------------------- 1 | self: super: { 2 | kakounePlugins = super.kakounePlugins // { 3 | kak-plumb = super.callPackage ./derivation.nix {}; 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /plumbing-examples: -------------------------------------------------------------------------------- 1 | 2 | # This was taken from the default rules 3 | addrelem='((#?[0-9]+)|(/[A-Za-z0-9_\^]+/?)|[.$])' 4 | addr=:($addrelem([,;+\-]$addrelem)*) 5 | twocolonaddr = ([0-9]+)[:.]([0-9]+) 6 | 7 | # The rules below don't have `isfile` in them because my system that runs 8 | # the plumber doesn't have my dev box's files mounted. You should be able 9 | # to replace the first `data set $1` line in each rule with `arg isfile $1`. 10 | 11 | # --------------------------------------------------------------------------- 12 | 13 | # Open paths named `/tmp/buffer-*.??????` as fifos in Kakoune. 14 | # Sets plumb_wdir on the buffer so that plumb clicks work. 15 | # FIXME: Should we be trying to use `action=showdata` instead?? 16 | type is text 17 | data matches '/tmp/buffer-([.a-zA-Z¡-￿0-9_\-@]*[a-zA-Z¡-￿0-9_\-])\.......' 18 | data set $0 19 | data set $file 20 | attr add session=kakoune 21 | attr add 'evaluate=''edit -fifo %§'$file'§ %§'$1'§ ; try %{set-option window plumb_wdir %§'$wdir'§}''' 22 | plumb to edit 23 | 24 | # --------------------------------------------------------------------------- 25 | 26 | # Files tagged by line number:columnumber or linenumber.columnumber, twice 27 | type is text 28 | data matches '([.a-zA-Z¡-￿0-9_/\-@]*[a-zA-Z¡-￿0-9_/\-])':$twocolonaddr,$twocolonaddr 29 | data set $1 30 | data set $file 31 | attr add session=kakoune 32 | attr add 'evaluate=''edit -existing %§'$data'§ ; select '$2'.'$3','$4'.'$5'''' 33 | plumb to edit 34 | 35 | # Files tagged by line number:columnumber or linenumber.columnumber 36 | type is text 37 | data matches '([.a-zA-Z¡-￿0-9_/\-@]*[a-zA-Z¡-￿0-9_/\-])':$twocolonaddr 38 | data set $1 39 | data set $file 40 | attr add session=kakoune 41 | attr add 'evaluate=''edit -existing %§'$data'§ '$2' '$3'''' 42 | plumb to edit 43 | 44 | # Files tagged by line number. 45 | type is text 46 | data matches '([.a-zA-Z¡-￿0-9_/\-@]*[a-zA-Z¡-￿0-9_/\-])'$addr 47 | data set $1 48 | data set $file 49 | attr add session=kakoune 50 | attr add 'evaluate=''edit -existing %§'$data'§ '$2' ; execute-keys gi''' 51 | plumb to edit 52 | 53 | # Untagged paths are just opened. 54 | type is text 55 | data matches '([.a-zA-Z¡-￿0-9_/\-@]*[a-zA-Z¡-￿0-9_/\-])' 56 | data set $1 57 | data set $file 58 | attr add session=kakoune 59 | attr add 'evaluate=''edit -existing %§'$data'§''' 60 | plumb to edit 61 | 62 | # When action=showdata and we haven't matched anything above, display the data 63 | # in a scratch buffer. This allows you to do things like: 64 | # 65 | # git show |9 plumb -i 66 | # 67 | type is text 68 | type set $attr 69 | type matches '.*action=showdata.*' 70 | type set text 71 | attr add session=kakoune 72 | attr add 'evaluate=''plumb-showdata ; try %{set-option window plumb_wdir %§'$wdir'§}''' 73 | plumb to edit 74 | 75 | -------------------------------------------------------------------------------- /rc/plumb.kak: -------------------------------------------------------------------------------- 1 | # Plumb 2 | # ‾‾‾‾‾ 3 | 4 | declare-option -docstring 'a directory to send instead of $(pwd) for wdir' str plumb_wdir 5 | declare-option -docstring 'data sent during the last plumb' str plumb_data 6 | 7 | define-command \ 8 | -params 1.. \ 9 | -docstring %{plumb [] : send text to the plumber 10 | Switches: 11 | -attr = Add an attribute to the message (accumulative)} \ 12 | plumb %{ 13 | evaluate-commands %sh{ 14 | attrs="session=${kak_session}" 15 | while [ $# -ne 1 ]; do 16 | case "$1" in 17 | -attr) 18 | attrs="${attrs} $2" 19 | shift 20 | ;; 21 | *) 22 | printf 'fail "unknown switch %s"\n' "$1" 23 | exit 0 24 | esac 25 | shift 26 | done 27 | wdir="$kak_opt_plumb_wdir" 28 | if [ -z "$wdir" ]; then 29 | wdir="$(pwd)" 30 | fi 31 | err="$(9 plumb -s kakoune -w "${wdir}" -a "${attrs}" "$@" 2>&1)" 32 | if [ -n "$err" ]; then 33 | printf 'fail "%s"\n' "$err" 34 | fi 35 | } 36 | } 37 | 38 | declare-option -hidden str-list plumb_saved_d 39 | 40 | define-command \ 41 | -params 0 \ 42 | -docstring %{plumb-showdata: display contents of plumb_data option} \ 43 | plumb-showdata %{ 44 | set-option global plumb_saved_d %reg{d} 45 | set-register d %opt{plumb_data} 46 | edit -scratch *showdata* 47 | execute-keys '%"dRgg' 48 | set-register d %opt{plumb_saved_d} 49 | } 50 | 51 | define-command -hidden plumb-click-WORD %{ 52 | execute-keys 'Z["lyz' 53 | plumb -attr %sh{ 54 | eval set -- "$kak_reg_l" 55 | printf click=%d $((${#1} - 1)) 56 | } %val{selection} 57 | } 58 | 59 | declare-option -hidden str plumb_diff_filename 60 | declare-option -hidden int plumb_diff_chunk_start 61 | declare-option -hidden str-list plumb_diff_preceding_adds 62 | 63 | define-command -hidden plumb-click-diff %{ 64 | try %{ 65 | evaluate-commands -draft %{ 66 | execute-keys ^diff[^\n]+b/([^\n]+)$ 67 | set-option global plumb_diff_filename %reg{1} 68 | } 69 | evaluate-commands -draft %{ 70 | execute-keys '^@@ -\d+,\d+ \+(\d+),\d+ @@' 71 | set-option global plumb_diff_chunk_start %reg{1} 72 | } 73 | evaluate-commands -draft %{ 74 | execute-keys '^@@ Jgh-"ay' 75 | set-option global plumb_diff_preceding_adds %reg{a} 76 | } 77 | evaluate-commands %sh{ 78 | eval set -- "$kak_quoted_opt_plumb_diff_preceding_adds" 79 | line=$(( $kak_opt_plumb_diff_chunk_start + $# - 1 )) 80 | column=$(( $kak_cursor_column - 1 )) 81 | text="${kak_opt_plumb_diff_filename}:${line}:${column}" 82 | printf 'plumb "%s"\n' "$text" 83 | } 84 | } catch %{ 85 | # Fallback case, which means we are likely in a commit header and 86 | # can't find a diff and chunk begin line above us, so do the usual 87 | # thing. 88 | plumb-click-WORD 89 | } 90 | } 91 | 92 | define-command \ 93 | -docstring %{plumb-click: send selection or WORD to plumber 94 | 95 | If the selection length is 1, send the current WORD to the plumber along with 96 | click coordinates. Otherwise, send the selection to the plumber. 97 | 98 | There is special handling for filetype=diff.} \ 99 | plumb-click %{ 100 | evaluate-commands -itersel -draft %{ 101 | # Move forward if on a single whitespace 102 | try %{ execute-keys '\A\s\z/[^\s]' } 103 | try %{ 104 | # If we have more than a single character, send it as an 105 | # intentional selection 106 | execute-keys '\A[^\s]\z' 107 | plumb %val{selection} 108 | } catch %{ 109 | evaluate-commands -draft %sh{ 110 | case "$kak_opt_filetype" in 111 | diff) printf plumb-click-diff\\n ;; 112 | *) printf plumb-click-WORD\\n ;; 113 | esac 114 | } 115 | } 116 | } 117 | } 118 | 119 | map global normal ': plumb-click' 120 | -------------------------------------------------------------------------------- /rc/plumbing.kak: -------------------------------------------------------------------------------- 1 | 2 | hook global BufCreate (.*/)?plumbing %{ 3 | set-option buffer filetype plumbing 4 | } 5 | 6 | hook global WinSetOption filetype=plumbing %{ 7 | require-module plumbing 8 | 9 | hook -once -always window WinSetOption filetype=.* %{ remove-hooks window plumbing-.+ } 10 | } 11 | 12 | hook -group plumbing-highlight global WinSetOption filetype=plumbing %{ 13 | add-highlighter window/plumbing ref plumbing 14 | hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/plumbing } 15 | } 16 | 17 | provide-module plumbing %{ 18 | 19 | # Highlighters 20 | # ------------ 21 | 22 | add-highlighter shared/plumbing regions 23 | add-highlighter shared/plumbing/code default-region group 24 | add-highlighter shared/plumbing/comment region '#' '$' fill comment 25 | add-highlighter shared/plumbing/string region "'" "'" fill string 26 | add-highlighter shared/plumbing/code/variable regex "^(\w+)\h*=" 1:variable 27 | add-highlighter shared/plumbing/code/expansion regex '\$(\w+)' 0:value 28 | add-highlighter shared/plumbing/code/keywords regex '\b(add|delete|is|isdir|isfile|matches|plumb|set|start|to)\b' 0:keyword 29 | 30 | } 31 | -------------------------------------------------------------------------------- /release.nix: -------------------------------------------------------------------------------- 1 | { nixpkgs ? (import ./nixpkgs.nix), ... }: 2 | let 3 | pkgs = import nixpkgs { 4 | config = {}; 5 | overlays = [ 6 | (import ./overlay.nix) 7 | ]; 8 | }; 9 | in { 10 | test = pkgs.stdenv.mkDerivation { 11 | name = "kak-plumb-test-2019.10.10"; 12 | src = ./.; 13 | 14 | buildInputs = [ pkgs.bash pkgs.kakoune-unwrapped ]; 15 | buildPhase = '' 16 | patchShebangs --build test/9 17 | ${pkgs.bash}/bin/bash test/tests.bash 18 | ''; 19 | installPhase = '' 20 | mkdir -p "$out" 21 | ''; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | in.txt 2 | 9commands.txt 3 | debug.txt 4 | selections.txt 5 | -------------------------------------------------------------------------------- /test/9: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ( 3 | printf 'did_command' 4 | for arg in "$@"; do 5 | printf " '%s'" "${arg//"'"/"''"}" 6 | done 7 | printf '\n' 8 | ) >>test/9commands.txt 9 | -------------------------------------------------------------------------------- /test/functions.bash: -------------------------------------------------------------------------------- 1 | TEST_COUNT=0 2 | TESTS_FAILED=0 3 | TEST_OK=true 4 | PLUMB_ATTRS='' 5 | PLUMB_WDIR='' 6 | PLUMB_DATA='' 7 | 8 | h2() { 9 | printf '\n \e[33;1m%s\e[0m\n' "$1" 10 | } 11 | 12 | h3() { 13 | printf ' \e[33m%s\e[0m\n' "$1" 14 | } 15 | 16 | fail() { 17 | if $TEST_OK; then 18 | printf '\e[31;1mfailed\e[0m\n' 19 | fi 20 | TEST_OK=false 21 | local escaped_out="$TEST_OUT" 22 | escaped_out="${escaped_out///\\x0E}" 23 | escaped_out="${escaped_out///\\x0F}" 24 | printf ' Assertion: \e[31m%s\e[0m\n' "$*" 25 | printf ' Selections: %s\n' "$(cat test/selections.txt 2>/dev/null)" 26 | printf " Commands:\n" 27 | cat test/9commands.txt 28 | printf " Debug:\n" 29 | cat test/debug.txt 30 | printf '\n' 31 | } 32 | 33 | did_command() { 34 | case "$1" in 35 | plumb) 36 | shift 37 | while (( $# > 0 )); do 38 | case "$1" in 39 | -a) 40 | PLUMB_ATTRS="$2" 41 | shift 2 42 | ;; 43 | -w) 44 | PLUMB_WDIR="$2" 45 | shift 2 46 | ;; 47 | *) 48 | PLUMB_TEXT="$1" 49 | shift 50 | ;; 51 | esac 52 | done 53 | ;; 54 | esac 55 | } 56 | 57 | t() { 58 | local description="$1" 59 | shift 60 | 61 | local in='' keys='' flags='' 62 | while true; do 63 | case "$1" in 64 | -in) 65 | in="$2" 66 | shift 2 67 | ;; 68 | -keys) 69 | keys="$2" 70 | shift 2 71 | ;; 72 | -flags) 73 | flags="$2" 74 | shift 2 75 | ;; 76 | *) 77 | break 78 | ;; 79 | esac 80 | done 81 | 82 | printf ' %s ... ' "$description" 83 | printf '' >test/9commands.txt 84 | printf '%s' "$in" |sed -e 's/\\n/\n/g' >test/in.txt 85 | 86 | PATH=./test:"$PATH" kak -n $flags -ui json -e ' 87 | source rc/plumb.kak 88 | try %{ 89 | exec -save-regs / %{%s%\(\K[^)]+\)ai} 90 | } catch %{ exec gg } 91 | hook global RuntimeError .* %{ 92 | echo -debug -- error: %val{hook_param} 93 | eval -buffer *debug* write test/debug.txt 94 | quit! 95 | } 96 | execute-keys -with-hooks -with-maps %{'"$keys"'} 97 | eval -buffer *debug* write test/debug.txt 98 | nop %sh{ 99 | printf %s\\n "$kak_quoted_selections" >test/selections.txt 100 | } 101 | quit 0 102 | ' test/in.txt >/dev/null 0 )); do 110 | case "$1" in 111 | -attr) 112 | case " $PLUMB_ATTRS " in 113 | *" $2 "*) 114 | ;; 115 | *) 116 | fail "$@" 117 | ;; 118 | esac 119 | shift 2 120 | ;; 121 | -plumbs) 122 | if [[ $PLUMB_TEXT != $2 ]]; then 123 | fail "$@" 124 | fi 125 | shift 2 126 | ;; 127 | -selects) 128 | if [[ $(cat test/selections.txt) != $2 ]]; then 129 | fail "$@" 130 | fi 131 | shift 2 132 | ;; 133 | -wdir) 134 | if [[ $PLUMB_WDIR != $2 ]]; then 135 | fail "$@" 136 | fi 137 | shift 2 138 | ;; 139 | *) 140 | fail "$1" 141 | break 142 | ;; 143 | esac 144 | done 145 | 146 | TEST_COUNT=$(( TEST_COUNT + 1 )) 147 | if $TEST_OK; then 148 | printf 'ok\n' 149 | else 150 | TESTS_FAILED=$(( TESTS_FAILED + 1 )) 151 | fi 152 | } 153 | 154 | summarize() { 155 | local color='' 156 | if (( TESTS_FAILED > 0 )); then 157 | color="$(printf '\e[31;1m')" 158 | fi 159 | printf '\n%s%d tests, %d failed.\e[0m\n' "$color" $TEST_COUNT $TESTS_FAILED 160 | } 161 | -------------------------------------------------------------------------------- /test/tests.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | source test/functions.bash 3 | 4 | h2 'selection length >1' 5 | t 'plumbs selected text' -in 'h%(ello) world' -keys '' -plumbs ello 6 | t 'sends session name' -flags '-s test-plumb' -in 'h%(ello) world' -keys '' -attr session=test-plumb 7 | t 'sends current working directory when plumb_wdir is blank' -in 'h%(ello) world' -keys '' -wdir $PWD 8 | t 'sends plumb_wdir directory when not blank' -in 'h%(ello) world' -keys ':set-option buffer plumb_wdir /tmp/foo' -wdir /tmp/foo 9 | 10 | h2 'selection length =1' 11 | h3 'in WORD' 12 | t 'plumbs WORD' -in 'h%(e)llo world' -keys '' -plumbs hello -attr click=1 13 | t 'sends session name' -flags '-s test-plumb' -in 'h%(e)llo world' -keys '' -attr session=test-plumb 14 | 15 | h3 'on whitespace before WORD' 16 | t 'plumbs following WORD' -in '%( ) hello world' -keys '' -plumbs hello -attr click=0 17 | t 'sends session name' -flags '-s test-plumb' -in '%( ) hello world' -keys '' -attr session=test-plumb 18 | 19 | h2 'in *grep* buffer' 20 | #t 'pressing enter plumbs match' 21 | #t 'sends current working directory' 22 | #t 'grep-next plumbs next match' 23 | #t 'grep-previous plumbs previous match' 24 | 25 | h2 'in *make* buffer' 26 | #t 'pressing enter plumbs error' 27 | #t 'sends current working directory' 28 | #t 'make-next plumbs next error' 29 | #t 'make-previous plumbs previous error' 30 | 31 | summarize 32 | --------------------------------------------------------------------------------