diff --git a/.gitignore b/.gitignore index bf1c115..e554f47 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ rcmain user-dirs.dirs dot/file/vim/pack dot/file/vim/autoload +cds +cmds diff --git a/dot/file/bashrc b/dot/file/bashrc index 1f07cb0..bbed6d2 100644 --- a/dot/file/bashrc +++ b/dot/file/bashrc @@ -1,10 +1,5 @@ -. $HOME/.profile - -q(){ - echo $SHLVL - 1 | bc - exit -} -export PS1="% " +. $HOME/.shrc test -r "$LOGIN" && . "$LOGIN" test -r "$SETENV" && . "$SETENV" && setenv bash + diff --git a/dot/file/profile b/dot/file/profile index 00f1912..ac36828 100755 --- a/dot/file/profile +++ b/dot/file/profile @@ -6,7 +6,7 @@ export_loop(){ # Standard "export" command takes arguments # from variables from the start, but I want to # use other variables in definition for next of them. - while [ ! -z "$1" ] ; do + while test ! -z "$1" ; do # Doing until we have arguments. value="$(eval echo $2)" name="$1" @@ -15,14 +15,10 @@ export_loop(){ done } -q(){ - exit -} - # Standard variables. export_loop \ ENV '$HOME/.shrc' \ - PS1 '"; "' \ + PROMPT '"; "' \ SUDO_PROMPT '"#"' \ EDITOR 'vi' \ VISUAL 'vi' \ @@ -30,6 +26,9 @@ export_loop \ PAGER 'less' \ MANPAGER '$PAGER' \ \ + CDHIST '$HOME/lib/cds' \ + CDHISTMAX '50' \ + \ CMDHIST '$HOME/lib/cmds' \ CMDHISTMAX '100' \ PROFILE '$HOME/.profile' \ diff --git a/dot/file/shrc b/dot/file/shrc index 0846cb9..7f00d8b 100644 --- a/dot/file/shrc +++ b/dot/file/shrc @@ -1,10 +1,56 @@ #!/bin/sh +. $HOME/.profile + q(){ echo $SHLVL - 1 | bc exit } +tmpcdfile=`mktemp` + +c() { + oldpwd=`pwd` + if command cd $@ && test -n $1 ; then + cat $CDHIST > $tmpcdfile + { pwd ; goblin cat $tmpcdfile ; } | \ + sed $CDHISTMAX'q' | \ + goblin uniq -U > $CDHIST + fi + pwd +} + +l() { + ls $@ +} + +la() { + ls -al $@ +} + +cds() { + acds | sed 10q | goblin quote | nl +} + +acds() { + cat $CDHIST +} + +bcd() { + num=$1 + if test "$1" = "" ; then + num=1 + fi + + backcd=`sed -n $num'p' "$CDHIST"` + + echo $backcd + command cd "$backcd" +} + +PS1=$PROMPT + test -r "$LOGIN" && . "$LOGIN" -PS1="% " test -r "$SETENV" && . "$SETENV" && setenv sh + + diff --git a/dot/file/zshrc b/dot/file/zshrc index 44e984b..025f800 100644 --- a/dot/file/zshrc +++ b/dot/file/zshrc @@ -1,5 +1,6 @@ #!/bin/sh -. $HOME/.profile +. $HOME/.shrc + #autoload -Uz compinit promptinit #compinit #promptinit @@ -31,6 +32,5 @@ setopt noglobdots setopt noshwordsplit test -r "$LOGIN" && . "$LOGIN" export PROMPT="%# " -q(){echo $SHLVL - 1 | bc ; exit} test -r "$SETENV" && . "$SETENV" && setenv zsh diff --git a/profile b/profile index d818e0e..254d8d2 100644 --- a/profile +++ b/profile @@ -130,7 +130,7 @@ fn cd { if(builtin cd $1 && test -n $1){ cat $cdfile > $tmpcdfile {pwd ; cat $tmpcdfile } | \ - sed $maxcds^q | goblin uniq -U > $cdfile + sed $CDHISTMAX^q | goblin uniq -U > $cdfile } }