dot

packages and services management
Log | Files | Refs | README

commit 018618b9f820cf712e8fc2bcb2a1628ccedc7802
parent 687ecbc62f14b3202c7493ca5e72bb17acad8bdb
Author: josuah <mail@josuah.net>
Date:   Fri, 18 Nov 2016 23:04:23 -0500

Simplified and improved buffer

Diffstat:
M.profile | 8++++----
Mbin/buffer | 75++++++++++-----------------------------------------------------------------
Mbin/config-link | 2+-
Mbuild/iomenu | 2+-
4 files changed, 16 insertions(+), 71 deletions(-)

diff --git a/.profile b/.profile @@ -50,10 +50,10 @@ export PS3=' > ' alias l='ls -lhF --color' alias la='ls -AlhF --color' alias p='$PAGER' -alias a='buffer attach' -alias r='buffer run' -alias v='buffer run $VISUAL' -alias s='buffer run $SHELL' +alias a='buffer' +alias b='buffer' +alias v='b $VISUAL' +alias s='b $SHELL' alias t='tmux attach &>/dev/null || tmux new' alias f='find . -type f ! -path "*/.git/*" | sed "s/^\\.\\///" | iomenu' alias d='find . -type d ! -path "*/.git/*" | sed "s/^\\.\\///" | iomenu' diff --git a/bin/buffer b/bin/buffer @@ -9,13 +9,6 @@ # Busybox: mkdir, sort, tr, sed, exec -HELP=' -Usage: buffers COMMAND - -COMMAND - r[run] [command] Run command in an abduco session - a[ttach] Interactively prompt buffer to attach, display. -' CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/dmenu_run" COMMAND="$2" NL=' @@ -74,12 +67,19 @@ get_name() printf %s "$name" | tr / ! } + # # Get the options according to the command and run it # -run() +main() { - local command="${1:-$(iomenu -l 256 < $CACHE)}" options path + local command="${1:-$( + iomenu -l 256 -s '#' << EOF | tr / ! +# $(abduco | tr ! / | sed -r '2,$ s/(.*)\t(.*)/\2 # \1/') +# Commands +$(cat "$CACHE") +EOF + )}" options path case "$command" in @@ -95,7 +95,7 @@ run() alsamixer ) options='-c 1' ;; - mail | mailx | s-nail | music | iirc ) + mail | mailx | s-nail | music | iirc | 'vim '*) options='' ;; @@ -131,59 +131,4 @@ run() } -# -# Attach to an existing abduco session. -# -attach() -{ - local name - - # if already on a session, print its name and exit - if [ "$ABDUCO" ] - then - printf '[ %s ]\n' "$ABDUCO" | tr ! / - exit 1 - fi - - # overwrite the prompt - printf '\033[A' - - # get the session name by prompting the user - name="$( - abduco | - tr ! / | - sed -r '1 s/^/# /; s/(.*)\t(.*)/\2 # \1/' | - iomenu -s '#' -l 8 | - tr / ! - )" - - # set the name of the terminal. - printf '\033]0;%s\007' "$name" | tr ! / - - # attach to the session. - if [ "$name" ] - then - TERM='screen' ABDUCO="$name" exec abduco -e '^z' -a "$name" - fi -} - - -main() -{ - # parse the arguments - case "$1" in - r | run ) - update_cache - run "$2" - ;; - a | attach ) - attach - ;; - * ) - printf '%s\n' "$help" - exit 0 - ;; - esac -} - main $@ diff --git a/bin/config-link b/bin/config-link @@ -14,7 +14,7 @@ link() do destination="$HOME/${file#$CONFIG/}" - printf '%s\n' "${destination%/*}" + printf '%s\n' "$destination" mkdir -p "${destination%/*}" ln -sf "$file" "$destination" done diff --git a/build/iomenu b/build/iomenu @@ -1,3 +1,3 @@ # Input/Output interactive menu and completion engine. -tar=http://repo.or.cz/iomenu.git/snapshot/2cad1b6e9e78637a21e7d5877113e7f5e5d75d98.tar.gz +tar=http://repo.or.cz/iomenu.git/snapshot/28815096e34172ebe85a1c5f45adcc4c40c72c6c.tar.gz