Skip to content

dongminkim/kk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

225 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kk

kk-logo

A fast, git-aware ls replacement written in Rust.

kk displays directory listings in a long format with file metadata, colorized output, and inline git status markers. It uses libgit2 directly (via git2 crate) instead of shelling out to git, making it significantly faster in large repositories.

Features

  • Color-coded file types (directories, symlinks, executables, etc.)
  • Inline git status markers per file (| clean, + modified, ? untracked, ! ignored)
  • Human-readable file sizes (-h)
  • macOS LSCOLORS support
  • Single static binary with zero runtime dependencies

Installation

Homebrew

brew tap dongminkim/kk https://github.com/dongminkim/kk
brew install dongminkim/kk/kk

From source

cargo install --path .

Build manually

git clone https://github.com/dongminkim/kk.git
cd kk
cargo build --release
# Binary at ./target/release/kk

Usage

kk [options] [DIR...]

Options

Flag Long Description
-a --all List entries starting with .
-A --almost-all List all except . and ..
-h --human Show file sizes in human-readable format
--si With -h, use powers of 1000 instead of 1024
-d --directory List only directories
-n --no-directory Do not list directories
-r --reverse Reverse sort order
-S Sort by size
-t Sort by modification time
-c Sort by ctime (inode change time)
-u Sort by atime (access time)
-U Unsorted
--sort WORD Sort by: none, size, time, ctime, status, atime, access, use
--no-vcs Do not show git status (faster)
--group-directories-first Group directories before files
--version Show version

Examples

kk              # List current directory with git status
kk -a           # Include hidden files
kk -h           # Human-readable sizes
kk -t           # Sort by modification time
kk --no-vcs .   # Skip git status (faster)
kk -S -r        # Sort by size, reversed (smallest first)
kk dir1 dir2    # List multiple directories

Git status markers

Each file displays a git status marker in the column before the filename:

Marker Color Meaning
| green Tracked, clean
+ green Staged (index modified)
+ red Work tree modified
+ orange Both index and work tree modified
+ yellow Directory contains changes
? red Untracked file
? yellow Directory contains untracked files
? dim Empty untracked directory
| dim Ignored

Directory entries (., .., subdirectories) aggregate statuses from their contents using priority: untracked > modified > staged > tracked. Ignored directories with tracked files (e.g. .ssh/ with config tracked via git add -f) reflect the actual status of their tracked contents instead of showing as ignored.

Project structure

src/
  main.rs      Entry point, path resolution, file listing
  cli.rs       Command-line argument parsing (clap)
  entry.rs     FileEntry struct, file metadata collection (lstat)
  git.rs       Git status collection via libgit2
  format.rs    Output formatting (column alignment, colors, dates, sizes)
  colors.rs    File type colors, LSCOLORS parsing
  sort.rs      Sorting logic
tests/
  integration.rs   End-to-end CLI and git status tests

Testing

cargo test

Dependencies

Crate Purpose
clap CLI argument parsing
git2 libgit2 bindings for git status
libgit2-sys Vendored libgit2 (static linking)
libc Unix file metadata (mode, blocks)
chrono Date formatting
uzers uid/gid to username/group name

License

MIT License

History

Originally a zsh script (k), rewritten in Rust for performance and portability.

About

kk is a new ls substitute for zsh forked from k

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Rust 99.3%
  • Ruby 0.7%