diff options
author | makefu <github@syntax-fehler.de> | 2013-12-30 03:03:22 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2013-12-30 03:03:22 +0100 |
commit | 96151bd07330aee400fb99fd9f8f117bae42c9e5 (patch) | |
tree | 44c3f35a4d89e96ec97812a5879baa30bb4df0b8 /bridge | |
parent | 4ae4f5f461a6d5f6290ef7da516ea22db93bfd91 (diff) |
bridge -> Cancer/\1
Diffstat (limited to 'bridge')
l--------- | bridge/README.md | 1 | ||||
-rwxr-xr-x | bridge/bin/bridge | 12 | ||||
-rw-r--r-- | bridge/etc/bash_completion.d/bridge | 18 | ||||
-rwxr-xr-x | bridge/lib/bridge/bin/attach | 10 | ||||
-rwxr-xr-x | bridge/lib/bridge/bin/create | 15 | ||||
-rwxr-xr-x | bridge/lib/bridge/bin/destroy | 12 | ||||
-rwxr-xr-x | bridge/lib/bridge/bin/list | 10 | ||||
-rwxr-xr-x | bridge/lib/bridge/bin/paste | 30 | ||||
-rw-r--r-- | bridge/share/doc/bridge/README.md | 59 | ||||
-rw-r--r-- | bridge/share/vim/vimfiles/plugin/bridge.vim | 113 |
10 files changed, 0 insertions, 280 deletions
diff --git a/bridge/README.md b/bridge/README.md deleted file mode 120000 index 7c994fe2..00000000 --- a/bridge/README.md +++ /dev/null @@ -1 +0,0 @@ -share/doc/bridge/README.md
\ No newline at end of file diff --git a/bridge/bin/bridge b/bridge/bin/bridge deleted file mode 100755 index 33cf4577..00000000 --- a/bridge/bin/bridge +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/sh -# -# Interface to the bridge commands. -# -# See commands below $bindir -# -set -euf - -bindir="$(dirname $(readlink -f "$0"))/../lib/bridge/bin" -cmd="$bindir/$1"; shift - -exec "$cmd" "$@" diff --git a/bridge/etc/bash_completion.d/bridge b/bridge/etc/bash_completion.d/bridge deleted file mode 100644 index 86d8a4e2..00000000 --- a/bridge/etc/bash_completion.d/bridge +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/bash -function comp_bridge() { - local cword="${COMP_WORDS[$COMP_CWORD]}" - local bindir="$(dirname $(readlink -f "$BASH_SOURCE"))/../../lib/bridge/bin" - case $COMP_CWORD in - (1) - COMPREPLY=( $(cd "$bindir" && ls | grep "^$cword.*") ) - ;; - (2) - case "${COMP_WORDS[1]}" in - (attach|destroy|paste) - COMPREPLY=( $(bridge list 2>/dev/null | grep "^$cword.*") ) - ;; - esac - ;; - esac -} -complete -F comp_bridge bridge diff --git a/bridge/lib/bridge/bin/attach b/bridge/lib/bridge/bin/attach deleted file mode 100755 index f456f8a6..00000000 --- a/bridge/lib/bridge/bin/attach +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -# -# Attach current tty to a session. -# -## SYNOPSIS -# -# bridge attach SESSION -# -set -euf -exec tmux -L bridge attach-session -t "$1" diff --git a/bridge/lib/bridge/bin/create b/bridge/lib/bridge/bin/create deleted file mode 100755 index 2df8b214..00000000 --- a/bridge/lib/bridge/bin/create +++ /dev/null @@ -1,15 +0,0 @@ -#! /bin/sh -# -# Create a new session. -# -## SYNOPSIS -# -# bridge create SESSION [COMMAND [ARGS ...]] -# -# COMMAND defaults to $SHELL (by implication / tmux) -# -set -euf -target="$1"; shift -tmux -L bridge new-session -d -s "$target" "$@" -tmux -L bridge set-buffer READY. -exec "$(dirname $0)/attach" "$target" diff --git a/bridge/lib/bridge/bin/destroy b/bridge/lib/bridge/bin/destroy deleted file mode 100755 index dffdbd8a..00000000 --- a/bridge/lib/bridge/bin/destroy +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/sh -# -# Destroy a session. -# -## SYNOPSIS -# -# bridge destroy SESSION -# -# Note that this may destroy similar named sessions (by implication / tmux) -# -set -euf -tmux -L bridge kill-session -t "$1" diff --git a/bridge/lib/bridge/bin/list b/bridge/lib/bridge/bin/list deleted file mode 100755 index 0b767a9b..00000000 --- a/bridge/lib/bridge/bin/list +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -# -# Write a list of all session names to stdout. -# -## SYNOPSIS -# -# bridge list -# -set -euf -exec tmux -L bridge list-sessions | cut -d: -f1 diff --git a/bridge/lib/bridge/bin/paste b/bridge/lib/bridge/bin/paste deleted file mode 100755 index d3ed1fc5..00000000 --- a/bridge/lib/bridge/bin/paste +++ /dev/null @@ -1,30 +0,0 @@ -#! /bin/sh -# -# Paste some data to a session. -# -## SYNOPSIS -# -# bridge paste SESSION DATA... -# bridge paste SESSION < DATA -# -set -euf - -target="$1"; shift - -# paste args or stdin -if test $# -gt 0; then - tmux -L bridge set-buffer -b 0 "$*" -else - # use aux file instead of direct stdin for Vim and when used from $SHELL - if test -n "${VIMRUNTIME-}" || tty >/dev/null; then - path=`mktemp` - trap "rm -f $path" EXIT INT TERM - cat>$path - else - path=- - fi - tmux -L bridge load-buffer -b 0 $path -fi - -tmux -L bridge paste-buffer -b 0 -t "$target" -tmux -L bridge set-buffer -b 0 READY. diff --git a/bridge/share/doc/bridge/README.md b/bridge/share/doc/bridge/README.md deleted file mode 100644 index 77c62374..00000000 --- a/bridge/share/doc/bridge/README.md +++ /dev/null @@ -1,59 +0,0 @@ -Bridge is a tool to connect your favourite editor and interpreter (or -similar) for maximum profit. - - -## usage by example - - # start your favourite interpreter, e.g. bc, in a new session - bridge create my_fancy_interpreter bc - - # attach a terminal to the session - bridge attach my_fancy_interpreter - - # fire up your favourite editor (in another terminal) - vim - # press <F12> to connect to the session - # press return - # write interpreter stuff, e.g. 42^23 - # mark that stuff - # press return - - # paste some stuff into the session - bridge paste my_fancy_interpreter '1 + 2 + 4^M' - # (note that ^M is carriage return obtained by pressing ^V^M AKA C-V C-M) - - # or use bridge as a sink in your pipeline - echo 2^20 | bridge paste my_fancy_interpreter - - # you can use tab-completion everywhere (if installed) - - -## install bridge (bourne) shell integration - -Hint #1: reboot your system or similar for this to take full effect -Hint #2: you could also use ~/.profile or similar - - echo 'PATH="${PATH+$PATH:}//bridge/bin"' >> /etc/profile - - -## install bridge Vim integration - -Hint: your vim-setup probably differs - - ln -s //bridge/share/vim/plugin/bridge.vim ~/.vim/plugin/ - - -## install bridge bash completion - -Hint #1: reboot your system or similar for this to take full effect -Hint #2: this could differ on your system, of course -Hint #3: you could also use ~/.profile or similar - - ln -s //bridge/etc/bash_completion.d/bridge /etc/bash_completion.d/ - - -## install bridge into some usr-like hierarchy [advanced] - - tar -C //bridge -c . | - tar --exclude=./README.md -C ~/opt -v --keep-newer-files -x - diff --git a/bridge/share/vim/vimfiles/plugin/bridge.vim b/bridge/share/vim/vimfiles/plugin/bridge.vim deleted file mode 100644 index 91f072d1..00000000 --- a/bridge/share/vim/vimfiles/plugin/bridge.vim +++ /dev/null @@ -1,113 +0,0 @@ -" /vim/bridge.vim - -if ! exists('s:bridge_name') - let s:bridge_name = "" -endif - -fun! Bridge_complete(A,L,P) - let a = strpart(a:A,0,a:P) - return split(system("bridge list \"".a.".*\""), "\n") -endfun - -fun! Bridge_status() - if s:bridge_name == "" - return "Disconnected" - else - return "Connected to " . s:bridge_name - else - endif -endfun - -setlocal statusline=%<%f\ \(%{Bridge_status()}\)\ %h%m%r%=%-14.(%l,%c%V%)\ %P\ of\ %L\ \(%.45{getcwd()}\) - -fun! Bridge_display() - if s:bridge_name == "" - echo "Not connected!" - return - endif - let cmd = "bridge attach ".s:bridge_name - silent exe "!" . cmd - redraw! -endfun - -fun! Bridge_connect() - if s:bridge_name == "" - let m = "boot new" - else - let m = s:bridge_name - endif - let name = input("Connect to [".m."]: ", "", "customlist,Bridge_complete") - if name == "" - if s:bridge_name != '' - " stay connected - echo - return - endif - let system = input("Command: ", "") - if system == "" - echo "Aborted!" - return - endif - let name = input("Session name: ", "") - if name == "" - echo "Aborted!" - return - endif - TODO_boot_new - endif - if system("bridge list ".name) == "" - echo "No such session: ".name - return - endif - let s:bridge_name = name - let s:laststatus = &laststatus - let &laststatus = 2 - echo "Connected to " . s:bridge_name -endfun - -fun! Bridge_disconnect(m) - if s:bridge_name == "" - echo "Not connected!" - else - let &laststatus = s:laststatus - let m = "Disconnected from ".s:bridge_name - if a:m != "" - let m .= ": ".a:m - endif - echo m."!" - let s:bridge_name = "" - endif -endfun - -function! Bridge_paste( data ) - if a:data == '' - echo "Nothing to send!" - else - let l:data = a:data - if exists("g:bridge_prologue") | let l:data = g:bridge_prologue . l:data | endif - if exists("g:bridge_epilogue") | let l:data = l:data . g:bridge_epilogue | endif - call system("bridge paste " . s:bridge_name, l:data . "\<cr>") - endif -endfunction - -nmap <C-F12> :call Bridge_display()<cr> -nmap [24^ <C-F12> -nmap <F12> :call Bridge_connect()<cr> -nmap <S-F12> :call Bridge_disconnect("")<cr> -nmap [24$ <S-F12> - -nmap <leader>el :call Bridge_paste(getline("."))<cr> -nmap <leader>ec m'ya(:call Bridge_paste(getreg('"'))<cr>`' -nmap <leader>et m'(y%:call Bridge_paste(getreg('"'))<cr>`' - -nmap <leader>ee :call Bridge_paste(input("paste: ", ""))<cr> - -" sugar -nmap <Return> <leader>ec - -"" visual shell -vmap <return> m'y:call Bridge_paste(getreg('"'))<cr>v`' -vmap <leader>ee :call Bridge_paste(input("paste: ", ""))<cr> -vmap <leader>et <return> - - |