GT is a CLI tool to simplify directory navigation in Unix-like systems. It allows you to traverse the directory tree without specifying intermediate directories, using only a partial name. What does this mean? Less typing!
- Fast directory search based on partial names
- Configurable search scope and exclusions
- Tab completion for interactive directory selection
- Support for both Bash and Zsh shells (theoretically — not fully tested in Bash)
-
Clone the repository:
git clone https://github.com/lnoir/gt.git cd gt
-
Compile and install the application:
make make install
-
Add the following line to your
.zprofile
or.bash_profile
:source /usr/local/share/gt/gts.sh
-
Reload your shell configuration:
# For Zsh autoload -Uz compinit && compinit source /usr/local/share/gt/gts.sh
Or:
# For Bash source ~/.bash_profile
GT uses a configuration file located at ~/.config/gt/config
. If this file doesn't exist, GT will use default settings.
To configure GT, create the file and add the following options:
top_level_dir=/path/to/search/root
exclusions=node_modules,build,.git
top_level_dir
: Specifies the root directory for searches. You can add multiple top-level directories.exclusions
: A comma-separated list of directory names to exclude from searches.
To navigate to a directory:
gt directory_name
GT will search for directories matching the given name and either navigate directly to it (if there's only one match) or present a list of options to choose from.
Start typing a directory name and press Tab to see matching options:
gt doc<TAB>
This will show a list of directories containing "doc" in their name.
To search in parent directories, use the ../
prefix, or ^
suffix:
gt ../project
Or:
gt project^
Both will search for directories named "project" in the parent directories.
GT supports two main commands:
search
: Performs a broader search (default when using tab completion)immediate
: Searches only in the immediate vicinity (used when directly callinggt
)
These commands are used internally and are only added here for reference. You don't need to call them directly.
If you encounter any issues:
- Ensure that
gts
is in your PATH. - Check that the shell script is sourced correctly in your shell configuration file.
- Verify that you have the necessary permissions to access the directories you're searching.
For more detailed debugging, you can enable debug mode by setting GT_DEBUG=1
in the shell script.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.