dot

packages and services management
Log | Files | Refs | README

commit 72158bab3efc8268508a437ae02a28294ce0b110
parent b87b78ab0afe3331968ae4fe0b5568a657bdb733
Author: josuah <mail@josuah.net>
Date:   Sun,  4 Sep 2016 17:31:51 +0200

Merged run and attach

Diffstat:
Dbin/attach | 30------------------------------
Abin/buffers | 109+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dbin/run | 65-----------------------------------------------------------------
Dbin/tags | 125-------------------------------------------------------------------------------
Mshell/.profile | 6+++---
Dtags | 0
Mvim/.vimrc | 2+-
7 files changed, 113 insertions(+), 224 deletions(-)

diff --git a/bin/attach b/bin/attach @@ -1,30 +0,0 @@ -#!/bin/sh -# /\ /\ /\ -# _____ / /_ / /_ _____ ____ / /_ -# .'__ // ___\/ ___\.'__ // ___\ / __ \ -# / /_/ // / / / / /_/ // /__ / / / / -# \____/ \/ \/ \____/ \____\ \/ \/ - Attach to an abduco session -#=============================================================================== - -# External: abduco, fzy -# Busybox: tr, sort, sed - -TAB=' ' # Make literal tabs explicit on the code - -# If already on a session, print its name and exit -[ "$ABDUCO" ] && printf '[ %s ]\n' "$ABDUCO" | tr '!' '/' && exit 1 - -printf '\033[1A' - -# get the session name by prompting the user -name="$(abduco | sed 1d | sort -t "$TAB" -k 3 | tr '!' '/' | fzy | tr '/' '!')" -name="${name##*$TAB}" -printf '%s\n' "$name" - -# Reset the screen, set the name of the session and attath to it -printf '\033[2J\033[0;0f\033[0m\033]0;%s\007' "$name" | tr '!' '/' -[ "$name" ] && TERM=screen ABDUCO="$name" abduco -e '^z' -a "$name" - -# Reminder of current sessions -printf '\n' -abduco | tr '!' '/' | sort -t "$TAB" -k 3 | sed '1d; s/^/ /' diff --git a/bin/buffers b/bin/buffers @@ -0,0 +1,109 @@ +#/bin/sh +# /\ ____ ____ +# / /_ __ /\ .' ___\.' ___\ ___ _____ +# / __ \ / / / // .'_ / .'_ .'__ \ / ____\ +# / /_/ // /_/ // ___/ / ___/ / ____// / +# \____/ \____/ \/ \/ \___\ \/ - run commands in detachable buffers +#=============================================================================== +# +# External: stest, fzy, abduco +# Busybox: mkdir, tee, sort, clear, tr, sed + +help=' +NAME + buffers - run commands in detachable buffers + +SYNTAX + buffers COMMAND + +DESCRIPTION + r, run [CMD] + If CMD not specified, ask interactively then run it in an + abduco session + a, attach + Interactively prompt buffer to attach, display. +' +NL=' +' +TAB=' ' + +case "$1" in +r | run ) + shift; for arg in $@; do cmd="$cmd $arg"; done; cmd="${cmd# }" + printf '%s\n' "$cmd" > ~/log + + # Get or create the cache file + cache="${XDG_CACHE_HOME:-"$HOME/.cache"}" + mkdir -p "$cache" + cache="$cache/dmenu_run" + + # Update the cathe and get the command + printf '\033[1A' + [ -z "$cmd" ] && cmd="$( + IFS=: + if stest -dqr -n "$cache" $PATH + then stest -flx $PATH | sort -u | tee "$cache" + else tee < "$cache" + fi | fzy + )" + printf '$ %s ' "$cmd" + + # Get command arguments and the session name + name="$cmd" + case "$cmd" in + '' ) exit 1 ;; + mbsync ) opt='-a' ;; + alsamixer ) opt='-c 1' ;; + ping ) opt='-c 3 www.wikipedia.org' ;; + feeds ) opt='read' ;; + irc ) opt='-i' ;; + htop | s-nail | rirc | agenda | music ) : ;; + vi | vim | vis | less | ex-vi | ex | ed | emacsclient ) + opt="$(find ./ -type f ! -path '*/.git/*' | fzy)" file="$opt" + ;; + * ) + read opt + if [ -z "${opt##*\**}" -a "$opt" ] + then + file="$(find ./ -type f | fzy)" + opt="${opt##*\*} $file ${opt%%\**}" + fi + ;; + esac + + # Update the name using the file path + if [ "$file" ] + then + file="$PWD/${file#./}" + [ -z "${file##$HOME*}" ] && file="~${file#$HOME}" + file=" $file" + fi + + # Start the command in an abduco session + TERM=screen ABDUCO="$cmd" abduco \ + -e '^z' \ + -A "$(printf '%s%s' "$cmd" "$file" | tr '/' '!')" $cmd $opt + ;; +a | attach ) + + # If already on a session, print its name and exit + [ "$ABDUCO" ] && printf '[ %s ]\n' "$ABDUCO" | tr '!' '/' && exit 1 + + printf '\033[1A' + + # get the session name by prompting the user + name="$(abduco | sed 1d | sort -t "$TAB" -k 3 | tr '!' '/' | fzy | tr '/' '!')" + name="${name##*$TAB}" + printf '%s\n' "$name" + + # Reset the screen, set the name of the session and attath to it + printf '\033[2J\033[0;0f\033[0m\033]0;%s\007' "$name" | tr '!' '/' + [ "$name" ] && TERM=screen ABDUCO="$name" abduco -e '^z' -a "$name" + + # Reminder of current sessions + printf '\n' + abduco | tr '!' '/' | sort -t "$TAB" -k 3 | sed '1d; s/^/ /' + ;; +* ) + printf '%s\' "$help" +esac diff --git a/bin/run b/bin/run @@ -1,65 +0,0 @@ -#/bin/sh -# _____ __ /\ ____ -# / ____\/ / / // __ \ -# / / / /_/ // / / / -# \/ \____/ \/ \/ - Pick a command to run in a dedicated abduco session -#=============================================================================== - -# External: stest, fzy, abduco -# Busybox: mkdir, tee, sort, clear - -NL=' -' # Trick to use newline character without breaking identation -cmd="$1" - -# Get or create the cache file -cache="${XDG_CACHE_HOME:-"$HOME/.cache"}" -mkdir -p "$cache" -cache="$cache/dmenu_run" - -# Update the cathe and get the command -printf '\033[1A' -[ -z "$cmd" ] && cmd="$( - IFS=: - if stest -dqr -n "$cache" $PATH - then stest -flx $PATH | sort -u | tee "$cache" - else tee < "$cache" - fi | fzy -)" -printf '$ %s ' "$cmd" - -# Get command arguments and the session name -name="$cmd" -case "$cmd" in -'' ) exit 1 ;; -mbsync ) opt='-a' ;; -alsamixer ) opt='-c 1' ;; -ping ) opt='-c 3 www.wikipedia.org' ;; -feeds ) opt='read' ;; -irc ) opt='-i' ;; -htop | s-nail | rirc | agenda | music ) : ;; -vi | vim | vis | less | ex-vi | ex | ed | emacsclient ) - opt="$(find ./ -type f ! -path '*/.git/*' | fzy)" file="$opt" - ;; -* ) - read opt - if [ -z "${opt##*\**}" -a "$opt" ] - then - file="$(find ./ -type f | fzy)" - opt="${opt##*\*} $file ${opt%%\**}" - fi - ;; -esac - -# Update the name using the file path -if [ "$file" ] -then - file="$PWD/${file#./}" - [ -z "${file##$HOME*}" ] && file="~${file#$HOME}" - file=" $file" -fi - -# Start the command in an abduco session -TERM=screen ABDUCO="$cmd" abduco \ - -e '^z' \ - -A "$(printf '%s%s' "$cmd" "$file" | tr '/' '!')" $cmd $opt diff --git a/bin/tags b/bin/tags @@ -1,125 +0,0 @@ -$ feeds /^NR > 1 && NR < $(NR-1) {$/ -BEGIN peax 10 -BOOKMARKS bkm 9 -C0 adagio 12 -END peax 25 -FEEDS feeds 9 -FILTER swiper 9 -IFS irc 268 -IFS updd 7 -LAYOUT www 9 -NF feeds 56 -NICK irc 11 -NL comment 10 -NL complete 18 -NL run 11 -PROGRAMS src 8 -R dna 15 -TAB attach 12 -c1 feeds 54 -c2 feeds 57 -c3 feeds 60 -check_read feeds /^check_read()$/ -cmd todo 7 -compile src /^compile()$/ -connect irc /^connect()$/ -copied lsync 54 -d1 lsync 43 -directories lsync 54 -directories www 37 -dna dna 94 -download src /^download()$/ -error src /^error()$/ -exit comment 53 -exit lsync 42 -f2 dna 18 -f3 dna 18 -f4 dna 18 -f5 dna 18 -f6 dna 18 -f7 dna 18 -get feeds /^get()$/ -get feeds 190 -h peax 21 -help lsync 9 -help src 157 -identical lsync 54 -info src /^info()$/ -input irc /^input()$/ -input irc 265 -l1 fig 22 -l1 fig 30 -l1 fig 38 -l1 fig 46 -l1 fig 54 -l1 fig 62 -l1 fig 70 -l1 fig 78 -l1 fig 86 -l1 fig 94 -l1 fig 102 -l1 fig 110 -l1 fig 118 -l1 fig 126 -l1 fig 134 -l1 fig 142 -l1 fig 150 -l1 fig 158 -l1 fig 166 -l1 fig 174 -l1 fig 182 -l1 fig 190 -l1 fig 198 -l1 fig 206 -l1 fig 214 -l1 fig 222 -l1 fig 230 -l1 fig 238 -l1 fig 246 -l1 fig 254 -l1 fig 262 -l1 fig 270 -l1 fig 278 -l1 fig 286 -l1 fig 294 -l1 fig 302 -l1 fig 310 -line updd 11 -list www /^list()$/ -max1 feeds 62 -max2 feeds 63 -middle comment 34 -middle comment 37 -middle comment 49 -music run 40 -nucleotide dna 87 -opt run 35 -opt run 36 -opt run 37 -opt run 38 -opt run 39 -opt run 42 -opt src 125 -output irc /^output()$/ -overwritten lsync 54 -parse feeds /^parse()$/ -parse www /^parse()$/ -path www 41 -print_msg irc /^print_msg()$/ -r lsync 41 -remove src /^remove()$/ -shift lsync 39 -start comment 28 -start comment 31 -start comment 40 -start comment 43 -start comment 46 -t todo 13 -tag bkm 22 -title www 41 -tmp piped 8 -todo todo 1 -v lsync 40 -view feeds /^view()$/ -view feeds 191 -website www 39 diff --git a/shell/.profile b/shell/.profile @@ -69,9 +69,9 @@ alias lla='l -Alh' alias weather='curl -4 wttr.in' alias lines='find . -name "*.[ch]" | xargs wc -l' alias myip='curl icanhazip.com' -alias a='attach' -alias r='run' -alias v='run $VISUAL' +alias a='buffers attach' +alias r='buffers run' +alias v='buffers run $VISUAL' alias p='$PAGER' alias f='find . -type f ! -path "*/.git/*" | fzy' alias d='find . -type d ! -path "*/.git/*" | fzy' diff --git a/tags b/tags diff --git a/vim/.vimrc b/vim/.vimrc @@ -10,7 +10,7 @@ "------------------------------------------------------------------------------- " Behavior -set autoindent copyindent laststatus=2 ruler +set autoindent copyindent laststatus=1 ruler " Text display set showmatch list listchars=tab:>\ ,eol:$ hlsearch