________ ________ ________ ________ _______
╱ ╱ ╲╱ ╲╱ ╲╱ ╲_╱ ╲
╱ ╱ ╱ ╱ ╱ ╱
╱ ╱ ╱ ╱ ╱ ╱
╲__╱_____╱╲________╱╲__╱__╱__╱╲___╱____╱╲________╱
The customizable next gen
tree
command with Git integration and TUI.
- Introduction
- Prerequisites
- Standard Usage
bat
-bat
Files in the Treeedit
- Edit Files in the Treetokei
- Filtering (Including or Excluding) Items by Filetype
- Git Integration
- Rootless Mode
- Configuration/Customization
- Inspirations
nomad
is a rewrite of the tree
command with a ton of additional features such as Git integration, built-in bat
and tokei
, the ability to customize its appearance, and even a TUI (terminal UI) mode.
I think the tree
command is a useful CLI tool, but is unfortunately lacking some features that I think would make it even better. I decided to build my own next gen tree
command that implements the features I would have wanted in the original tree
command.
The manual for nomad
was originally this README
, but it became too long to comfortably navigate. This README
merely serves as a preview of sorts with some information for each feature whereas the manual provides a more in-depth look at nomad
.
The manual is available here and is also linked in the About section of this repository.
nomad
's icons require a NerdFont to render correctly. Refer to the NerdFont installation instructions to install a NerdFont for your system. It is quite simple to do and will not take too long.
By default, nomad
will display a tree visual representing the directory structure of the target directory and respect rules specified in ignore-type files such as .gitignore
s. This behavior may be disabled.
Each item will also be labeled with a NerdFont-supported icon corresponding to its filetype as well as Git status markers indicating the Git status of the file. See the Git Status Markers section to learn more about what each default marker/color represents.
nomad
's capabilities are drastically enhanced through the use of item labels.
These are the flags that will apply labels to items within the tree:
Flag | Function |
---|---|
-l |
Applies labels to directories only |
-n |
Applies labels to items only |
-L |
Applies labels to directories and items. An alias for -l -n |
NOTE: Requires a preceeding run in a labeled mode.
Quickly bat
files by passing item labels into the bat
subcommand.
NOTE: This command works with item and/or directory labels. If directory labels are provided, all items within that directory will be
bat
ed in the order they appear.
Opened with
Neovim
, the best text editor.
NOTE: Requires a preceeding run in a labeled mode.
Quickly edit files by passing item labels into the edit subcommand.
nomad
will attempt to open files with your $EDITOR
if it is set. If not, it will try the following text editors in this order:
NOTE: This command works with item and/or directory labels. If directory labels are provided, all items within that directory will be opened in a text editor.
Tokei
may be accessed through the subcommand or in tree view to display LoC data for individual files.
You can quickly see a tokei
summary/overview for a project by using the tokei
subcommand.
You can view tokei
statistics for individual files by using the --tokei
flag. This will display the lines of blanks, code, comments, and total number of lines for each file.
You can filter out items in a directory by match
ing or negate
ing filetypes or globs.
You can view all the preset globs for each filetype by using the ft options
subcommand. Optionally specify a filetype after the subcommand to search/view the globs for that specific filetype.
nomad
has Git integration to allow for easy access to commonly used Git subcommands!
Here is a table that contains the default Git status markers, the marker's color, and what it represents:
Marker | Color | Status |
---|---|---|
! |
Red | Conflicting |
D |
Red | Deleted |
M |
Orange | Modified |
R |
Orange | Renamed |
TC |
Purple | Type change |
SA |
*Green | Staged, Added |
SD |
*Red | Staged, Deleted |
SM |
*Orange | Staged, Modified |
SR |
*Orange | Staged, Renamed |
STC |
*Purple | Staged, type change |
U |
Gray | Untracked |
* The filename will also be painted the same color.
NOTE: Staged deleted filenames will also be painted with a strikethrough.
If you do not like the default marker or color configuration, you can customize it to your liking.
NOTE: Requires a preceeding run in a labeled mode.
Quickly git add
files by passing items labels into the subcommand.
NOTE: This command works with item and/or directory labels. If directory labels are provided, all items within that directory that are tracked by Git and contain a Git status will be added.
NOTE: Requires a preceeding run in a labeled mode.
Quickly run git blame
on a file by passing an item label into the subcommand.
NOTE: This command only accepts one item label.
Commits made by you remain plain while commits made by other authors are painted with a color. Each author is assigned a random color, so these colors will be different each time you run git blame
.
Be sure to check out Mojibar, a cross-platform, quick-access tab and search bar for emojis written by my friend Luke Schenk.
You can view git branch
in tree form. This works especially well if your branch names look like filepaths. Some examples are:
feature/git/something-new
bugfix/some-bug
git commit
has been integrated for convenience and offers some visual improvements over the original command.
NOTE: Requires a preceeding run in a labeled mode.
Quickly git diff
files by passing item labels into the subcommand. This command offers visual improvements and additional data over the original command.
NOTE: This command works with item and/or directory labels. If directory labels are provided, all items within that directory that are tracked by Git and contain a Git status will be
diff
ed in the order they appear.
You can view git status
in tree form. This command will only display items that are tracked by Git and contain changes or are untracked.
Rootless mode is the TUI (terminal UI) mode that allows you to dynamically interact with directory trees.
There are three primary widgets that you can interact with. Here is a quick description of each widget:
Widget | Description | Location |
---|---|---|
Breadcrumbs | Contains path breadcrumbs for parent directory navigation | Top |
Inspect | Contains the contents of the selected item | Right |
Normal | Contains the directory tree | Left |
You can configure/customize nomad
without the hassles of creating your own configuration file in the correct directory with the correct syntax.
Here is a list of what you can customize for standard mode:
- The tree's indentation and padding
- The directory's color
- The tree's indent characters (
|
,├
,─
,└
) - The directory and item label's color
- Git status markers and colors
- The color of the pattern/regex match (when using the
-p
/--pattern
flag)
Here is a list of what you can customize for Rootless mode:
- The color of the widget borders
- The color of a standard item in the tree (one that does not contain any Git changes)
- The color of items that contain a Git status
- The color of the pattern/regex match when searching for patterns within the tree or file
The following standard mode settings will also be applied to the Normal widget within Rootless mode:
- Indentation/padding
- Intent characters
- Git markers
You can easily access the configuration file by using the config edit
subcommand.
You can preview all your configuration options in a dummy tree by using the config preview
subcommand.
Be sure to check out the tools that inspired me to create this project!