| Crates.io | dtree-tui |
| lib.rs | dtree-tui |
| version | 1.1.0 |
| created_at | 2025-11-24 10:09:44.857232+00 |
| updated_at | 2025-11-24 10:09:44.857232+00 |
| description | A fast, lightweight TUI for interactive directory tree navigation with file preview and fuzzy search |
| homepage | |
| repository | https://github.com/holgertkey/dtree |
| max_upload_size | |
| id | 1947603 |
| size | 733,603 |
A fast, lightweight, and feature-rich TUI for interactive directory tree navigation.
dtree combines the simplicity of tree with the power of modern file managers, creating the perfect tool for developers who live in the terminal. Unlike traditional file managers that try to do everything, dtree focuses on what matters most: fast navigation and intelligent file viewing.
Navigate instantly. Jump between projects with bookmarks, find files with fuzzy search, and preview code with syntax highlighting - all without leaving your keyboard. No more endless cd commands or opening heavy GUIs just to peek at a file.
Stay in flow. Built with Rust for blazing-fast performance and zero-copy operations, dtree handles massive directory trees without breaking a sweat. Asynchronous search runs in the background while you keep working. Your terminal, your speed.
Your tool, your way. Fully customizable themes, configurable keybindings, and seamless shell integration. Works beautifully with vim-style navigation, integrates with your favorite editor, and fits naturally into your existing workflow.
# Build from source
git clone https://github.com/holgertkey/dtree.git
cd dtree
cargo build --release
cp target/release/dtree ~/bin/
# Launch from current directory
dt
# Navigate to a directory
dt /path/to/directory
# View a file in fullscreen
dt -v README.md
# Create and use bookmarks
dt # Open dtree
# Press 'm' to create bookmark
# Press 'q' to exit
dt myproject # Jump to bookmark instantly
# Basic navigation inside dtree:
# j/k - move up/down
# l/h - expand/collapse
# v - fullscreen viewer
# V - visual selection mode (in fullscreen)
# s - toggle file preview
# / - search
# i - help
The easiest way to install dtree on Linux is using the automated installation script:
# Clone repository
git clone https://github.com/holgertkey/dtree.git
cd dtree
# Run automated installation (builds and installs everything)
./install-linux.sh
What this script does:
dtree)~/bin/dtree~/bin to PATH (if needed).bashrc (or .zshrc for zsh users)After installation:
source ~/.bashrcdt --versiondt to open interactive treeIf you prefer to install manually:
git clone https://github.com/holgertkey/dtree.git
cd dtree
cargo build --release
# Install to user bin
mkdir -p ~/bin
cp target/release/dtree ~/bin/
# Or install system-wide
sudo cp target/release/dtree /usr/local/bin/
Add this to your ~/.bashrc for seamless shell integration:
# Directory tree navigator
dt() {
# Store current directory before navigation
local prev_dir="$PWD"
# Handle special case: dt - (return to previous directory)
if [ "$1" = "-" ]; then
if [ -n "$DTREE_PREV_DIR" ] && [ -d "$DTREE_PREV_DIR" ]; then
cd "$DTREE_PREV_DIR" || return
export DTREE_PREV_DIR="$prev_dir"
else
echo "dt: no previous directory" >&2
return 1
fi
return
fi
# If flags or bookmark commands are passed, run dtree directly
case "$1" in
-h|--help|--version)
command dtree "$@"
return
;;
-bm)
# Bookmark management - run directly
command dtree "$@"
return
;;
esac
# For navigation: dtree resolves paths/bookmarks
local result=$(command dtree "$@")
local exit_code=$?
if [ $exit_code -ne 0 ]; then
return $exit_code
fi
# Only cd if result is a valid directory
if [ -n "$result" ] && [ -d "$result" ]; then
cd "$result" || return
# Save previous directory for dt -
export DTREE_PREV_DIR="$prev_dir"
fi
}
Then reload your shell:
source ~/.bashrc
The easiest way to install dtree on Windows is using the automated installation script:
# Clone repository
git clone https://github.com/holgertkey/dtree.git
cd dtree
# Run automated installation (builds and installs everything)
.\install-windows-binary.ps1
What this script does:
dtree.exe)C:\Users\<YourName>\bin\dt.bat wrapper for cmd.exedt function for seamless navigationAfter installation:
. $PROFILE to reload)dt --versiondt to open interactive treeIf you prefer to install manually:
# 1. Build the project
cargo build --release
# 2. Create bin directory and copy binary
New-Item -Path "$env:USERPROFILE\bin" -ItemType Directory -Force
Copy-Item target\release\dtree.exe "$env:USERPROFILE\bin\"
Copy-Item dt.bat "$env:USERPROFILE\bin\"
# 3. Add to PATH (restart terminal after this)
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
[Environment]::SetEnvironmentVariable("Path", "$currentPath;$env:USERPROFILE\bin", "User")
# 4. Install PowerShell wrapper
.\install-windows-wrapper.ps1
# 5. Reload PowerShell profile
. $PROFILE
The PowerShell wrapper enables directory navigation with bookmarks. It's automatically installed by the installation script.
If you need to reload the wrapper (after reinstalling):
# Option 1: Reload profile in current session
. $PROFILE
# Option 2: Reinstall wrapper
.\install-windows-wrapper.ps1
# Option 3: Restart PowerShell
Verify installation:
# Check version
dt --version
# Test bookmark navigation
dt -bm add test # Create bookmark
dt test # Navigate to bookmark (should change directory)
pwd # Verify current directory changed
The dt.bat wrapper is automatically installed and provides the same functionality in cmd.exe:
REM Basic commands
dt --version REM Show version
dt REM Open interactive tree
dt C:\Windows REM Navigate to directory
dt - REM Return to previous directory
dt -bm list REM List bookmarks
After first run, configuration file will be created at:
%APPDATA%\dtree\config.toml%APPDATA%\dtree\bookmarks.jsonTypically located at: C:\Users\<YourName>\AppData\Roaming\dtree\
Problem: dtree.exe not found
Check if directory is in PATH:
# Check PATH
$env:PATH -split ';' | Select-String "bin"
# Restart terminal to pick up PATH changes
Problem: Permission denied when running scripts
You may need to allow script execution:
# Check current policy
Get-ExecutionPolicy
# Allow scripts (run as Administrator)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Launch interactive tree from current directory
dt
# Navigate to specific directory
dt /path/to/directory
# Jump to bookmark
dt myproject
# Return to previous directory (like cd -)
dt -
# View file in fullscreen mode
dt -v README.md
dtree --view README.md
# After viewing, press 'q' to navigate to file's directory
# List all bookmarks
dt -bm
dt -bm list
# Add bookmark for current directory
dt -bm add myproject
# Add bookmark for specific path
dt -bm add myproject /path/to/directory
# Remove bookmark
dt -bm remove myproject
# Show help
dtree -h
dtree --help
# Show version
dtree --version
When you run dt <name>, dtree resolves in this order:
| Key | Action |
|---|---|
j or ↓ |
Move down one item |
k or ↑ |
Move up one item |
l or → |
Expand directory (show children) |
h or ← |
Collapse directory (hide children) |
Enter |
Change root to selected directory |
u or Backspace |
Go to parent directory |
q |
Exit and cd to selected directory |
Esc |
Exit without changing directory |
| Key | Action |
|---|---|
s |
Toggle file viewer mode (show/hide split) |
v |
Open file in fullscreen viewer |
Ctrl+j |
Scroll preview down by line |
Ctrl+k |
Scroll preview up by line |
Page Down |
Scroll preview down by page |
Page Up |
Scroll preview up by page |
Home |
Jump to start of file |
End |
Jump to end of file |
| Key | Action |
|---|---|
j or ↓ |
Scroll down by line |
k or ↑ |
Scroll up by line |
Ctrl+j |
Jump to next file in directory |
Ctrl+k |
Jump to previous file in directory |
Page Down |
Scroll down by page |
Page Up |
Scroll up by page |
Home |
Switch to HEAD mode (first 10,000 lines) |
End |
Switch to TAIL mode (last 10,000 lines) |
l |
Toggle line numbers |
w |
Toggle line wrapping (wrap/truncate) |
/ |
Enter file search mode |
n |
Next search match (when results exist) |
N |
Previous search match (Shift+n) |
V |
Enter visual selection mode |
q |
Return to tree view (stay in program) |
Esc |
Exit program (or clear search if active) |
| Key | Action |
|---|---|
V |
Enter visual mode (Vim-style selection) |
j or ↓ |
Expand selection downward |
k or ↑ |
Expand selection upward |
Page Down |
Jump selection down by page |
Page Up |
Jump selection up by page |
Home |
Jump to start of file |
End |
Jump to end of file |
Mouse Scroll |
Move selection cursor (auto-scroll) |
y |
Copy selected lines and exit visual mode |
Esc or V |
Exit visual mode without copying |
| Key | Action |
|---|---|
/ |
Enter search mode |
| Type | Add characters to search query |
Backspace |
Remove last character |
Enter |
Execute search and show results |
Tab |
Switch focus between tree and results panel |
j or ↓ |
Navigate down in results |
k or ↑ |
Navigate up in results |
Esc |
Close results and exit search mode |
Fuzzy Search: Start query with / for fuzzy matching (e.g., /fuz finds "fuzzy.rs")
| Key | Action |
|---|---|
m |
Create bookmark (enter name) |
' |
Open bookmark selection menu |
j or ↓ |
Navigate bookmarks (in selection) |
k or ↑ |
Navigate bookmarks (in selection) |
d |
Delete bookmark (press twice to confirm) |
Tab |
Toggle filter mode (type to filter) |
Enter |
Jump to selected bookmark |
Esc |
Close bookmark menu |
| Key | Action |
|---|---|
e |
Open file in external editor (or hex editor for binary) |
o |
Open in file manager (dirs → self, files → parent) |
c |
Copy current path to clipboard |
| Key | Action |
|---|---|
i |
Toggle help screen |
z |
Toggle directory size display |
| Action | Effect |
|---|---|
| Tree View | |
| Click | Select item under cursor |
| Double-click | Expand/collapse directory |
| Scroll wheel | Navigate tree up/down |
| Drag divider | Resize panels |
| File Preview | |
| Scroll wheel | Scroll preview content (5 lines*) |
| Fullscreen Viewer | |
| Scroll wheel | Scroll document (5 lines*) |
| Shift+Click+Drag | Select text for copying |
| Visual Mode | |
| Scroll wheel | Move selection cursor (auto-scroll) |
* Scroll speed configurable via mouse_scroll_lines in config.toml (default: 5 lines per scroll)
/ for fuzzy modemyproject-backenddt myproject jumps instantlyl key/ in fullscreen mode, navigate with n/NV key
j/k keyboard navigationyConfiguration file: ~/.config/dtree/config.toml
[appearance]
split_position = 50
show_icons = true
enable_syntax_highlighting = true
syntax_theme = "base16-ocean.dark"
[appearance.colors]
selected_color = "cyan"
directory_color = "blue"
file_color = "white"
[behavior]
max_file_lines = 10000
wrap_lines = true # Wrap long lines (true) or truncate (false)
mouse_scroll_lines = 5 # Number of lines to scroll with mouse wheel (default: 5)
editor = "nvim"
hex_editor = "hexyl"
file_manager = "ranger"
e to view in hex editor
dtree in action: interactive tree view with file preview and syntax highlighting
📺 View All Demos & Animations →
See animated demonstrations of:
Essential commands for daily use:
dt # Open tree navigator
dt /path # Navigate to directory
dt myproject # Jump to bookmark
dt - # Return to previous directory
dt -v file.txt # View file in fullscreen
dt -bm list # List bookmarks
Navigation: j/k (down/up) h/l (collapse/expand) u (parent)
File Viewing: s (toggle) v (fullscreen) e (editor)
Search: / (search) Enter (execute) Tab (focus)
Bookmarks: m (create) ' (select) d (delete)
Actions: c (copy path) o (file manager) z (sizes)
Help: i (help) q (exit+cd) Esc (exit)
Navigate: j/k (scroll) Ctrl+j/k (next/prev file)
Page: PgUp/PgDn Home/End (head/tail mode)
Search: / (search) n/N (next/prev match)
View: l (line #) w (wrap) V (visual mode)
Visual Mode: j/k (select) y (copy) Esc (exit)
Exit: q (back to tree)
For complete keybinding reference, see docs/keybindings.md.
📄 Printable Cheat Sheet: CHEATSHEET.md
Complete documentation is available in the docs directory:
show_icons = true)cargo install hexyl)Automated uninstall (recommended):
# Basic uninstall (removes binary and wrapper only)
./uninstall-linux.sh
# Remove configuration as well
./uninstall-linux.sh --remove-config
# Remove from PATH as well
./uninstall-linux.sh --remove-from-path
# Complete removal without confirmation prompts
./uninstall-linux.sh --remove-config --remove-from-path --force
The uninstall script will remove:
dtree from ~/bin/dt() wrapper function from shell config (.bashrc or .zshrc)Manual uninstall:
# Remove binary
sudo rm /usr/local/bin/dtree
# or for user installation:
rm ~/bin/dtree
# Remove configuration (optional)
rm -rf ~/.config/dtree
# Remove bash wrapper from ~/.bashrc
# Edit ~/.bashrc and remove the dt() function
Automated uninstall (recommended):
# Basic uninstall (removes binary and wrappers only)
.\uninstall-windows.ps1
# Complete removal (including configuration)
.\uninstall-windows.ps1 -RemoveFromPath -RemoveConfig
The uninstall script will remove:
dtree.exe and dt.bat from C:\Users\<Username>\bin\dt function from all profilesManual uninstall:
# Remove binaries
Remove-Item "$env:USERPROFILE\bin\dtree.exe" -Force
Remove-Item "$env:USERPROFILE\bin\dt.bat" -Force
# Remove configuration (optional)
Remove-Item "$env:APPDATA\dtree" -Recurse -Force
# Remove PowerShell wrapper: edit $PROFILE and remove dt() function
dtree is designed for speed:
Rc<RefCell<>> to avoid cloningTypical performance:
dtree has a modular architecture with separated concerns:
main.rs Entry point, CLI, terminal setup
app.rs State manager (orchestrator)
navigation.rs Tree navigation logic
file_viewer.rs File content display
search.rs Search functionality
ui.rs Rendering logic
event_handler.rs Input processing
config.rs Configuration management
bookmarks.rs Bookmark management
See Architecture for details.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
# Clone repository
git clone https://github.com/holgertkey/dtree.git
cd dtree
# Run in debug mode
cargo run
# Run tests
cargo test
# Build release
cargo build --release
This project is licensed under the MIT License - see the LICENSE file for details.
tree, ranger, and nnn