Terminal GuideTerminal Guide
xplr icon

xplr

File Managers
macOSLinux
Rust

Hackable, minimal, and fast TUI file explorer.

Official Website

Features

Lua ConfigurationPlugin SystemHackableModal

Installation

Homebrew
brew install xplr
Pacman (Arch)
pacman -S xplr
Cargo (Rust)
cargo install xplr

Why 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

Installation Commands
# 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

KeyAction
jFocus next item
kFocus previous item
hGo to parent directory
lEnter directory / open file
g then gGo to first item
GGo to last item
:Enter command mode
qQuit xplr

File Operations

OperationKeysDescription
SelectSpaceToggle selection of current item
Select AllaSelect all items
Clear SelectionuClear all selections
Copy HerecCopy selected items here
Move HeremMove selected items here
DeletedDelete selected items
Create FilenCreate 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
-- ~/.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 = false

Custom Keybindings

~/.config/xplr/init.lua
-- ~/.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
-- ~/.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
-- ~/.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.

Written by Dai AokiPublished: 2026-01-20

Related Articles

Explore More