bashrc: +xcopy, better notify, interactive autojump

This commit is contained in:
Johann Dreo 2014-02-18 21:20:05 +01:00
commit dd678df75c

26
.bashrc
View file

@ -32,6 +32,9 @@ function myip()
echo $MY_IP echo $MY_IP
} }
# copy a stream in the X clipboard, e.g. "cat file | xcopy"
alias xcopy="xclip -i -selection clipboard"
# baskcup shortcuts # baskcup shortcuts
alias rcp='rsync -avz --ignore-existing --progress --rsh "ssh -l nojhan" ' alias rcp='rsync -avz --ignore-existing --progress --rsh "ssh -l nojhan" '
alias rcp_443='rsync -avz --ignore-existing --progress --rsh "ssh -p 443 -l nojhan" ' alias rcp_443='rsync -avz --ignore-existing --progress --rsh "ssh -p 443 -l nojhan" '
@ -110,7 +113,7 @@ export LESS="-FX -R"
export LESSOPEN='|~/code/dotfiles/lessfilter.sh %s' export LESSOPEN='|~/code/dotfiles/lessfilter.sh %s'
# nautilus file manager in browser mode without destkop management # nautilus file manager in browser mode without destkop management
alias nautile='nautilus --no-desktop --browser' alias Ex='nautilus --no-desktop --browser .'
# Make a directory and move to it # Make a directory and move to it
function md() { function md() {
@ -138,6 +141,8 @@ function psg() {
# Notify when a command is completed, with an audio and visual warning. # Notify when a command is completed, with an audio and visual warning.
function notify() { function notify() {
s=$SECONDS
cmd="$1" cmd="$1"
$@ $@
if [[ $? ]] ; then if [[ $? ]] ; then
@ -145,7 +150,14 @@ function notify() {
else else
msg="There was an error in your \"$cmd\" command" msg="There was an error in your \"$cmd\" command"
fi fi
espeak -s 110 "$msg" 2>&1 > /dev/null & zenity --info --text "$msg\n\n$(date)" zenity --info --text "$msg\nin $((e-s)) s\n$(date)" &
# if the command has run more than a minute
# then say loudly that it ended
e=$SECONDS
if [[ $((e-s)) -ge 60 ]] ; then
espeak -s 110 "$msg" 2>/dev/null >/dev/null
fi
} }
@ -155,6 +167,7 @@ function notify() {
alias agrep="ag" alias agrep="ag"
alias ag="~/apps/the_silver_searcher-master/ag" alias ag="~/apps/the_silver_searcher-master/ag"
alias kak="/home/nojhan/code/kakoune/src/kak"
# repeat n times command # repeat n times command
# repeat 10 echo "ok" # repeat 10 echo "ok"
@ -245,7 +258,7 @@ echo "rcp : copy with rsync/ssh"
} }
# do not permits to recall dangerous commands in bash history # do not permits to recall dangerous commands in bash history
export HISTIGNORE='&:[bf]g:exit:*>|*::*rm*-rf*:*rm*-f*' export HISTIGNORE='&:[bf]g:exit:*>|*:*rm*-rf*:*rm*-f*'
# append history rather than overwrite # append history rather than overwrite
shopt -s histappend shopt -s histappend
# one command per line # one command per line
@ -262,14 +275,17 @@ HISTTIMEFORMAT='%F %T '
# Manually switch to the bépo keyboard layout # Manually switch to the bépo keyboard layout
alias bepo="setxkbmap -layout fr -variant bepo -option" alias bepo="setxkbmap -layout fr -variant bepo -option"
# Use liquidprompt only if in an interactive shell
if [[ $- == *i* ]]; then if [[ $- == *i* ]]; then
# Super nice prompt # Super nice prompt
source ~/.liquidpromptrc source ~/.liquidpromptrc
source ~/.liquidprompt source ~/.liquidprompt
fi fi
# Added by autojump install.sh # Use autojump only if in an interactive shell
#source /etc/profile.d/autojump.bash if [[ $- == *i* ]] ; then
source /etc/profile.d/autojump.bash
fi
export TCLLIBPATH="~/.local/share/tkthemes" export TCLLIBPATH="~/.local/share/tkthemes"