Browse Source

.bashrc: misc changes

pull/1/head
10sr 13 years ago
parent
commit
c052014b25
1 changed files with 32 additions and 15 deletions
  1. +32
    -15
      .bashrc

+ 32
- 15
.bashrc View File

@@ -22,9 +22,6 @@ export LESS="-iRM"
export GIT_PAGER=$PAGER export GIT_PAGER=$PAGER
export GIT_EDITOR=$EDITOR export GIT_EDITOR=$EDITOR


mkunfddir(){ # create dir if unfound. ?
test -e "$1" || mkdir "$1"
}
if test "${TERM}" == dumb if test "${TERM}" == dumb
then then
alias ls="ls -CFG --time-style=long-iso" alias ls="ls -CFG --time-style=long-iso"
@@ -44,8 +41,22 @@ alias rand="echo \$RANDOM"
alias xunp="file-roller -h" alias xunp="file-roller -h"
alias pacome="sudo \paco -D" alias pacome="sudo \paco -D"
alias destroy="rm -rf" alias destroy="rm -rf"
alias psall="ps auxww"
# type trash >/dev/null 2>&1 && alias rm=trash # type trash >/dev/null 2>&1 && alias rm=trash


throw-away(){
for file in "$@"
do
mv $file ~/bu/tb
done
}
mkcd(){
mkdir $1
cd $1
}
mkunfddir(){ # create dir if unfound. ?
test -e "$1" || mkdir "$1"
}
gitls(){ gitls(){
for file in `\ls` for file in `\ls`
do do
@@ -72,9 +83,9 @@ setclip(){
else else
if test $# -eq 0 if test $# -eq 0
then then
xclip -i -f -selection "primary" | xclip -i -selection "clipboard"
xclip -i -f -selection "primary" | xclip -i -f -selection "clipboard"
else else
cat "$@" | xclip -i -f -selection "primary" | xclip -i -selection "clipboard"
cat "$@" | xclip -i -f -selection "primary" | xclip -i -f -selection "clipboard"
fi fi
fi fi
} }
@@ -85,14 +96,17 @@ c(){
"$@" | cat "$@" | cat
} }
o(){ o(){
if [ $# -eq 0 ]; then
if [ $# -eq 0 ]
then
local f=. local f=.
else else
local f="$1" local f="$1"
fi fi
if iswindows; then
if iswindows
then
cmd.exe //c start "" "$f" cmd.exe //c start "" "$f"
elif isdarwin; then
elif isdarwin
then
open "$f" open "$f"
else else
xdg-open "$f" xdg-open "$f"
@@ -151,17 +165,20 @@ prompt_function(){ # used by PS1
then then
local c1="" local c1=""
local c2="" local c2=""
local c3=""
local cdef="" local cdef=""
else else
local c1="\e[33m" local c1="\e[33m"
local c2="\e[36m" local c2="\e[36m"
local c3="\e[37m"
local cdef="\e[0m" local cdef="\e[0m"
fi fi
local pwd=$(echo "${PWD}/" | sed -e "s:${HOME}:~:") local pwd=$(echo "${PWD}/" | sed -e "s:${HOME}:~:")
local oldpwd=$(echo "${OLDPWD}/" | sed -e "s:${HOME}:~:")
local date=$(LANG=C safe-cmd date +"%a, %d %b %Y %T %z") local date=$(LANG=C safe-cmd date +"%a, %d %b %Y %T %z")
local jobnum=$(jobs | wc -l) local jobnum=$(jobs | wc -l)
local git=$(safe-cmd __git_ps1 [GIT:%s]) local git=$(safe-cmd __git_ps1 [GIT:%s])
printf " [${c1}${pwd}${cdef}]${git}\n"
printf " [${c1}${pwd}${cdef}<${c3}${oldpwd}${cdef}]${git}\n"
printf "${c2}${USER}@${HOSTNAME}${cdef} ${date} ${BASH} ${BASH_VERSION}\n" printf "${c2}${USER}@${HOSTNAME}${cdef} ${date} ${BASH} ${BASH_VERSION}\n"
printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} " printf "shlv:${SHLVL} jobs:${jobnum} last:${lastreturn} "
} }
@@ -169,7 +186,7 @@ prompt_function(){ # used by PS1
# type date >/dev/null 2>&1 || alias date=":" # "cmd /c echo %time%" # type date >/dev/null 2>&1 || alias date=":" # "cmd /c echo %time%"


if [ "${EMACS}" = "t" ]; then # emacs shell用 if [ "${EMACS}" = "t" ]; then # emacs shell用
export PS1="\u@\H \d \t \w\nemacs shell\$ "
: export PS1="\u@\H \d \t \w\nemacs shell\$ "
elif echo "$EMACS" | grep term >/dev/null 2>&1; then # emacs term用 elif echo "$EMACS" | grep term >/dev/null 2>&1; then # emacs term用
echo "emacs term" echo "emacs term"
fi fi
@@ -234,7 +251,7 @@ ismsys(){
} }


iscygwin(){ iscygwin(){
return 1
uname | grep -E "^CYGWIN" >/dev/null 2>&1
} }


isdarwin(){ isdarwin(){
@@ -260,12 +277,12 @@ winln(){


######################## ########################


if iscygwin; then # cygwin判定ってどうやるんだろ 多分unameとか使う
# for cygwin
if iscygwin; then
# for cygwin
export TMP=/tmp export TMP=/tmp
export TEMP=/tmp export TEMP=/tmp
# alias setclip="tee /dev/clipboard"
# alias catclip="cat /dev/clipboard | tr -d \\r"
: alias setclip="tee /dev/clipboard"
: alias catclip="cat /dev/clipboard | tr -d \\r"
alias cygsu="cygstart /cygwinsetup.exe" alias cygsu="cygstart /cygwinsetup.exe"
alias emacs="CYGWIN=tty emacs" alias emacs="CYGWIN=tty emacs"
echo "cygwin bash" echo "cygwin bash"


Loading…
Cancel
Save