Compare commits
5 Commits
27df76d9a3
...
1c535ead24
Author | SHA1 | Date | |
---|---|---|---|
1c535ead24 | |||
aa64550b72 | |||
bfae90f83a | |||
9660f2c50b | |||
9e666e53b2 |
16
README.md
16
README.md
@ -1,6 +1,12 @@
|
|||||||
### script run plan
|
# repo containing configs and scripts to set up a box
|
||||||
- run `./pre_run*` scripts
|
|
||||||
- run `./run` to install/build/etc programs
|
### prerequisites
|
||||||
- run `./copy_configs` to copy configs/scripts/executables into place
|
- install git if not already installed
|
||||||
- run `./post_config*` scripts
|
- clone this repo
|
||||||
|
- if on macOS, install [homebrew](https://brew.sh/)
|
||||||
|
- export the env var `BOX_SETUP_OS` to indicate the operating system
|
||||||
|
-- (options defined in `set_env_vars` file)
|
||||||
|
|
||||||
|
### script run
|
||||||
|
- from the repo's root directory, run `./setup_this_box`
|
||||||
|
|
||||||
|
@ -17,11 +17,9 @@ while [[ $# > 0 ]]; do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
local script_dir=$(cd $(dirname "${ZSH_SOURCE[0]}") &> /dev/null && pwd)
|
log "install_programs // single_script_filter: $single_script_filter"
|
||||||
log "run // script_dir: $script_dir -- args: $single_script_filter"
|
local scripts=$(find ./installs_and_builds -maxdepth 1 -mindepth 1 -type f | sort)
|
||||||
cd $script_dir
|
for script in ${=scripts}; do
|
||||||
local scripts=(`find ./runs -maxdepth 1 -mindepth 1 -type f`)
|
|
||||||
for script in $scripts; do
|
|
||||||
if [[ -x $script ]]; then
|
if [[ -x $script ]]; then
|
||||||
if echo "$script" | grep -qv "$single_script_filter"; then
|
if echo "$script" | grep -qv "$single_script_filter"; then
|
||||||
log "filter is $single_script_filter // ignoring: $script"
|
log "filter is $single_script_filter // ignoring: $script"
|
6
installs_and_builds/s01_libs
Executable file
6
installs_and_builds/s01_libs
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
local lua_package="lua5.1"
|
||||||
|
[[ "$BOX_SETUP_OS" = "macos" ]] && lua_package="lua@5.1"
|
||||||
|
|
||||||
|
${=BOX_SETUP_INSTALL_COMMAND} cmake gettext "$lua_package" liblua5.1-0-dev
|
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
# likely on unix systems already: find xargs grep sed awk
|
# likely on unix systems already: find xargs grep sed awk
|
||||||
|
|
||||||
brew install jq parallel
|
${=BOX_SETUP_INSTALL_COMMAND} jq parallel
|
2
installs_and_builds/s11_git
Executable file
2
installs_and_builds/s11_git
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
${=BOX_SETUP_INSTALL_COMMAND} git
|
3
installs_and_builds/s12_neovim
Executable file
3
installs_and_builds/s12_neovim
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
${=BOX_SETUP_INSTALL_COMMAND} neovim
|
2
installs_and_builds/s13_tmux
Executable file
2
installs_and_builds/s13_tmux
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
${=BOX_SETUP_INSTALL_COMMAND} tmux
|
2
installs_and_builds/s14_fzf
Executable file
2
installs_and_builds/s14_fzf
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
${=BOX_SETUP_INSTALL_COMMAND} fzf
|
@ -1,22 +1,17 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
local install_command="sudo apt install"
|
# local neovim_dir=$HOME/.local/build/neovim
|
||||||
[[ -x $(which brew) ]] && install_command="brew install"
|
# local neovim_version="v0.10.3"
|
||||||
|
# [ ! -z $NVIM_VERSION ] && neovim_version="$NVIM_VERSION"
|
||||||
local neovim_dir=$HOME/.local/build/neovim
|
# echo "neovim_version: \"$neovim_version\""
|
||||||
local neovim_version="v0.10.3"
|
#
|
||||||
[ ! -z $NVIM_VERSION ] && neovim_version="$NVIM_VERSION"
|
# [ ! -d $neovim_dir ] && git clone https://github.com/neovim/neovim.git $neovim_dir
|
||||||
echo "neovim_version: \"$neovim_version\""
|
# git -C $neovim_dir fetch --all
|
||||||
|
# git -C $neovim_dir checkout $neovim_version
|
||||||
[ ! -d $neovim_dir ] && git clone https://github.com/neovim/neovim.git $neovim_dir
|
#
|
||||||
git -C $neovim_dir fetch --all
|
# make -C $neovim_dir clean
|
||||||
git -C $neovim_dir checkout $neovim_version
|
# make -C $neovim_dir CMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
# sudo make -C $neovim_dir install
|
||||||
$install_command cmake gettext lua@5.1 liblua5.1-0-dev
|
|
||||||
|
|
||||||
make -C $neovim_dir clean
|
|
||||||
make -C $neovim_dir CMAKE_BUILD_TYPE=RelWithDebInfo
|
|
||||||
sudo make -C $neovim_dir install
|
|
||||||
|
|
||||||
# lines below from primeagen's dev repo, uncomment/edit as needed
|
# lines below from primeagen's dev repo, uncomment/edit as needed
|
||||||
# git clone https://github.com/ThePrimeagen/harpoon.git $HOME/personal/harpoon
|
# git clone https://github.com/ThePrimeagen/harpoon.git $HOME/personal/harpoon
|
7
make_config_dirs
Executable file
7
make_config_dirs
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
[[ ! -d $HOME/.config ]] && mkdir $HOME/.config
|
||||||
|
[[ ! -d $HOME/.local ]] && mkdir $HOME/.local
|
||||||
|
[[ ! -d $HOME/.local/bin ]] && mkdir $HOME/.local/bin
|
||||||
|
[[ ! -d $HOME/.local/build ]] && mkdir $HOME/.local/build
|
||||||
|
[[ ! -d $HOME/.local/tmp ]] && mkdir $HOME/.local/tmp
|
4
make_desired_dirs
Executable file
4
make_desired_dirs
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
[[ ! -d $HOMEBOX ]] && mkdir $HOMEBOX
|
||||||
|
[[ ! -d $DEVDIR ]] && mkdir $DEVDIR
|
@ -1,8 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
|
|
||||||
mkdirs_after_setting_shell_env_vars() {
|
|
||||||
[[ ! -d $HOMEBOX ]] && mkdir $HOMEBOX
|
|
||||||
[[ ! -d $DEVDIR ]] && mkdir $DEVDIR
|
|
||||||
}
|
|
||||||
|
|
||||||
mkdirs_after_setting_shell_env_vars
|
|
11
pre_run_01
11
pre_run_01
@ -1,11 +0,0 @@
|
|||||||
#!/bin/zsh
|
|
||||||
|
|
||||||
mkdirs_before_copying_config_files() {
|
|
||||||
[[ ! -d $HOME/.config ]] && mkdir $HOME/.config
|
|
||||||
[[ ! -d $HOME/.local ]] && mkdir $HOME/.local
|
|
||||||
[[ ! -d $HOME/.local/bin ]] && mkdir $HOME/.local/bin
|
|
||||||
[[ ! -d $HOME/.local/build ]] && mkdir $HOME/.local/build
|
|
||||||
[[ ! -d $HOME/.local/tmp ]] && mkdir $HOME/.local/tmp
|
|
||||||
}
|
|
||||||
|
|
||||||
mkdirs_before_copying_config_files
|
|
12
set_env_vars
Normal file
12
set_env_vars
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[[ -z $BOX_SETUP_OS ]] &&
|
||||||
|
echo "BOX_SETUP_OS must be set; options: arch, artix, debian, macos" &&
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
local install_cmd=''
|
||||||
|
case $BOX_SETUP_OS in
|
||||||
|
(arch | artix) install_cmd="sudo pacman -S" ;;
|
||||||
|
(debian) export install_cmd="sudo apt install" ;;
|
||||||
|
(macos) export install_cmd="brew install" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
export BOX_SETUP_INSTALL_COMMAND="$install_cmd"
|
7
setup_this_box
Executable file
7
setup_this_box
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
source set_env_vars
|
||||||
|
./install_programs
|
||||||
|
./make_config_dirs
|
||||||
|
./copy_configs
|
||||||
|
./make_desired_dirs
|
@ -21,10 +21,13 @@ bind -r l select-pane -R
|
|||||||
bind r source-file "~/.config/tmux/tmux.conf" \; display-message "tmux.conf reloaded"
|
bind r source-file "~/.config/tmux/tmux.conf" \; display-message "tmux.conf reloaded"
|
||||||
|
|
||||||
# kill the current session
|
# kill the current session
|
||||||
bind Q rename-session zzzz-temp-kill\; switch-client -p\; kill-session -t zzzz-temp-kill
|
bind-key Q rename-session zzzz-temp-kill\; switch-client -p\; kill-session -t zzzz-temp-kill
|
||||||
|
bind-key W kill-session
|
||||||
|
|
||||||
# use tmux-sessionizer in place of f find
|
# custom find using tmux-sessionizer
|
||||||
bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
|
unbind-key f
|
||||||
|
bind-key f run-shell "tmux neww ~/.local/bin/tmux-sessionizer existing"
|
||||||
|
bind-key F run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
|
||||||
|
|
||||||
# bind -r D neww -c "#{pane_current_path}" "[[ -e TODO.md ]] && $EDITOR TODO.md || $EDITOR ~/personal/dev/todo.md"
|
# bind -r D neww -c "#{pane_current_path}" "[[ -e TODO.md ]] && $EDITOR TODO.md || $EDITOR ~/personal/dev/todo.md"
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#!/bin/zsh
|
|
||||||
|
|
||||||
local omitted_dirs=(
|
local omitted_dirs=(
|
||||||
$HOME
|
$HOME
|
||||||
$HOMEBOX
|
$HOMEBOX
|
||||||
@ -13,3 +11,11 @@ local omitted_dirs=(
|
|||||||
|
|
||||||
clear
|
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
|
||||||
|
@ -4,35 +4,33 @@ switch_to() {
|
|||||||
[[ -z $TMUX ]] && tmux attach-session -t $1 || tmux switch-client -t $1
|
[[ -z $TMUX ]] && tmux attach-session -t $1 || tmux switch-client -t $1
|
||||||
}
|
}
|
||||||
|
|
||||||
tmux_session_exists() {
|
|
||||||
[[ -n $(pgrep tmux) ]] && tmux list-sessions | grep -q "^$1:"
|
|
||||||
}
|
|
||||||
|
|
||||||
hydrate() {
|
hydrate() {
|
||||||
local tmux_hydrate_path="$HOME/.local/bin/.tmux-session-hydrate"
|
local tmux_hydrate_path="$HOME/.local/bin/.tmux-session-hydrate"
|
||||||
[[ -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 | sed "s/$name_regex/\1/" || echo '')
|
||||||
local search_dirs=(
|
local search_dirs=(
|
||||||
$HOMEBOX
|
$HOMEBOX
|
||||||
$DEVDIR
|
$DEVDIR
|
||||||
$DEVDIR/git/*
|
$DEVDIR/git/*
|
||||||
)
|
)
|
||||||
local selected_path=''
|
local target_name=''
|
||||||
[[ $# -eq 1 ]] && selected_path=$1 ||
|
local target_path=''
|
||||||
selected_path=$(
|
|
||||||
find $search_dirs -mindepth 1 -maxdepth 1 -type d |
|
|
||||||
(echo 'hub' && cat) |
|
|
||||||
fzf
|
|
||||||
)
|
|
||||||
[[ -z $selected_path ]] && exit 0
|
|
||||||
|
|
||||||
local selected_name=''
|
[[ $# -eq 1 ]] && target_path=$1 ||
|
||||||
[[ "$selected_path" = "hub" ]] && selected_name="hub" && selected_path=$HOME ||
|
target_path=$(find $search_dirs -mindepth 1 -maxdepth 1 -type d | fzf)
|
||||||
selected_name=$(basename "$selected_path" | tr . _)
|
|
||||||
|
|
||||||
! (tmux_session_exists $selected_name) &&
|
if [[ $target_path = "existing" ]]; then target_name=$(echo $existing_sessions | fzf);
|
||||||
tmux new-session -d -s $selected_name -c $selected_path &&
|
elif [[ $target_path = "hub" ]]; then target_name="hub" && target_path="$HOME";
|
||||||
hydrate $selected_name $selected_path
|
elif [[ -n $target_path ]]; then target_name=$(basename "$target_path" | tr . _);
|
||||||
switch_to $selected_name
|
fi
|
||||||
|
|
||||||
|
[[ -z $target_name ]] && exit 0
|
||||||
|
|
||||||
|
! (echo $existing_sessions | grep -q "$target_name") &&
|
||||||
|
tmux new-session -d -s $target_name -c $target_path &&
|
||||||
|
hydrate $target_name $target_path
|
||||||
|
switch_to $target_name
|
||||||
|
@ -9,6 +9,7 @@ export DEVDIR=$HOME'/dev'
|
|||||||
# path updates
|
# path updates
|
||||||
export PATH=$HOME/.local/bin:$HOME/.local/scripts:$PATH
|
export PATH=$HOME/.local/bin:$HOME/.local/scripts:$PATH
|
||||||
export PATH=$PATH:/opt/homebrew/opt/ccache/libexec
|
export PATH=$PATH:/opt/homebrew/opt/ccache/libexec
|
||||||
|
export PATH=$PATH:~/bin/android-sdk-darwin/platform-tools:/opt/homebrew/opt/ccache/libexec
|
||||||
|
|
||||||
# executable name overrides
|
# executable name overrides
|
||||||
alias ls='ls -F'
|
alias ls='ls -F'
|
||||||
@ -45,3 +46,6 @@ alias shrug='echo "¯\\_(ツ)_/¯"'
|
|||||||
alias lintjs='npx prettier --write'
|
alias lintjs='npx prettier --write'
|
||||||
export DEVKITARM=/opt/devkitpro/devkitARM
|
export DEVKITARM=/opt/devkitpro/devkitARM
|
||||||
. /opt/homebrew/opt/asdf/libexec/asdf.sh # TODO: ensure not duplicated asdf logic
|
. /opt/homebrew/opt/asdf/libexec/asdf.sh # TODO: ensure not duplicated asdf logic
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user