dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone git://edryd.org/dotfiles
Log | Files | Refs

commit b8b71267f70ad6f39d61c540aa681707b1690835
parent 89283b58360899fcc711e4e074b0add7415dfbb9
Author: Ed van Bruggen <edvb54@gmail.com>
Date:   Thu, 10 Aug 2017 00:23:49 -0700

bin: Update ED and g, add back ed and sett

Diffstat:
bin/ED.sh | 20+++++++++++---------
bin/ed | 17+++++++++++++++++
bin/g | 3+--
bin/sett | 12++++++++++++
4 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/bin/ED.sh b/bin/ED.sh @@ -2,17 +2,19 @@ # ED: change between $EDITORs # -# To install add `source path/to/ED.sh` to your shell's rc file +# toggles your $EDITOR between your different editors. +# To install add `source path/to/ED.sh` to your shell's rc file. ED() { - local EDITOR_new - if [[ $EDITOR == "vim" ]]; then - EDITOR_new="emacs" - elif [[ $EDITOR == "emacs" ]]; then - EDITOR_new="vim" + local new + if [[ "$1" != "" ]]; then + new="$1" + elif [[ $EDITOR == "vim" ]]; then + new="emacs" + else + new="vim" fi - echo "Setting EDITOR to $EDITOR_new" - EDITOR=$EDITOR_new + echo "Setting \$EDITOR to $new" + EDITOR=$new } - diff --git a/bin/ed b/bin/ed @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# ed: edit files with your $EDITOR +# +# Opens a file with your $EDITOR. If no argument is given then it opens the +# whole directory into a tree view, or if there is only a few files in the +# current directly then it just opens all of them. + +if [[ "$@" == "" ]]; then + if [[ $(ls -l | wc -l) -le 5 ]]; then + $EDITOR ./* + else + $EDITOR . + fi +else + $EDITOR "$@" +fi diff --git a/bin/g b/bin/g @@ -1,10 +1,9 @@ #!/usr/bin/env bash -# g: tiny wrapper for git +# g: tiny git wrapper if [[ $# -eq 0 ]]; then git status else git "$@" fi - diff --git a/bin/sett b/bin/sett @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# sett: set title of a terminal +# +# Change the title of any terminal window. If no argument is given it sets the +# title to the working directory, otherwise the supplied TITLE is used. + +title=$1 +if [[ -z $title ]]; then + title="$(basename "$PWD")" +fi +echo -n "]0;$title"