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 dirorcd arto go to /path/to/foo/bar/directory/).
In ~/.bashrc:
- 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
h. - source the script ltcd, and the commands
cd/cdrm/cdeditwill be ready for use. The script ltcd uses the commandcxpgrep.
- 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 - A single backspace will remove the whole line - 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
cdrmto remove invalid entries in global bookkeeping. Invalid entries are removed/renamed/inaccessible dirs. - Run
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.
- 1.0
- First working code
- 1.1
- Function namespace cleanup
- Merge cd_utils to ltcd
- More info added to README
This software (ltcd) is distributed under the MIT license.