Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tmux session-wide alternative to shell's built-in dirs pushd peekd popd

License

artzhk/tmux-dirs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tmux-dirs

Per-session directory stacks for tmux, implemented as a user-space daemon plus a CLI. The CLI communicates with the server over a UNIX domain socket. No system-level services required.

FILE2025-10-0892537PM-ezgif.com-video-speed.mp4

Installation

Prerequisites

  • cargo and rust are properly installed
  • rustup default stable toolchain is used
  1. Put to your .tmux.conf after set -g @plugin 'tmux-plugins/tpm' before run '~/.tmux/plugins/tpm/tpm'
set -g @plugin 'artzhk/tmux-dirs'
Ctrl+b I # to run tpm's plugin installation script
  1. Provide aliases to .bashrc or .profile
alias tpushd="~/.tmux/plugins/tmux-dirs/bin/tmux-dirs-pushd"
alias tpopd=". ~/.tmux/plugins/tmux-dirs/bin/tmux-dirs-popd"
alias tpeekd=". ~/.tmux/plugins/tmux-dirs/bin/tmux-dirs-peekd"
alias tdirs=". ~/.tmux/plugins/tmux-dirs/bin/tmux-dirs-dirs"

Overview

CLI

Synopsis:

tmux-dirs push  <session-id> <path>   # push path onto session stack
tmux-dirs pop   <session-id>          # print top path and pop
tmux-dirs peek  <session-id>          # print top path without popping
tmux-dirs dirs  <session-id>          # print stack as space-separated list
tmux-dirs clear <session-id>          # clear stack

Socket

  • Path: /tmp/dirs.sock.

IPC protocol

  • Transport: UNIX domain socket (stream).

  • Framing: single-request, single-reply. The client writes the request, then shuts down its write-half; the server reads until EOF, processes, writes a single textual reply, then shuts down its write-half.

  • Request format (space-separated tokens):

    <cmd> <session_id> [<path>]
    

    where <cmd> is one of: PUSH, POP, PEEK, DIRS, CLEAR.

  • Reply format:

    • For PUSH: <path>\n or ERR <message>\n
    • For POP/PEEK: <path>\n (empty if none)
    • For DIRS: space-separated list of absolute paths, then \n

This simple line protocol matches the “original dirs-like” UX: the CLI prints whatever the server returns.

P.S.

Yes, I agree, there is might be way more easier implementation via serializing/deserilizing json. I used such an overkill with IPC+Rust only in order to learn and get familiar with IPC and Rust. It's my first project on rust though.

Contibuting

I'm open to any improvements or contribution activities.

Open an issue -> Fork -> Create PR

I will review as soon as I have time.

About

Tmux session-wide alternative to shell's built-in dirs pushd peekd popd

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published