tmux-sessionizer icon indicating copy to clipboard operation
tmux-sessionizer copied to clipboard

feat: add directory creation from picker via customizable hook

Open dcadenas opened this issue 2 months ago • 1 comments

Summary

Create directories directly from the picker by typing a name and pressing Enter (or Ctrl+Enter if matches exist). Supports git init and cloning from GitHub/GitLab URLs.

Changes

  • Show dynamic hint for creation options
  • Convention-based hook at ~/.config/tms/create-hook
  • Hook can return custom directory name via stdout
  • Default hook: creates directory with git init
  • Enhanced hook: detects and clones GitHub/GitLab URLs
  • Ctrl+Enter to force creation when matches exist
  • Auto-creates hook on first use

Hook Features

Git URL detection:

  • Type https://github.com/user/repo → clones repo → opens session "repo"
  • Type https://gitlab.com/user/project → clones → opens "project"

Customizable output:

  • Hook returns directory name via stdout (optional)
  • Falls back to typed name if no output
  • Enables URL → repo name transformation

Force creation:

  • No matches: Enter creates
  • Matches exist: Ctrl+Enter creates, Enter selects match
  • Compact hints: [^↵: create foo, ↵: open foobar]

Testing

All tests pass. Tested with git init, GitHub/GitLab clones, and force creation.

dcadenas avatar Oct 30 '25 18:10 dcadenas

This relates to #114

dcadenas avatar Oct 30 '25 19:10 dcadenas