autojump icon indicating copy to clipboard operation
autojump copied to clipboard

Running autojump on Windows with Clink

Open hcsaustrup opened this issue 10 years ago • 9 comments

Hi! Autojump is installed and working, except it is not adding directories when I navigate around using "cd". I've added a couple of directories manually with "autojump --add C:..", and that helps me tremendously, but it would be amazing if "cd" automatically added directories.

Maybe I missed something while installing?

hcsaustrup avatar Aug 20 '14 09:08 hcsaustrup

@mdlawson is the best contact for Windows / Clink questions. I don't have a Windows box. :/

wting avatar Aug 20 '14 17:08 wting

Same as @hcsaustrup Out of the box, cd does not add entries but running the -add manually does work.

chevdor avatar Jan 30 '15 13:01 chevdor

So, this is what I've come up with so far:

doskey cd=cd $1 $T autojump -a ^%CD^%\$1

This will alias the cd command to add the directory to autojump. Unfortunately, %CD% isn't updated until after the command is ran, so you have to append the first argument :disappointed: That means it wouldn't work if you did cd %temp% or something like that.

leviwilson avatar May 05 '15 18:05 leviwilson

FYI you can add that to your <cmdr dir>/config/aliases file. In that case, you'd omit the ^ characters and just add the line:

cd=cd $*$Tautojump -a %CD%\$1

leviwilson avatar May 06 '15 12:05 leviwilson

I've updated this to actually be

cd=cd $*$Tautojump -i >nul 

This way it also updates the weights and I do not have to do anything fancy with adding manually.

leviwilson avatar May 27 '15 16:05 leviwilson

One more update to the above...if you don't want it to echo the directory and weight, then you have to use $G to redirect in a macro:

doskey cd=cd $*$Tautojump -i $Gnul

frizzr avatar Oct 19 '15 18:10 frizzr

A minor annoyance in that alias is extra empty line that is printed with cd.

raine avatar Feb 12 '17 13:02 raine

Hi guys i am also having the same issue, @frizzr where would i add doskey cd=cd $*$Tautojump -i $Gnul . Or do i have to execute each time i open a shell

superuser-chi avatar Sep 09 '20 07:09 superuser-chi

Hi guys i am also having the same issue, @frizzr where would i add doskey cd=cd $*$Tautojump -i $Gnul . Or do i have to execute each time i open a shell

Earlier there was a mention that a setup script could be run with Windows terminal emulators like Cmder but absent that, I would look at this superuser answer for how to run setup commands like this with the bog-standard command prompt:

https://superuser.com/questions/144347/is-there-windows-equivalent-to-the-bashrc-file-in-linux

frizzr avatar Sep 10 '20 15:09 frizzr