help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cdlog: alternative to using the pushd stuff.


From: Kaz Kylheku
Subject: Re: cdlog: alternative to using the pushd stuff.
Date: Fri, 23 Feb 2024 14:15:54 -0800
User-agent: Roundcube Webmail/1.4.15

On 2024-01-18 18:41, Kaz Kylheku wrote:
> Hi all,
> 
> I came up with a very simple, ergonomic system for recording directories
> where you "cd" to, and reference them.
> 
> This shows we don't need dedicated code in the shell executable to
> have this kind of feature.
> 
> https://www.kylheku.com/cgit/cdlog/about/

I've developed this system further.

It now supports

- multiple numbered sessions with recovery.
  - your directory FIFO log and current directory are saved into
    a numbered session file.
  - On startup, you get a new session (lowest available number
    up to 9, or else the oldest timestamp one is replaced).
  - Using the cdr command, you can switch to an existing saved
    session, or clone its content into the current session.

- menu-driven cd (mcd) and swap (mcs)
  - select path to cd to, or swap to, by number from a menu
  - menu erases itself after selection using ANSI escape sequences,
    so not to occupy lines in your terminal scrollback.

- aliases: "cdalias X Y" defines an alias X for directory Y,
  recognized by "cd X".

- LRU mode (off by default: set cdlog_lru=y to enable)
  - the history FIFO behaves like an LRU cache: 
    - when you cd to a directory already in the
      FIFO, it is removed before the current directory is pushed,
      so the FIFO doesn't grow
    - thus the least recent FIFO entry is only evacuated when
      there is a "miss".
    - keeps the FIFO free of duplicates.

- Tab completion for "cd":
  - recognizes and completes on cdlog aliases.
  - also completes on paths, and across CDPATH.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]