summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-10-12 08:46:35 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-10-12 08:56:05 +0200
commitf85403bfe61940f7dc55f2c1bc9ea8aeef60224f (patch)
tree402666c0ff4c749953279ef3e9cc399053c5fea9
parentff06577f133f2f9235c7340ae7a6a650c8ce7a95 (diff)
downloaddotfiles-f85403bfe61940f7dc55f2c1bc9ea8aeef60224f.tar.gz
dotfiles-f85403bfe61940f7dc55f2c1bc9ea8aeef60224f.tar.bz2
dotfiles-f85403bfe61940f7dc55f2c1bc9ea8aeef60224f.zip
bash: Let "r" resize explicitly using 0,1 or 2 args
-rw-r--r--.config/bash/alias.sh3
-rw-r--r--.config/bash/functions.sh10
2 files changed, 11 insertions, 2 deletions
diff --git a/.config/bash/alias.sh b/.config/bash/alias.sh
index 7299b6b..eef3f17 100644
--- a/.config/bash/alias.sh
+++ b/.config/bash/alias.sh
@@ -10,8 +10,7 @@ alias lh="ls -d .[^.]*"
alias la="ls -a"
# resizing terminal
-alias r="resize_to_min 100 35"
-alias s="resize 60 17"
+alias s="r 60 17"
# resize terminal before launching curses-apps
alias vim="r; vim"
diff --git a/.config/bash/functions.sh b/.config/bash/functions.sh
index dc49e58..06547ed 100644
--- a/.config/bash/functions.sh
+++ b/.config/bash/functions.sh
@@ -24,6 +24,16 @@ resize_to_min() {
printf "\e[8;%d;%dt" $(max $LINES $2) $(max $COLUMNS $1)
}
+function r() {
+ if [ $# -ge 2 ]; then
+ resize $1 $2
+ elif [ $# -ge 1 ]; then
+ resize $1 $LINES
+ else
+ resize_to_min 100 35
+ fi
+}
+
nh() {
nohup "$@" &> /dev/null &
}