From f2e8d831ab709a722445877df6288ed4cfdf2420 Mon Sep 17 00:00:00 2001 From: Gerrit Pannek Date: Tue, 15 Feb 2022 08:55:29 +0100 Subject: [PATCH] Feature: Support linking files only --- .../nvim/lua/custom/chadrc.lua | 0 setup.sh | 24 +++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) rename {config => configfile}/nvim/lua/custom/chadrc.lua (100%) diff --git a/config/nvim/lua/custom/chadrc.lua b/configfile/nvim/lua/custom/chadrc.lua similarity index 100% rename from config/nvim/lua/custom/chadrc.lua rename to configfile/nvim/lua/custom/chadrc.lua diff --git a/setup.sh b/setup.sh index 358c87f..c361409 100755 --- a/setup.sh +++ b/setup.sh @@ -4,32 +4,46 @@ mkdir -p ~/.config/homedir-backup 2>/dev/null function linkfiles { for file in $@; do + create_dir=false name=$(basename $file) dir=$(dirname $file) if [ "$dir" == "dotfiles" ] ; then targetdir="" + elif [ "$( dirname $dir | cut -f1 -d/)" == "configfile" ] ; then + targetdir="config/$(echo $dir | cut -f2- -d/)/" + create_dir=true else targetdir="$dir/" fi if [ ! -L ~/.${targetdir}${name} ] ; then + if $create_dir ; then + mkdir -p ~/.${targetdir} + fi + if [ -f hosts/$(hostname -s)/${name} ] ; then dotfile="$(pwd)/hosts/$(hostname -s)/${name}" else dotfile="$(pwd)/$dir/${name}" fi + mv -v ~/.${targetdir}${name} ~/.config/homedir-backup ln -s "$dotfile" ~/.${targetdir}${name} fi done } -linkfiles 'dotfiles/*' - -git clone https://github.com/NvChad/NvChad ~/.config/nvim -nvim -c "autocmd User PackerComplete quitall" -c "PackerSync" -linkfiles 'config/*' +#linkfiles 'dotfiles/*' +#git clone https://github.com/NvChad/NvChad ~/.config/nvim +#nvim -c "autocmd User PackerComplete quitall" -c "PackerSync" +#linkfiles 'config/*' +set -x +for file in $(find configfile -type f) ; do + linkfiles $file +done +set +x +exit # Install powerline if possible if which pip3 ; then pip3 install --user -U -r requirements.txt