The home page for commacd insists that it is not a fast directory switcher, and so I’ll refrain from calling it that. It does make switching directories a lot faster though.
But I can see where the difference lies. Things like z or j or j2 or autojump or fasd all tried to apply their own algorithms to switching patterns. commacd, on the other hand, trusts you to know where you are and where you want to go, and then takes you there.
commacd, as you have inferred, ties the cd
command to the comma sign. In that sense it works exactly the same.
kmandla@6m47421: ~$ , downloads/
/home/kmandla/downloads
kmandla@6m47421: ~/downloads$
But if I have a nested directory and I know where I want to go, commacd suddenly makes it much easier.
kmandla@6m47421: ~$ , /u/s/j
/usr/share/jack-audio-connection-kit
kmandla@6m47421: /usr/share/jack-audio-connection-kit$
On my system, the only path that has the initials u then s then j is /usr/share/jack-audio-connection-kit, and commacd wisely expands my request to match it, and moves me there.
If there’s any doubt, commacd asks for permission.
kmandla@6m47421: ~$ , /u/s/e
0 /usr/share/emacs/
1 /usr/share/enchant/
2 /usr/share/et/
: 2
/usr/share/et
kmandla@6m47421: /usr/share/et$
A double comma works in reverse, but in the same way as well.
kmandla@6m47421: /usr/share/et$ ,, s
/usr/share
kmandla@6m47421: /usr/share$
Since “share” is in my path and it starts with an s, commacd moved me there. If there is more than one part of my path that starts with that letter, I get moved to the uppermost folder.
kmandla@6m47421: /lib/kernel$ cd /usr/lib/modules/3.16.4-1-ARCH/kernel/net/llc/
kmandla@6m47421: .../3.16.4-1-ARCH/kernel/net/llc$ ,, l
/usr/lib
kmandla@6m47421: /usr/lib$
Triple commas are wilder, allowing you to jump anywhere within your tree, not just your path. For example. …
kmandla@6m47421: .../3.16.4-1-ARCH/kernel/net/llc$ ,,, sound
/usr/lib/modules/3.16.4-1-ARCH/kernel/sound
kmandla@6m47421: .../modules/3.16.4-1-ARCH/kernel/sound$
And that might be the best feature of commacd: jumping well beyond your $PWD to a folder that’s only tangential to where you are at a particular moment.
No more backtracking to a common branch and then tab-completing down to the folder you want. With a little guidance and the reassurance that you know where you are and where you want to go, commacd will just take you there.
There’s no real downside to commacd, except perhaps that you need to have an idea of where you’re going. If you’re just exploring the bowels of /usr/src or looking for an errant file, it won’t help you much to have that kind of flexibility in changing directories. You might be better with the traditional cd
command.
commacd “installs” by sourcing with your .bashrc or .bash_profile, so there’s no compiling and no need for a second program. It keeps no logs, has no daemons and doesn’t care if you like sysvinit or systemd. š It’s wonderfully transparent and so light you won’t even know it’s there.
I like this one a lot, and it’s definitely worth trying out … just don’t call it a fast directory switcher. š