profile: upgraded cd history implementation.
This commit is contained in:
parent
a2d8e44821
commit
1dfbca545f
1 changed files with 17 additions and 6 deletions
23
profile
23
profile
|
@ -1,5 +1,6 @@
|
||||||
# k1574's rc configuration file.
|
# k1574's rc configuration file.
|
||||||
|
|
||||||
|
oldifs = $ifs
|
||||||
prompt = '% ' # The simplest possible prompt.
|
prompt = '% ' # The simplest possible prompt.
|
||||||
fn % {
|
fn % {
|
||||||
switch($#*){
|
switch($#*){
|
||||||
|
@ -119,11 +120,26 @@ fn ll {
|
||||||
goblin ls $* | finfo
|
goblin ls $* | finfo
|
||||||
}
|
}
|
||||||
|
|
||||||
cds = (`{pwd})
|
|
||||||
|
cdfile = $tmp/cdfile
|
||||||
|
if(! test -r $cdfile) touch $cdfile
|
||||||
|
|
||||||
|
fn ucds {
|
||||||
|
# Update history.
|
||||||
|
ifs = '
|
||||||
|
'
|
||||||
|
cds = `{tac $cdfile | goblin uniq -U}
|
||||||
|
ifs = $oldifs
|
||||||
|
echo > $cdfile
|
||||||
|
{for(i in $cds) echo $i} | tac >> $cdfile
|
||||||
|
}
|
||||||
|
ucds
|
||||||
|
|
||||||
fn cd {
|
fn cd {
|
||||||
# History implementation.
|
# History implementation.
|
||||||
if(builtin cd $1 && test -n $1){
|
if(builtin cd $1 && test -n $1){
|
||||||
pwd = `{pwd}
|
pwd = `{pwd}
|
||||||
|
echo $pwd >> $cdfile
|
||||||
cds = ($pwd $cds)
|
cds = ($pwd $cds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,11 +156,6 @@ fn cds {
|
||||||
{for(i in $cds) echo $i } | nl
|
{for(i in $cds) echo $i } | nl
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ucds {
|
|
||||||
# Let be in history just unique notes.
|
|
||||||
cds = `{ {for(i in $cds) echo $i} | goblin uniq -U}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn p {
|
fn p {
|
||||||
plumb $*
|
plumb $*
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue