xplr
Hackable, minimal, and fast TUI file explorer.
Official WebsiteFeatures
Installation
brew install xplrpacman -S xplrcargo install xplrWhy use xplr?
Lua Scripting
Fully configurable with Lua. Write custom commands, keybindings, and behaviors instead of being limited to predefined options.
Minimal and Fast
Lightweight Rust implementation with focus on performance and simplicity. No bloated features, just what you need.
Plugin System
Extend functionality with Lua plugins. Share your configurations and reuse plugins from the community easily.
Modal Navigation
Multiple modes (default, search, create, delete) provide context-aware keybindings for efficient file management.
Installation
# Homebrew (macOS)
brew install xplr
# Cargo (Rust)
cargo install xplr
# APT (Debian/Ubuntu)
sudo apt install xplr
# Pacman (Arch Linux)
sudo pacman -S xplr
# From source
git clone https://github.com/sayonara-q/xplr.git
cd xplr
cargo install --path .Interface Overview
xplr provides a clean, minimal interface with a single-pane view by default. The status bar shows current directory, item count, and total size. Configuration allows for multi-pane layouts using Lua.
┌──────────────────────── xplr ───────────────────────────┐ │ │ │ 📁 Documents 14 items │ 1.2 GB │ │ 📁 Downloads 8 items │ 456 MB │ │ 📁 Projects 5 items │ 789 MB │ │ 📄 README.md 3.5 KB │ │ │ 📄 notes.txt 1.2 KB │ │ │ 📦 archive.tar.gz 234 MB │ │ │ │ │ │ │ ~/user : 6 items : 2.8 GB │ └──────────────────────────────────────────────────────────┘
Basic Navigation
| Key | Action |
|---|---|
j | Focus next item |
k | Focus previous item |
h | Go to parent directory |
l | Enter directory / open file |
g then g | Go to first item |
G | Go to last item |
: | Enter command mode |
q | Quit xplr |
File Operations
| Operation | Keys | Description |
|---|---|---|
| Select | Space | Toggle selection of current item |
| Select All | a | Select all items |
| Clear Selection | u | Clear all selections |
| Copy Here | c | Copy selected items here |
| Move Here | m | Move selected items here |
| Delete | d | Delete selected items |
| Create File | n | Create new file |
Configuration
xplr is configured with Lua in ~/.config/xplr/init.lua. This gives you complete control over every aspect of the file manager.
Basic Configuration
-- ~/.config/xplr/init.lua
-- Basic xplr configuration
-- Set default layout
xplr.config.layouts.builtin.default = {
Horizontal = {
config = { margin = 1, constraints = {} },
splits = {
{ Vertical = { ratio = 30, splits = { 1 } } },
{ Vertical = { ratio = 70, splits = { 2 } } },
}
}
}
-- Configure key mappings
xplr.config.modes.builtin.default.key_bindings = {
{ on = "j", messages = { "FocusNextByRelativeIndexFromCursor", { ScrollDown = 1 } } },
{ on = "k", messages = { "FocusPreviousByRelativeIndexFromCursor", { ScrollUp = 1 } } },
{ on = "h", messages = { "Back" } },
{ on = "l", messages = { "Enter" } },
{ on = "q", messages = { "Quit" } },
{ on = "i", messages = { { BashExecSilently = "ls -lah" } } },
}
-- Disable mouse
xplr.config.general.mouse = false
-- Show icons
xplr.config.general.show_hidden = falseCustom Keybindings
-- ~/.config/xplr/init.lua - Custom keybindings
xplr.config.modes.builtin.default.key_bindings = {
-- Navigation
{ on = "j", messages = { "FocusNextByRelativeIndexFromCursor", { ScrollDown = 1 } } },
{ on = "k", messages = { "FocusPreviousByRelativeIndexFromCursor", { ScrollUp = 1 } } },
{ on = "h", messages = { "Back" } },
{ on = "l", messages = { "Enter" } },
-- Selection
{ on = " ", messages = { "ToggleSelection" } },
{ on = "a", messages = { "SelectAll" } },
{ on = "u", messages = { "ClearSelection" } },
-- File operations
{ on = "c", messages = { "CopyHere" } },
{ on = "m", messages = { "MoveHere" } },
{ on = "d", messages = { "Remove" } },
-- Search and navigate
{ on = "/", messages = { "Search" } },
{ on = "?", messages = { "SearchRegex" } },
-- Create
{ on = "n", messages = { "CreateFile" } },
-- Quit
{ on = "q", messages = { "Quit" } },
{ on = "Q", messages = { "QuitWithoutChangingDirectory" } },
}Advanced Configuration
-- ~/.config/xplr/init.lua - Advanced configuration
-- Custom commands
xplr.config.commands.builtin.default:prepend({
{
messages = { { BashExec = "nvim '{{ SELECTION }}'" } },
help = "Open in Neovim"
}
})
-- Custom panel layout
xplr.config.layouts.builtin.default = {
Horizontal = {
config = { margin = 1, constraints = {} },
splits = {
{ Vertical = { ratio = 25, splits = { 1 } } },
{ Vertical = { ratio = 75, splits = { 2, 3 } } },
}
}
}
-- Plugin loading
local home = os.getenv("HOME")
dofile(home .. "/.config/xplr/plugins/my-plugin/init.lua")
-- Theme customization
xplr.config.general.border = { type = "Rounded" }
xplr.config.general.selection.UI = " "
xplr.config.general.focus_UI = "❯ "
-- Status bar configuration
xplr.config.general.logs = {
error = { format = "[ERROR]", ui = { fg = "Red" } },
warn = { format = "[WARN]", ui = { fg = "Yellow" } },
info = { format = "[INFO]", ui = { fg = "Blue" } },
}Custom Lua Functions
-- ~/.config/xplr/init.lua - Custom Lua functions
-- Custom function for directory statistics
function get_dir_stats(path)
local count = 0
for _ in io.popen("ls -1 '" .. path .. "' 2>/dev/null"):lines() do
count = count + 1
end
return count
end
-- Custom function for file type coloring
function get_file_icon(filename)
local ext = filename:match("%.([^%.]+)$")
local icons = {
lua = "🌙",
rs = "🦀",
py = "🐍",
js = "⚡",
json = "📋",
md = "📝",
txt = "📄",
zip = "📦",
pdf = "📕",
}
return icons[ext] or "📄"
end
-- Custom command that uses functions
xplr.config.commands.builtin.default:prepend({
{
messages = { { BashExec = "tree '{{ SELECTION }}' 2>/dev/null || find '{{ SELECTION }}' -type d | head -20" } },
help = "Show directory tree"
}
})Tips and Tricks
Modal Modes
xplr has multiple modes: default (navigation), search (finding files), create (new files), delete (confirmation). Each mode has its own keybindings for context-specific actions.
Custom Bash Integration
Use BashExec or BashExecSilently messages to run shell commands from within xplr. Useful for custom file operations.
Environment Variables
Access selection and other context through Lua. Variables like SELECTION, CURRENT_DIR are available in commands and scripts.
Plugin Community
Share and reuse plugins from the community. Create modular Lua functions in separate files and load them in your main configuration.
Custom Layouts
Define multi-pane layouts using Horizontal and Vertical split configurations. Combine different pane types (table, tree, input, help) for custom workflows.