1
0
Fork 0

rely on termcompat script instead of declaring tcmp in shellrc

This commit is contained in:
Von Random 2018-07-18 16:12:41 +03:00
parent f6d19db338
commit ce84d3aa68
2 changed files with 16 additions and 20 deletions

20
bashrc
View file

@ -42,7 +42,6 @@ alias rgrep='command grep --exclude-dir=\.git -R'
alias ggrep='command git grep' alias ggrep='command git grep'
alias tailf='command less -R +F' alias tailf='command less -R +F'
alias diff='command diff --color' alias diff='command diff --color'
alias s='tcmp ssh'
# ls # ls
alias ls='command ls --color=auto --group-directories-first ' alias ls='command ls --color=auto --group-directories-first '
@ -84,20 +83,19 @@ gdiff() { /usr/bin/git diff --color "$@"; }
gdf() gdf()
{ {
local difftool local difftool
if difftool=$(whence sdiff-so-fancy); then if difftool=$(command -v sdiff-so-fancy); then
gdiff "$@" | $difftool | less --tabs=4 -RSFX gdiff "$@" | "$difftool" | less --tabs=4 -RSFX
else else
gdiff "$@" gdiff "$@"
fi fi
} }
# term compatibility for remote stuff # more compatible TERM for ssh sessions
tcmp() { s() {
local -A terms=( if termcompat=$(command -v termcompat); then
[rxvt-unicode-256color]='rxvt-unicode' "$termcompat" ssh "$@"
[st-256color]='xterm-256color' else
[tmux-256color]='screen.xterm-new' ssh "$@"
) fi
TERM="${terms[$TERM]:-$TERM}" "$@"
} }
# we want to see exit code on error (it also has to be the last entry here) # we want to see exit code on error (it also has to be the last entry here)

16
zshrc
View file

@ -148,7 +148,6 @@ alias rgrep='command grep --exclude-dir=\.git -R'
alias ggrep='command git grep' alias ggrep='command git grep'
alias tailf='command less -R +F' alias tailf='command less -R +F'
alias diff='command diff --color' alias diff='command diff --color'
alias s='tcmp ssh'
# ls # ls
alias ls='command ls --color=auto --group-directories-first ' alias ls='command ls --color=auto --group-directories-first '
@ -199,13 +198,12 @@ greset() {
/usr/bin/git clean -fd /usr/bin/git clean -fd
/usr/bin/git reset --hard /usr/bin/git reset --hard
} }
# term compatibility for remote stuff # more compatible TERM for ssh sessions
tcmp() { s() {
local -A terms=( if termcompat=$(whence termcompat); then
'rxvt-unicode-256color' 'rxvt-unicode' $termcompat ssh "$@"
'st-256color' 'xterm-256color' else
'tmux-256color' 'screen.xterm-new' ssh "$@"
) fi
TERM=${terms[$TERM]:-$TERM} "$@"
} }
# }}} # }}}