From 33976f54a78df8d8ed58036608a4e3b7e76a38f2 Mon Sep 17 00:00:00 2001
From: david <david@pinewoods.xyz>
Date: Fri, 4 Apr 2025 16:55:39 -0500
Subject: [PATCH] Add copy_dotfiles script and other things

---
 .config/nvim/init.lua  |  1 +
 .config/tmux/tmux.conf | 27 +++++++++++++++++++++
 copy_dotfiles          | 55 ++++++++++++++++++++++++++++++++++++++++++
 pre_run_01             |  5 ++++
 run                    |  2 +-
 runs/dev_tools         |  3 +++
 runs/neovim            |  7 +++++-
 zxcv-todo              |  1 +
 8 files changed, 99 insertions(+), 2 deletions(-)
 create mode 100644 .config/nvim/init.lua
 create mode 100644 .config/tmux/tmux.conf
 create mode 100755 copy_dotfiles
 create mode 100755 pre_run_01
 create mode 100755 runs/dev_tools
 create mode 100644 zxcv-todo

diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
new file mode 100644
index 0000000..2b5d4e9
--- /dev/null
+++ b/.config/nvim/init.lua
@@ -0,0 +1 @@
+print("print from init.lua file")
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf
new file mode 100644
index 0000000..7e8cb69
--- /dev/null
+++ b/.config/tmux/tmux.conf
@@ -0,0 +1,27 @@
+set -g default-terminal "tmux-255color"
+set -s escape-time 0
+
+unbind C-b
+set-option -g prefix C-a
+bind-key C-a send-prefix
+set -g status-style 'bg=#333333 fg=#5eacd3'
+set -g base-index 1
+
+set-window-option -g mode-keys vi
+bind -T copy-mode-vi v send-keys -X begin-selection
+bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
+
+# vim-like pane switching
+bind -r ^ last-window
+bind -r k select-pane -U
+bind -r j select-pane -D
+bind -r h select-pane -L
+bind -r l select-pane -R
+
+bind -r D neww -c "#{pane_current_path}" "[[ -e TODO.md ]] && nvim TODO.md || nvim ~/personal/dev/todo.md"
+
+bind r source-file "~/.config/tmux/tmux.conf" \; display-message "tmux.conf reloaded"
+
+# forget the find window.  That is for chumps
+bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
+
diff --git a/copy_dotfiles b/copy_dotfiles
new file mode 100755
index 0000000..fe5ca08
--- /dev/null
+++ b/copy_dotfiles
@@ -0,0 +1,55 @@
+#!/bin/zsh
+
+dry="0"
+
+execute() {
+    log "execute $@"
+    if [[ $dry != "1" ]]; then
+        "$@"
+    fi
+}
+
+log() {
+    if [[ $dry != "1" ]]; then
+        echo "$@"
+    else
+        echo "[DRY RUN]: $@"
+    fi
+}
+
+while [[ $# > 0 ]]; do
+    if [[ $1 == "--dry" ]]; then
+        dry="1"
+    fi
+    shift
+done
+
+log "---------------- dotfiles ----------------"
+
+copy_dir() {
+    from=$1
+    to=$2
+    pushd $from > /dev/null
+    dirs=(`find . -mindepth 1 -maxdepth 1 -type d`)
+    echo $dirs
+    for dir in $dirs; do
+        if [[ -d $to/$dir ]]; then
+            execute rm -rf $to/$dir
+        fi
+        execute cp -rp $dir $to/$dir
+    done
+    popd > /dev/null
+}
+
+copy_file() {
+    from=$1
+    to=$2
+    filename=$(basename $from)
+    if [[ -e $to/$filename ]]; then
+        execute rm $to/$filename
+    fi
+    execute cp -p $from $to/$filename
+}
+
+copy_dir .config $HOME/.config
+# copy_file .zxcv $HOME
diff --git a/pre_run_01 b/pre_run_01
new file mode 100755
index 0000000..153e6a8
--- /dev/null
+++ b/pre_run_01
@@ -0,0 +1,5 @@
+#!/bin/zsh
+
+if [[ ! -d $HOME/bin ]]; then
+    mkdir $HOME/bin
+fi
diff --git a/run b/run
index db0ee9c..18f2dc2 100755
--- a/run
+++ b/run
@@ -30,7 +30,7 @@ done
 script_dir=$(cd $(dirname "${ZSH_SOURCE[0]}") &> /dev/null && pwd)
 log "run // script_dir: $script_dir -- args: $single_script_filter"
 cd $script_dir
-scripts=$(find ./runs -maxdepth 1 -mindepth 1 -type f)
+scripts=(`find ./runs -maxdepth 1 -mindepth 1 -type f`)
 for script in $scripts; do
     if [[ -x $script ]]; then
         if echo "$script" | grep -qv "$single_script_filter"; then
diff --git a/runs/dev_tools b/runs/dev_tools
new file mode 100755
index 0000000..d835e5d
--- /dev/null
+++ b/runs/dev_tools
@@ -0,0 +1,3 @@
+#!/bin/zsh
+
+brew install git tmux
diff --git a/runs/neovim b/runs/neovim
index e751170..92868e8 100755
--- a/runs/neovim
+++ b/runs/neovim
@@ -1,3 +1,8 @@
 #!/bin/zsh
 
-echo "setup script for neovim"
+neovim_dir=$HOME/bin/neovim
+git clone -b v0.10.3 https://github.com/neovim/neovim.git $neovim_dir
+brew install cmake gettext lua5.1 liblua5.1-0-dev
+cd $neovim_dir
+make CMAKE_BUILD_TYPE=RelWithDebInfo
+sudo make install
diff --git a/zxcv-todo b/zxcv-todo
new file mode 100644
index 0000000..2dd11ae
--- /dev/null
+++ b/zxcv-todo
@@ -0,0 +1 @@
+add numbers/letters to sort and run scripts in particular order