Nomad
š³ The customizable next gen tree command with Git integration and TUI.
Install / Use
/learn @JosephLai241/NomadREADME
________ ________ ________ ________ _______
ā± ā± ā²ā± ā²ā± ā²ā± ā²_ā± ā²
ā± ā± ā± ā± ā± ā±
ā± ā± ā± ā± ā± ā±
ā²__ā±_____ā±ā²________ā±ā²__ā±__ā±__ā±ā²___ā±____ā±ā²________ā±
The customizable next gen
treecommand with Git integration and TUI.
Table of Contents
- Introduction
- Prerequisites
- Standard Usage
bat-batFiles in the Treeedit- Edit Files in the Treetokei- Filtering (Including or Excluding) Items by Filetype
- Git Integration
- Rootless Mode
- Configuration/Customization
- Inspirations
Introduction
nomad is a rewrite of the [tree][tree] command with a ton of additional features such as Git integration, built-in [bat][bat] and [tokei][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.
"This README barely explains what nomad does. Where the hell is the manual?"
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][nomad manual] and is also linked in the About section of this repository.
Prerequisites
nomad's icons require a [NerdFont][NerdFont] to render correctly. Refer to the [NerdFont installation instructions][NerdFont Installation] to install a NerdFont for your system. It is quite simple to do and will not take too long.
Standard Usage
![standard-demo][standard-demo]
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 .gitignores. 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.
Unlocked Functionality via Item Labels
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 |
bat - bat Files in the Tree
![bat demo][bat demo]
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
bated in the order they appear.
edit - Edit Files in the Tree
![edit demo][edit demo]
Opened with [
Neovim][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:
- [Neovim][Neovim]
- [Vim][Vim]
- [Vi][Vi]
- [Nano][Nano]
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
Tokei may be accessed through the subcommand or in tree view to display LoC data for individual files.
tokei - Subcommand (Overview)
![tokei subcommand demo][tokei subcommand demo]
You can quickly see a tokei summary/overview for a project by using the tokei subcommand.
nd --tokei - Flag (Tree View)
![tokei tree demo][tokei tree demo]
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.
Filtering (Including or Excluding) Items by Filetype
You can filter out items in a directory by matching or negateing filetypes or globs.
ft match - Including Filetypes and/or Globs
![filetype match demo][filetype match demo]
ft negate - Excluding Filetypes and/or Globs
![filetype negate demo][filetype negate demo]
ft options - Viewing Filetype Globs
![filetype options demo][filetype options demo]
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.
Git Integration
nomad has Git integration to allow for easy access to commonly used Git subcommands!
Git Status Markers
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.
git add
š§ This feature is currently in beta š§
![git add demo][git add demo]
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.
git blame
![git blame demo][git blame demo]
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][Mojibar], a cross-platform, quick-access tab and search bar for emojis written by my friend Luke Schenk.
git branch
![git branch demo][git branch demo]
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-newbugfix/some-bug
git commit
š§ This feature is currently in beta š§
![git commit demo][git commit demo]
git commit has been integrated for convenience and offers some visual improvements over the original command.
git diff
![git diff demo][git diff demo]
NOTE: Requires a preceeding run in a labeled mode.
Quickly git diff files by passing item labels into the subcommand. This command offers visua
