Less Typing Changing Directory (cd)
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 arto go to /path/to/foo/bar/directory/).
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.
- source the script h, which is a multi-color pattern highlighter.
- source the script cxpgrep, which is an exteded grep command that uses the command
- source the script ltcd, and the commands
cdeditwill be ready for use. The command
cdis an alias of
cd_func. The script ltcd uses the command
- Alt+A or
cd -?brings up global dir list.
- Alt+Q or
cd --brings up local dir list.
cd $wordfor 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.
cdrmto remove invalid entries in global bookkeeping. Invalid entries are removed/renamed/inaccessible dirs.
cdeditin 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.
The files created by ltcd are all at ~/.cd/ for cleanness and debugging purposes.
- First working code
- Function namespace cleanup
- Merge cd_utils to ltcd
- More info added to README
This software (ltcd) is distributed under the MIT license.