Skip to content

Latest commit

 

History

History
49 lines (40 loc) · 2.93 KB

README.md

File metadata and controls

49 lines (40 loc) · 2.93 KB

ltcd

Less Typing Changing Directory (cd)

Alt Text

Introduction

Inspired by acd_func.sh, ltcd provides the following features to make life easier:

  • Global dir listing, which shows recently visited dirs from all terminal tabs/windows.
  • Local dir listing, which is local to current shell session.
  • Both listings support quick navigation by using j/k (go down/up), numbers, and word searching.
  • Global free jumping (e.g. cd dir or cd ar to go to /path/to/foo/bar/directory/).

Installation

Doing the following should NOT spoil your existing environment - You will have:

  • More commands added in the form of Bash function.
  • A directory .cd created under your home directory.
  • Alt+A and Alt+Q registered for shortcuts to global dir listing and local dir listing, respectively. These 2 keybindings are optional. So you could delete them at the bottom of the script ltcd. Or, if you have keybinding conflicts, you could easily change the mappings at the bottom as well.

In ~/.bashrc:

  1. source the script h, which is a multi-color pattern highlighter.
  2. source the script cxpgrep, which is an exteded grep command that uses the command h.
  3. source the script ltcd, and the commands cd/cdrm/cdedit will be ready for use. The command cd is an alias of cd_func. The script ltcd uses the command cxpgrep.

Usage

  • Alt+A or cd -? brings up global dir list.
  • Alt+Q or cd -- brings up local dir list.
  • cd $word for free jumping - 'word' is any part of the FULL path of the dir to go.
  • If there is a list, follow the prompt to choose a path to go.
    • Use the keys j/k to navigate down/up the entries - Typing a single backspace or / or a number will clear the whole line in the user input area - Be fast!
    • Type a number to select a specific entry (0 or empty means staying put).
    • Start a search by typing / and then the word.
  • This code is intended to be compatible with the original cd command - e.g. cd - brings you back to the previous dir.
  • Run cdrm to remove invalid entries in global bookkeeping. Invalid entries are removed/renamed/inaccessible dirs.
  • Run cdedit in case you want to edit the global bookkeeping. For example, if you feel some dirs with "tmp" in the path name are not useful to stay in the record, you can manually remove them with this command.

Note

The files created by ltcd are all at ~/.cd/ for cleanness and debugging purposes.

Releases

  • 1.0
    • First working code
  • 1.1
    • Function namespace cleanup
    • Merge cd_utils to ltcd
    • More info added to README

License

This software (ltcd) is distributed under the MIT license.