X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=bash%2F.bash_aliases;h=952029c6af8df02214836da349205b8f7d54534f;hb=931f09be7e7d09db5c26616096d285e9964b6c5e;hp=36e02d4dfdcb6bc659acc78c08415933a9fbfe5f;hpb=1639aeb9b2bbc063e3a80949e770aea8786ce1d7;p=max%2Fdotfiles.git diff --git a/bash/.bash_aliases b/bash/.bash_aliases index 36e02d4..952029c 100644 --- a/bash/.bash_aliases +++ b/bash/.bash_aliases @@ -1,3 +1,5 @@ +#!/bin/bash + if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' @@ -9,5 +11,23 @@ if [ -x /usr/bin/dircolors ]; then alias egrep='egrep --color=auto' fi -alias la='ls -lah' +function la { + ls_out=$(\ls -lah --color=always "$@") + let "allowed_lines = $(tput lines) - 3" + if [ $(echo "$ls_out" | wc -l) -le $allowed_lines ]; then + echo "$ls_out" + else + echo "$ls_out" | less -r + fi +} alias tmux='TERM=xterm-256color tmux' +if [ -x /usr/bin/gvim ]; then + alias vim='gvim -v' +fi + + +function ssh_in() { + i3-sensible-terminal -e \ + ssh -o RemoteCommand="/bin/sh -c 'tmux has-session && exec tmux attach || exec tmux'" \ + -t "$@" +}