Skip to content

Instantly share code, notes, and snippets.

View baldwindavid's full-sized avatar

David Baldwin baldwindavid

  • Indianapolis, IN
View GitHub Profile
#!/usr/bin/env bash
# Reruns the last command executed via run.sh in the current directory
# Shows an error message if no previous command exists
set -e
# Find the cached command for this directory
CACHE_DIR="/tmp/helix_last_command_$USER"
# Use same hash logic as run.sh (portable across macOS and Linux)
#!/usr/bin/env bash
# Wrapper around zellij run that adds move-or-create behavior for directional panes
# Usage: run.sh [OPTIONS] -- <command> [args...]
#
# Accepts all zellij run options. Key options:
# --floating Open in a floating pane
# --direction <dir> Open in direction (up, down, left, right)
# --close-on-exit Close pane when command exits
# --name <name> Name the pane
#####################################################
# COMMANDS
# Commands are under "tab".
#
# Most commands may be run in a floating (f), down (j), or right (l) pane.
# The "j" and "l" align with the movement keys (i.e. h,j,k,l).
#
# For example, to run a test under cursor in a pane below:
#
# "tab" = open command menu
#!/usr/bin/env bash
set -euo pipefail
# Usage: git_blame_viewer.sh <file> [line]
# Shows git blame for the file, optionally jumping to a specific line
file="${1:-}"
line="${2:-}"
if [[ -z "$file" ]]; then
#!/usr/bin/env bash
set -euo pipefail
# Usage: go_test_package.sh <file>
# Runs all tests in the package containing the file
input="${1:-}"
if [[ -z "$input" ]]; then
echo "Error: No file provided"
@baldwindavid
baldwindavid / config.toml
Created October 26, 2025 18:42
Example helix / zellij keybindings
X = ":sh ~/.config/helix/run_in_floating_pane.sh scooter --no-stdin"
X = ":sh ~/.config/helix/run_in_floating_pane.sh ~/.config/helix/git_blame.sh %{buffer_name} %{cursor_line}"
X = ":sh ~/.config/helix/run_in_floating_pane.sh lazygit"
X = ":sh ~/.config/helix/run_in_terminal_pane.sh ~/.config/helix/go_test_package.sh %{buffer_name}"
#!/usr/bin/env bash
# Generic wrapper to run any command in a zellij floating pane
# Usage: run_in_zellij_floating.sh <command> [args...]
HELIX_CWD="$(pwd)"
# Build the full command to run
full_command="$@"
#!/usr/bin/env bash
# Generic wrapper to run a command in the pane below the current one
# Usage: run_in_terminal_pane.sh <command> [args...]
# Assumes you're using the dev layout with a terminal pane below
HELIX_CWD="$(pwd)"
# Build the full command to run
full_command="$@"
layout {
default_tab_template {
children
pane size=2 borderless=true {
plugin location="zellij:status-bar"
}
}
tab name="dev" focus=true {
pane split_direction="vertical" {
// Static tasks configuration.
[
{
"label": "Sublime Merge",
"command": "smerge .",
"reveal": "never",
"hide": "always"
},
{
"label": "Lazygit",