diff --git a/copy_configs b/copy_configs index 63bd424..6871053 100755 --- a/copy_configs +++ b/copy_configs @@ -3,18 +3,6 @@ execute() { log "execute $@" && "$@" } log() { echo "$@" } -copy_dir() { - local from=$1 - local to=$2 - pushd $from > /dev/null - local dirs=(`find . -mindepth 1 -maxdepth 1 -type d`) - for dir in $dirs; do - [[ -d $to/$dir ]] && execute rm -rf $to/$dir - execute cp -rp $dir $to/$dir - done - popd > /dev/null -} - copy_file() { local from=$1 local to=$2 @@ -23,20 +11,42 @@ copy_file() { execute cp -p $from $to/$filename } -log "---------------- dotfiles ----------------" +copy_dir() { + local from=$1 + local to=$2 + pushd $from > /dev/null + local directories=(`find . -mindepth 1 -maxdepth 1 -type d`) + for dir in $directories; do + [[ -d $to/$dir ]] && execute rm -rf $to/$dir + execute cp -rp $dir $to/$dir + done + local files=(`find . -mindepth 1 -maxdepth 1 -type f`) + for file in $files; do + copy_file $file $to + done + popd > /dev/null +} -copy_dir src_files/.config $XDG_CONFIG_HOME -copy_dir src_files/.local $DIR_LOCAL +link_dir() { + local src_dir=$1 + local link_dir=$2 + log "deleting existing link/dir: $link_dir" + [[ -h "$link_dir" ]] && rm $link_dir + [[ -d "$link_dir" ]] && rm -rf $link_dir + log "sym-linking $link_dir -> $src_dir" + ln -s $src_dir $link_dir +} + +log "---------------- dotfiles ----------------" copy_file src_files/.config/zsh/.zshenv $HOME # duplicate, copy anyway, ensures $ZDOTDIR -# on macos, handle sim-linking to gimp config since gimp defaults to app-support -if [[ "$BOX_SETUP_OS" = "macos" ]]; then - local macos_gimp_dir="$HOME/Library/Application Support/GIMP" - log "deleting existing GIMP link/dir: $macos_gimp_dir" - [[ -h "$macos_gimp_dir" ]] && rm $macos_gimp_dir - [[ -d "$macos_gimp_dir" ]] && rm -rf $macos_gimp_dir - log "linking $macos_gimp_dir to \$XDG_CONFIG_HOME/GIMP" - ln -s $XDG_CONFIG_HOME/GIMP $macos_gimp_dir -fi +copy_dir src_files/.config $XDG_CONFIG_HOME +copy_dir src_files/.local/bin $DIR_BIN +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" ]] && + link_dir "$XDG_CONFIG_HOME/GIMP" "$HOME/Library/Application Support/GIMP" +link_dir "$XDG_CONFIG_HOME/vim" "$HOME/.vim" # TODO: use vim wrapper or similar instead diff --git a/src_files/.config/vim/pack/plugins/start/.git-repo-placeholder b/src_files/.config/vim/pack/plugins/start/.plugin-git-clone-script old mode 100644 new mode 100755 similarity index 68% rename from src_files/.config/vim/pack/plugins/start/.git-repo-placeholder rename to src_files/.config/vim/pack/plugins/start/.plugin-git-clone-script index 9ca0caa..b424585 --- a/src_files/.config/vim/pack/plugins/start/.git-repo-placeholder +++ b/src_files/.config/vim/pack/plugins/start/.plugin-git-clone-script @@ -1,3 +1,4 @@ -plugins, git repos for ref, clone in this dir if needed +#/bin/zsh + git clone https://github.com/ghifarit53/tokyonight-vim.git git clone https://github.com/leafgarland/typescript-vim.git diff --git a/src_files/.config/vim/vimrc b/src_files/.config/vim/vimrc index c1b6394..4d9b1a6 100644 --- a/src_files/.config/vim/vimrc +++ b/src_files/.config/vim/vimrc @@ -1,7 +1,12 @@ " base settings set nocompatible let mapleader="," -set runtimepath+=$XDG_CONFIG_HOME/vim + +" xdg base directory settings/clean-up +set runtimepath^=$XDG_CONFIG_HOME/vim +" add other dirs to path as needed +" XDG_CONFIG_HOME, XDG_CACHE_HOME, XDG_DATA_HOME, XDG_STATE_HOME, XDG_DATA_DIRS +" set/override other filenames/paths/dirs as needed " plugin config let g:netrw_banner=0 " hide banner diff --git a/src_files/.config/zsh/.zshrc b/src_files/.config/zsh/.zshrc index 59c15dd..353de63 100644 --- a/src_files/.config/zsh/.zshrc +++ b/src_files/.config/zsh/.zshrc @@ -4,7 +4,6 @@ set -o vi # path updates export PATH=$DIR_BIN:$DIR_SCRIPTS:$PATH export PATH=$PATH:/opt/homebrew/opt/ccache/libexec:/opt/homebrew/bin -export PATH=$PATH:$HOME/bin/android-sdk-darwin/platform-tools # shortcuts for common commands alias 3e='echo;echo;echo'