dorkhub

scd

Sync current directory between your shell and a file manager

cshuaimin
Rust132MITupdated 3 years ago
git clone https://github.com/cshuaimin/scd.gitcshuaimin/scd

SCD

A tiny file manager focused on shell integration.

asciicast

Motivation

Have you ever typed ls after every cd command? In some "your most used command" surveys(reddit, v2ex), the ls command occupies a considerable amount.

Obviously you need a terminal file manager! But wait, it seems still inconvenient to switch from ls to some file managers after entering the directory ...

So here comes scd! scd is docked as a sidebar of your terminal so you don't have to open it every time.

Most importantly, the current directory of scd is synchronized with the shell. This means that it will update its file list when you cd in your shell, and if you enter another directory in scd, the shell will also automatically cd to it.

Moreover, it seems that it is too wasteful to display only the files in the current directory, so, as you think, I added some resource monitoring functions in scd. Hope you like it!

Installation

Cargo

cargo install scd

Usage

scd is designed for sidebar, so you need tmux or kitty terminal to split an area for it.

In sidebar, run scd to open the main window.

In your shell, you need to setup some hooks to send scd shell events:

scd fish-init | source

Currently only fish shell is supported. If you know how to setup same hooks in other shells, any contributions is welcomed!

Keybinds

Quit

q

Move

  • Up: Up/k/Ctrl+p
  • Down: Down/j/Ctrl+n
  • First: Home/g
  • Last: End/G

File operation

  • Enter directory or open file: Enter/l
  • Go to parent directory: Esc/h
  • Delete file/directory: d
  • Rename file/directory: r
  • Mark files for copy/move: Space
  • Copy marked files here: p
  • Move marked files here: m

Filter

  • Toggle hidden files: .
  • Enter filter mode: /

Filter mode key bindings

  • Move cursor: Left/Ctrl+b, Right/Ctrl+f, Home/C-a, End/Ctrl+e
  • Move selection: Ctrl+p/Ctrl+n
  • Edit: Ctrl+u to clear, Backspace/Ctrl+h, Delete/Ctrl+d,
  • Exit filter mode: Esc/Enter

Configuration how to open files

By default, scd opens file via xdg-open. It's recommended to configure some cli utilities to open file in the shell.

The configuration is a YAML file located at ~/.config/scd/open.yml

A sample configure file:

rs, py, go, js, html, css, c, cc, cpp, sh, fish: bat
toml, yaml, yml, json, ron, ini, conf, txt, md: bat
pdf: pdftotext {} - | less --quit-if-one-screen

more like this

r2

Free open-source Cloudflare R2 desktop client and S3 GUI for macOS, Windows, and Linux. Manage Cloudflare R2, AWS S3, M…

TypeScript50

meine

meine 🌒 - A CLI file manager and system utility built with Textual. It combines intuitive command parsing with rich t…

Python50

MTT-File-Manager-RUST

MTT File Manager is a Rust-based Windows file manager with tabbed navigation, rich media previews, deep system integrat…

Rust51

search

search projects, people, and tags