Schievels software archeology 3 – wcd

app-misc/wcd is a utility program that should make changing directories on the command line more efficient. It was written by Erwin Waterlander in 1996 for HP-UX and was ported to many different operating systems, like DOS, Windows (95 to 10), MacOSX and, of course, Linux.

Because wcd indexes the filesystem on first run, and therefore can find the directories very fast. But what I also like is that this is coming from a time where mouse support was not really a big thing, so it has keyboard centric usage and is therefore very past to use.

When you type something like wcd org you get a list of files:

a /home/pascal/.emacs.d/.local/cache/org
b /home/pascal/.emacs.d/.local/straight/build-28.1/evil-collection/modes/org
c /home/pascal/.emacs.d/.local/straight/build-28.1/org
d /home/pascal/.emacs.d/.local/straight/repos/evil-collection/modes/org
e /home/pascal/.emacs.d/.local/straight/repos/org
f /home/pascal/.emacs.d/modules/lang/org
g /home/pascal/.emacs.old/.local/cache/org
h /home/pascal/.emacs.old/.local/straight/build-28.1/evil-collection/modes/org
i /home/pascal/.emacs.old/.local/straight/build-28.1/org
j /home/pascal/.emacs.old/.local/straight/repos/evil-collection/modes/org
k /home/pascal/.emacs.old/.local/straight/repos/org
l /home/pascal/.emacs.old/modules/lang/org
m /home/pascal/nextcloud/Uni/Theoretische Informatik/JFLAP7.1/org
n /home/pascal/nextcloud/org
o /home/pascal/org
                                                                                                                                                                                   w=up x=down ?=help  Page 1/1
Perfect match for 15 directories.
Please choose one (<Enter> to abort):

Typing a letter now will change the working directory to the given path.

On top of that wcd offers a very nice file browser for the terminal. I used to use lf for that (and only that, I know lf can do much more, but for I all the file operations I just stick to the normal shell commands), which is also a good program, but the default vim-like behaviour make things in wcd even a tad better for me. You activate the file browser with wcd -g and something like this will come up:

                        ├─ org2blog ─┬─<htmlize>─── .git ─┬─ hooks
                        │            │                    ├─ info
                        │            │                    ├─ logs ─── refs ─┬─ heads
                        │            │                    │                 └─ remotes ─── origin
                        │            │                    ├─ objects ─┬─ info
                        │            │                    │           └─ pack
                        │            │                    └─ refs ─┬─ heads
                        │            │                             ├─ remotes ─── origin
                        │            │                             └─ tags
                        │            ├─ hydra ─┬─ .git ─┬─ hooks
                        │            │         │        ├─ info
                        │            │         │        ├─ logs ─── refs ─┬─ heads
                        │            │         │        │                 └─ remotes ─── origin
                        │            │         │        ├─ objects ─┬─ info
                        │            │         │        │           └─ pack
                        │            │         │        └─ refs ─┬─ heads
                        │            │         │                 ├─ remotes ─── origin
                        │            │         │                 └─ tags
                        │            │         ├─ .github
                        │            │         ├─ doc
                        │            │         └─ targets
                        │            ├─ metaweblog ─┬─ .git ─┬─ hooks
                        │            │              │        ├─ info
                        │            │              │        ├─ logs ─── refs ─┬─ heads
                        │            │              │        │                 └─ remotes ─── origin
                        │            │              │        ├─ objects ─┬─ info
                        │            │              │        │           └─ pack
                        │            │              │        └─ refs ─┬─ heads
                        │            │              │                 ├─ remotes ─── origin
                        │            │              │                 └─ tags
                        │            │              ├─ .github ─── ISSUE_TEMPLATE
                        │            │              ├─ ci ─── vale ─── styles ─── Vocab ─── Base
                        │            │              ├─ docs
                        │            │              ├─ images
                        │            │              ├─ svg
                        │            │              └─ tests
                        │            ├─ org2blog ─┬─ .git ─┬─ hooks
                        │            │            │        ├─ info
                        │            │            │        ├─ logs ─── refs ─┬─ heads
                        │            │            │        │                 └─ remotes ─── origin

Now, you can go around the directory tree with arrow keys or HJKL. Additionally you can search similar to vim by typing /. To go to the next occurence of the searched term, type CTRL-n. Pressing enter will exit the tree view and change the working dir of the shell to the highlighted directory.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert