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

@@ -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", "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-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
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)
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
vim.keymap.set("n", "<leader>Y", [["+Y]])
vim.keymap.set("n", "<leader>D", [["+D]])
vim.keymap.set("n", "<leader>p", [["+p]])
-- 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 - 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
# 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
# all windows in a space to float mode
alt + shift - f : yabai -m space --layout float
# 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
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
# 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-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
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 -r C-l switch-client -l
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
export DIR_HOME_BOX="$HOME/dbox"
export DIR_MUSIC="$DIR_HOME_BOX/media/music"
export DIR_DEV="$HOME/dev"
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
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 gpdev='git-push-to-temp'
alias gpo='git pull origin'
git config --global user.email "$EMAIL_PERSONAL_DEV"
# code/test/linter run and build commands
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() {
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 $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 | sed "s/$name_regex/\1/" || echo '')
local existing_sessions=$([[ -n $(pgrep tmux) ]] && tmux list-sessions || echo '')
local search_dirs=(
$DIR_HOME_BOX
$DIR_DEV
@@ -23,8 +25,10 @@ local target_path=''
[[ $# -eq 1 ]] && target_path=$1 ||
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 = "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 . _);
fi

View File

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