ffm 0.1.6

A blazing-fast terminal file manager with three-panel layout, fuzzy search, multi-select, and full keyboard control
<div align="center">

# ⚑ FastyFileManager

**A blazing-fast terminal file manager built with Rust & Ratatui**

[![Rust](https://img.shields.io/badge/built%20with-Rust-f74c00?style=for-the-badge&logo=rust)](https://www.rust-lang.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge)](LICENSE)
[![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux-blue?style=for-the-badge)](https://github.com/SMOLDEVI/FastyFileManager)

</div>

---

## ✨ Features

- πŸ—‚οΈ **Three-panel layout** β€” Favorites, Drives, Files, and Preview
- πŸ“‹ **Clipboard** β€” Copy, Cut and Paste files & folders (recursive)
- β˜… **Favorites** β€” Pin any file or folder for instant access (persisted between sessions)
- πŸ” **Fuzzy Search** β€” Instantly filter files as you type (characters in order, not necessarily contiguous)
- 🎨 **Nerd Font icons** β€” Per-extension color coding and icons (60+ file types)
- βš™οΈ **Configurable** β€” Full keybinding and theme customization via `config.toml`
- πŸ–ŠοΈ **Editor integration** β€” Open files in your `$EDITOR` (nvim, vim, nano…)
- πŸ’Ύ **Hot config reload** β€” Apply changes without restarting (F5)
- πŸ“ **Sort modes** β€” Toggle between Name / Size / Date with `s`
- πŸ”² **Multi-select** β€” Select multiple files with `Space`, batch operations
- ✏️ **Rename** β€” Rename files and folders with `r`
- πŸ—‘οΈ **Delete confirmation** β€” Safe deletion with y/N prompt
- πŸ“ **Resizable panels** β€” Adjust panel widths with `Shift+←` / `Shift+β†’`
- πŸ“‚ **Drive info** β€” Shows available free space for each drive
- ⚑ **Compact popups** β€” Minimal Vim-style command bar for input and confirmations
- πŸ”„ **Conflict resolution** β€” Overwrite / Skip / Auto-rename when pasting existing files

---

<div align="center">
<img src="assets/screenshot.png" alt="FastyFileManager in action" width="850"/>
</div>

---

## πŸš€ Installation

### Prerequisites

- [Rust]https://rustup.rs/ (stable, 1.75+)
- A terminal with [Nerd Fonts]https://www.nerdfonts.com/ support (e.g. JetBrainsMono Nerd Font)

---

### 🐧 Linux / macOS

```bash
git clone https://github.com/SMOLDEVI/FastyFileManager.git
cd FastyFileManager
chmod +x build.sh
./build.sh
```

The script will:
1. Compile the project in release mode
2. Place the `ffm` binary in the project directory
3. You can then move it to `~/.local/bin/` or `/usr/local/bin/` to add it to PATH

```bash
# Optional: add to PATH manually
cp ffm ~/.local/bin/ffm
```

---

### πŸͺŸ Windows

```bat
git clone https://github.com/SMOLDEVI/FastyFileManager.git
cd FastyFileManager
build.bat
```

The script will:
1. Compile the project in release mode
2. Copy `ffm.exe` to `%USERPROFILE%\bin\`
3. Automatically add `%USERPROFILE%\bin` to your user `PATH`

> ⚠️ Restart your terminal after first install for PATH changes to take effect.

---

### πŸ“¦ Manual build

```bash
git clone https://github.com/SMOLDEVI/FastyFileManager.git
cd FastyFileManager
cargo build --release
# Binary is at: target/release/ffm  (or ffm.exe on Windows)
```

---

## ⌨️ Keybindings

### πŸ—‚οΈ File Panel

| Key | Action |
|-----|--------|
| `j` / `↓` | Move down |
| `k` / `↑` | Move up |
| `l` / `β†’` / `Enter` | Open directory |
| `h` / `←` / `Backspace` | Go to parent directory |
| `a` | Create new file or folder (end name with `/` for folder) |
| `r` | Rename selected item |
| `D` | Delete selected file/folder (with confirmation) |
| `Space` | Toggle multi-selection |
| `s` | Cycle sort mode: Name β†’ Size β†’ Date |
| `e` | Open file in `$EDITOR` |
| `y` | **Copy** selected item(s) to clipboard |
| `x` | **Cut** selected item(s) (move) |
| `p` | **Paste** clipboard into current directory |
| `f` | Add selected item to **Favorites** |
| `/` | Start search / filter |
| `Tab` | Switch focus: Files β†’ Drives β†’ Favorites |
| `Shift+←` | Shrink center panel |
| `Shift+β†’` | Expand center panel |

### β˜… Favorites Panel

| Key | Action |
|-----|--------|
| `j` / `↓` | Move down |
| `k` / `↑` | Move up |
| `Enter` / `β†’` | Navigate to favorited item |
| `D` or `F` | Remove from favorites |
| `Tab` | Switch focus |

### πŸ’Ύ Drive Panel

| Key | Action |
|-----|--------|
| `j` / `↓` | Move down |
| `k` / `↑` | Move up |
| `Enter` / `β†’` | Switch to selected drive |
| `Tab` | Switch focus |

### πŸ” Search Mode

| Key | Action |
|-----|--------|
| *type anything* | Filter files in real time |
| `Enter` | Confirm and return to Normal mode |
| `Esc` | Cancel search and clear filter |
| `↑` / `↓` | Navigate filtered results |

### 🌐 Global

| Key | Action |
|-----|--------|
| `q` | Quit |
| `?` | Toggle help popup |
| `F5` | Hot-reload config |
| `Ctrl-h` | Focus Drives panel |
| `Ctrl-l` | Focus Files panel |
| `Ctrl-b` | Toggle status bar |
| `Tab` | Cycle focus: Files β†’ Drives β†’ Favorites |

### πŸ“¦ Paste Conflict

| Key | Action |
|-----|--------|
| `O` | Overwrite existing file |
| `S` | Skip this file |
| `R` | Auto-rename (adds suffix) |
| `Esc` | Cancel entire paste operation |

---

## βš™οΈ Configuration

Config is stored at:
- **Windows**: `%APPDATA%\ffm\config.toml`
- **Linux/macOS**: `~/.config/ffm/config.toml`

The file is auto-created on first run with default values.

```toml
[theme]
background     = "Reset"
text           = "#EADBB8"
selected_bg    = "#D2B48C"
selected_fg    = "#282828"
directory      = "#E0C097"
file           = "#C8B6A6"
highlight_symbol = "> "

[keys]
quit         = "q"
search       = "/"
cancel       = "esc"
submit       = "l"
down         = "j"
up           = "k"
delete       = "D"
create       = "a"
focus_files  = "ctrl-l"
focus_drives = "ctrl-h"
back_dir     = "h"
reload       = "F5"
edit         = "e"
rename       = "r"
help         = "?"
sort         = "s"
```

> Apply changes instantly with `F5` β€” no restart needed!

---

## πŸ” Shell Integration: cd on quit

When you quit `ffm`, it saves the last visited directory to `~/.local/share/ffm/cwd` (Linux) or `%APPDATA%\ffm\data\cwd` (Windows). Wrap the binary in a shell function to automatically `cd` into that directory:

### Bash / Zsh

```bash
ffm() {
    command ffm "$@"
    cwd_file="${XDG_DATA_HOME:-$HOME/.local/share}/ffm/cwd"
    if [ -f "$cwd_file" ]; then
        cd "$(cat "$cwd_file")"
    fi
}
```

### fish

```fish
function ffm
    command ffm $argv
    set cwd_file "$HOME/.local/share/ffm/cwd"
    if test -f "$cwd_file"
        cd (cat "$cwd_file")
    end
end
```

### Windows PowerShell (profile)

```powershell
function ffm { & ffm.exe $args; $cwd = "$env:APPDATA\ffm\data\cwd"; if (Test-Path $cwd) { Set-Location (Get-Content $cwd -Raw).Trim() } }
```

---

## πŸ—οΈ Project Structure

```
FastyFileManager/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.rs      # Entry point
β”‚   β”œβ”€β”€ app.rs       # Application state & input handling
β”‚   β”œβ”€β”€ ui.rs        # Terminal UI rendering (ratatui)
β”‚   β”œβ”€β”€ config.rs    # Config loading & defaults
β”‚   β”œβ”€β”€ icons.rs     # File type icons & colors
β”‚   └── theme.rs     # Color parsing
β”œβ”€β”€ build.sh         # Linux/macOS build + install script
β”œβ”€β”€ build.bat        # Windows build + PATH setup script
└── Cargo.toml       # Dependencies
```

---

## πŸ“„ License

MIT Β© [SMOLDEVI](https://github.com/SMOLDEVI)