Modify tmux config/setup, zsh, some nvim & skhd key mappings, etc

This commit is contained in:
2025-09-05 12:39:47 -05:00
committed by david
parent 759958b126
commit 891b605dbe
19 changed files with 107 additions and 38 deletions

View File

@@ -1,4 +1,4 @@
# repo containing configs and scripts to set up a box # dotfiles plus scripts to copy them and also install stuff
### script run ### script run
- fulfill prerequisites below - fulfill prerequisites below

View File

@@ -43,7 +43,8 @@ copy_dir src_files/.config $XDG_CONFIG_HOME
copy_dir src_files/.local/bin $DIR_BIN copy_dir src_files/.local/bin $DIR_BIN
copy_dir src_files/.local/scripts $DIR_SCRIPTS copy_dir src_files/.local/scripts $DIR_SCRIPTS
# on macos, gimp defaults to app-support, so sym-link to actual config
[[ "$BOX_SETUP_OS" = "macos" ]] && [[ "$BOX_SETUP_OS" = "macos" ]] &&
# link_dir "$XDG_CONFIG_HOME/REAPER" "$HOME/Library/Application Support/REAPER" && # TODO: get reaper config set up
copy_dir src_files/executable_wrappers_macos $DIR_BIN
link_dir "$XDG_CONFIG_HOME/GIMP" "$HOME/Library/Application Support/GIMP" link_dir "$XDG_CONFIG_HOME/GIMP" "$HOME/Library/Application Support/GIMP"

View File

@@ -17,7 +17,10 @@ source ./src_files/.config/zsh/.zshenv # ensure env vars set for use below
# dirs for how i'm organizing my system # dirs for how i'm organizing my system
[[ ! -d "$DIR_HOME_BOX" ]] && mkdir $DIR_HOME_BOX [[ ! -d "$DIR_HOME_BOX" ]] && mkdir $DIR_HOME_BOX
[[ ! -d "$DIR_MUSIC" ]] && mkdir $DIR_MUSIC
[[ ! -d "$DIR_DEV" ]] && mkdir $DIR_DEV [[ ! -d "$DIR_DEV" ]] && mkdir $DIR_DEV
[[ ! -d "$DIR_DEV/git" ]] && mkdir $DIR_DEV/git [[ ! -d "$DIR_GIT_PROJECTS" ]] && mkdir $DIR_GIT_PROJECTS
[[ ! -d "$DIR_DEV/git/me" ]] && mkdir $DIR_DEV/git/me [[ ! -d "$DIR_GIT_PROJECTS/me" ]] && mkdir $DIR_DEV/git/me
[[ ! -d "$DIR_DEV/git/other" ]] && mkdir $DIR_DEV/git/other [[ ! -d "$DIR_GIT_PROJECTS/other" ]] && mkdir $DIR_DEV/git/other
[[ ! -d "$DIR_SCRATCH_NOTES" ]] && mkdir -p $DIR_SCRATCH_NOTES
[[ ! -d "$DIR_SCRATCH_DRAWINGS" ]] && mkdir -p $DIR_SCRATCH_DRAWINGS

View File

@@ -0,0 +1,24 @@
//////////////////////////////////////////////////////////////////////////////////////////
// idea from the primeagen, designated label/workspace/desktop per app/purpose
// current layout/plan // wm default layout/mode
1. drawing/thinking (scratch pads for text and images) stack (fullscreen)
2. music makeing - misc stack (fullscreen)
3. music making - daw floating
4. music/audio listening stack (fullscreen)
5. general misc (catch-all) stack (fullscreen)
6. comms (email, chats, etc) stack (fullscreen)
7. dev - misc stack (fullscreen)
8. terminal (primary, but audio/one-off/etc can be anywhere) stack (fullscreen)
9. web browser stack (fullscreen)
// ideas/guidelines:
- use this consistently accross all machines
- if something not applicable for a given machine, just don't have apps or screens
present, but maintain absolute position/numbering of each screen
- structure the above so that programs which i'm likely to use with one hand off of the
keyboard (i.e. to use a trackpad, mouse, stylus, etc) are on the screens that allow
for one hand (i.e. the one still on the keyboard) to navigate those screens
- for me, using peripherals with right hand, so put programs likely to be used with
peripherals where my left hand can switch to them single-handedly (screens 1 to 5)

View File

@@ -5,11 +5,13 @@ vim.keymap.set("n", "<leader>n", vim.cmd.Ex)
vim.keymap.set("v", "J", ":m '>+1<CR>gv") vim.keymap.set("v", "J", ":m '>+1<CR>gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv") vim.keymap.set("v", "K", ":m '<-2<CR>gv")
-- vertically center cursor with half-page jumps iterating search results -- vertically center cursor with half-page jumps
vim.keymap.set("n", "<C-d>", "<C-d>zz") vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz") vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv") -- open folds when iterating search results
vim.keymap.set("n", "n", "nzv")
vim.keymap.set("n", "N", "Nzv")
-- maintain cursor position after paragraph formatting -- maintain cursor position after paragraph formatting
vim.keymap.set("n", "=ap", "ma=ap'a") vim.keymap.set("n", "=ap", "ma=ap'a")
@@ -21,6 +23,7 @@ vim.keymap.set("x", "<leader>P", [["_dP]]) -- replace selected text, keep main r
-- shortcuts for using + register (system clipboard) -- shortcuts for using + register (system clipboard)
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]]) vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
vim.keymap.set("n", "<leader>Y", [["+Y]]) vim.keymap.set("n", "<leader>Y", [["+Y]])
vim.keymap.set("n", "<leader>D", [["+D]])
vim.keymap.set("n", "<leader>p", [["+p]]) vim.keymap.set("n", "<leader>p", [["+p]])
-- search-and-replace shortcuts -- search-and-replace shortcuts

View File

@@ -21,12 +21,14 @@ alt + shift - 7 : yabai -m window --space 7 --focus
alt + shift - 8 : yabai -m window --space 8 --focus alt + shift - 8 : yabai -m window --space 8 --focus
alt + shift - 9 : yabai -m window --space 9 --focus alt + shift - 9 : yabai -m window --space 9 --focus
# all windows in a space to fullscreen in a single stack # all windows in a space to stack mode (each fullscreen)
alt + shift - s : yabai -m space --layout stack alt + shift - s : yabai -m space --layout stack
# all windows in a space back to the grid (managed) # all windows in a space to grid mode
alt + shift - g : yabai -m space --layout bsp alt + shift - g : yabai -m space --layout bsp
# all windows in a space to float mode
alt + shift - f : yabai -m space --layout float
# toggle float on/off for the focused window # toggle float on/off for the focused window
alt + shift - f : yabai -m window --toggle float alt + shift - F : yabai -m window --toggle float
# balance window sizes # balance window sizes
alt + shift - 0 : yabai -m space --balance # TODO: figure out better key option alt + shift - 0 : yabai -m space --balance # TODO: figure out better key option

View File

@@ -0,0 +1,13 @@
local omitted_dirs=(
$HOME
$DIR_HOME_BOX
$DIR_DEV
$DIR_GIT_PROJECTS
)
[[ ! ${omitted_dirs[(re)$(pwd)]} ]] &&
tmux new-window -d -n cmd &&
tmux rename-window $EDITOR &&
$EDITOR .
clear

View File

@@ -0,0 +1,11 @@
## example template
tmux new-window -d -n cmd
tmux send-keys -t :cmd "echo 'in cmd'" c-M
tmux new-window -d -n another
tmux send-keys -t :another "echo 'in another'" c-M
tmux rename-window $EDITOR
$EDITOR .
clear

View File

@@ -0,0 +1,7 @@
tmux new-window -d -n ncspot
tmux new-window -d -n fitness
tmux send-keys -t :fitness "cd $DIR_HOME_BOX/life/fitness/audio" c-M
tmux rename-window ncmpcpp
ncmpcpp

View File

@@ -0,0 +1,8 @@
tmux rename-window drawing
tmux new-window -n thinking
tmux send-keys -t :thinking "$EDITOR $(date "+%Y%m%d")-scratch" c-M
tmux send-keys -t :drawing "cd $DIR_SCRATCH_DRAWINGS" c-M
tmux send-keys -t :drawing "gimp" c-M

View File

@@ -8,7 +8,7 @@ set -g status-style 'bg=#111111 fg=#22cc00'
set -g base-index 0 set -g base-index 0
# unbind keys # unbind keys
unbind-key f; unbind-key C-f; unbind-key C-s unbind-key f; unbind-key C-f; unbind-key s; unbind-key C-s
unbind-key c; unbind-key n; unbind-key p unbind-key c; unbind-key n; unbind-key p
unbind-key C-o; unbind-key C-n; unbind-key C-p; unbind-key C-l; unbind-key C-h unbind-key C-o; unbind-key C-n; unbind-key C-p; unbind-key C-l; unbind-key C-h
@@ -35,7 +35,8 @@ bind-key n new-window
# find and switching for sessions, include using tmux-session-init # find and switching for sessions, include using tmux-session-init
bind-key C-f run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init" bind-key C-f run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init"
bind-key C-s run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init find-existing" # bind-key C-s run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init find-existing"
bind-key C-s choose-session
bind-key C-h run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init hub" bind-key C-h run-shell "tmux neww $DIR_SCRIPTS/tmux-session-init hub"
bind-key -r C-l switch-client -l bind-key -r C-l switch-client -l
bind-key -r C-o last-window bind-key -r C-o last-window

View File

@@ -0,0 +1 @@
# source "$XDG_CONFIG_HOME/shell/profile" # TODO: where to put this?

View File

@@ -4,8 +4,11 @@ export EDITOR='nvim'
# env vars used for my organization structure # env vars used for my organization structure
export DIR_HOME_BOX="$HOME/dbox" export DIR_HOME_BOX="$HOME/dbox"
export DIR_MUSIC="$DIR_HOME_BOX/media/music"
export DIR_DEV="$HOME/dev" export DIR_DEV="$HOME/dev"
export DIR_GIT_PROJECTS="$DIR_DEV/git" export DIR_GIT_PROJECTS="$DIR_DEV/git"
export DIR_SCRATCH_NOTES="$DIR_HOME_BOX/life/scratchpad/notes"
export DIR_SCRATCH_DRAWINGS="$DIR_HOME_BOX/life/scratchpad/drawings"
# util dirs; do not change without checking impact on xdg base dirs # util dirs; do not change without checking impact on xdg base dirs
export DIR_LOCAL="$HOME/.local" export DIR_LOCAL="$HOME/.local"

View File

@@ -11,6 +11,7 @@ alias gfo='git fetch origin'
alias git-push-to-temp='git branch -D temp; git checkout -b temp; git push origin temp -uf; git checkout -' alias git-push-to-temp='git branch -D temp; git checkout -b temp; git push origin temp -uf; git checkout -'
alias gpdev='git-push-to-temp' alias gpdev='git-push-to-temp'
alias gpo='git pull origin' alias gpo='git pull origin'
git config --global user.email "$EMAIL_PERSONAL_DEV"
# code/test/linter run and build commands # code/test/linter run and build commands
alias bel='bundle exec standardrb' alias bel='bundle exec standardrb'

5
src_files/.local/bin/mvd Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/zsh
local target_dir=$(dirname "${@: -1}")
[[ ! -d "$target_dir" ]] && mkdir -p "$target_dir"
exec mv "$@"

View File

@@ -1,21 +0,0 @@
local omitted_dirs=(
$HOME
$DIR_HOME_BOX
$DIR_DEV
$DIR_GIT_PROJECTS
)
[[ ! ${omitted_dirs[(re)$(pwd)]} ]] &&
tmux new-window -d -n cmd &&
tmux rename-window $EDITOR &&
$EDITOR .
clear
## example template for custom override
# tmux new-window -d -n cmd
# tmux send-keys -t :cmd "echo 'in cmd'" c-M
# tmux new-window -d -n another
# tmux send-keys -t :another "echo 'in another'" c-M
# tmux rename-window $EDITOR
# $EDITOR .
# clear

View File

@@ -5,13 +5,15 @@ switch_to() {
} }
hydrate() { hydrate() {
local tmux_hydrate_path="$DIR_SCRIPTS/.tmux-session-hydrate-default" local tmux_hydrate_files_dir="$XDG_CONFIG_HOME/tmux/session-hydrate-files"
local tmux_hydrate_path="$tmux_hydrate_files_dir/.tmux-session-hydrate-default"
[[ $1 = "thinking" ]] && tmux_hydrate_path="$tmux_hydrate_files_dir/.tmux-session-hydrate-thinking"
[[ $1 = "listening" ]] && tmux_hydrate_path="$tmux_hydrate_files_dir/.tmux-session-hydrate-listening"
[[ -f $2/.tmux-session-hydrate ]] && tmux_hydrate_path="$2/.tmux-session-hydrate" [[ -f $2/.tmux-session-hydrate ]] && tmux_hydrate_path="$2/.tmux-session-hydrate"
[[ -f $tmux_hydrate_path ]] && tmux send-keys -t $1 "source $tmux_hydrate_path" c-M [[ -f $tmux_hydrate_path ]] && tmux send-keys -t $1 "source $tmux_hydrate_path" c-M
} }
local name_regex="^\([-_A-Za-z0-9]*\):.*$" local existing_sessions=$([[ -n $(pgrep tmux) ]] && tmux list-sessions || echo '')
local existing_sessions=$([[ -n $(pgrep tmux) ]] && tmux list-sessions | sed "s/$name_regex/\1/" || echo '')
local search_dirs=( local search_dirs=(
$DIR_HOME_BOX $DIR_HOME_BOX
$DIR_DEV $DIR_DEV
@@ -23,8 +25,10 @@ local target_path=''
[[ $# -eq 1 ]] && target_path=$1 || [[ $# -eq 1 ]] && target_path=$1 ||
target_path=$(find $search_dirs -mindepth 1 -maxdepth 1 -type d | fzf) target_path=$(find $search_dirs -mindepth 1 -maxdepth 1 -type d | fzf)
if [[ $target_path = "find-existing" ]]; then target_name=$(echo $existing_sessions | fzf); if [[ $target_path = "." ]]; then target_name=$(basename $(pwd)) && target_path=$(pwd);
elif [[ $target_path = "hub" ]]; then target_name="hub" && target_path="$HOME"; elif [[ $target_path = "hub" ]]; then target_name="hub" && target_path="$HOME";
elif [[ $target_path = "thinking" ]]; then target_name="thinking" && target_path="$DIR_SCRATCH_NOTES";
elif [[ $target_path = "listening" ]]; then target_name="listening" && target_path="$DIR_MUSIC";
elif [[ -n $target_path ]]; then target_name=$(basename "$target_path" | tr . _); elif [[ -n $target_path ]]; then target_name=$(basename "$target_path" | tr . _);
fi fi

View File

@@ -0,0 +1,3 @@
#!/bin/sh
/Applications/GIMP.app/Contents/MacOS/gimp