diff --git a/kfg b/kfg index 6526d1c..e4886f4 100755 --- a/kfg +++ b/kfg @@ -186,6 +186,23 @@ function install_rc { fi } +function prepend_rc { + # Add the file to the rc file as source $file + SOURCE_CMD="$1" + RC="$HOME_PATH/$RC_FILE" + case `grep -Fox "${SOURCE_CMD}" "$RC"> /dev/null; echo $?` in + 1) + sed -i "1i${SOURCE_CMD//$'\n'/\\n}" "$RC" + log_add "Added \"$SOURCE_CMD\" to $RC" + ;; + 0) + log_debug "\"$SOURCE_CMD\" already in $RC" + ;; + *) + log_error "Error occured trying to add $SOURCE_CMD to $RC" + esac +} + function download { local _url=$1 local _path=$2 @@ -534,12 +551,10 @@ function p_zsh { # ----------------- apt_install zsh set_shell zsh - # --- TODO --- : Keyboard navigation, Suggestions, ... - - #wget -O .zshrc https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc - #git clone https://github.com/zsh-users/zsh-autosuggestions "$HOME/.config/zsh/zsh-autosuggestions" - # source ~/.config/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh + install_rc_download "sh" "_kfg.rc" "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.config/sh/_kfg.rc" + install_rc_download "sh" "keybindings.rc" "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.config/sh/keybindings.rc" + install_rc_download "sh" "util.rc" "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.config/sh/util.rc" download_config sh zsh-autosuggestions.zsh "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.config/sh/zsh-autosuggestions.zsh" download_config sh zsh-syntax-highlighting.zsh "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.config/sh/zsh-syntax-highlighting.zsh" @@ -552,7 +567,9 @@ function p_zsh { download_config sh highlighters/root/root-highlighter.zsh "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.config/sh/highlighters/root/root-highlighter.zsh" download_config sh .version "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.config/sh/.version" download_config sh .revision-hash "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.config/sh/.revision-hash" + download_config sh zsh-ghostty-integration.zsh "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.config/sh/zsh-ghostty-integration.zsh" install_rc_download sh zsh.rc 'https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.config/sh/zsh.rc' + prepend_rc $'# Ghostty Integration for OSC 133 marks\n[ -f /home/cbeckmann/.config/sh/zsh-ghostty-integration.zsh ] && source /home/cbeckmann/.config/sh/zsh-ghostty-integration.zsh\n' } @@ -690,7 +707,7 @@ function p_nvim { res=$(git -C "${TMP_PATH}" clone --filter=blob:none --no-checkout --depth 1 --sparse https://git.cbeck.tech/kamu/dotfiles.git "${TMP_PATH}/dotfiles" 2>&1) res=$(git -C "${TMP_PATH}/dotfiles" sparse-checkout add ".config/nvim" 2>&1) res=$(git -C "${TMP_PATH}/dotfiles" checkout 2>&1) - res=$(cp -r "${TMP_PATH}/dotfiles/.config/nvim" ${CONFIG_PATH}/nvim/ 2>&1) + res=$(cp -r "${TMP_PATH}/dotfiles/.config/nvim/*" ${CONFIG_PATH}/nvim/ 2>&1) log_add "Added neovim configuration." } @@ -709,9 +726,6 @@ function install { # ----------------- install_rc "export KHOME=$HOME_PATH" install_rc "export XDG_CONFIG_HOME=$CONFIG_PATH" - install_rc_download "sh" "_kfg.rc" "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.config/sh/_kfg.rc" - install_rc_download "sh" "keybindings.rc" "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.config/sh/keybindings.rc" - install_rc_download "sh" "util.rc" "https://git.cbeck.tech/kamu/dotfiles/raw/branch/main/.config/sh/util.rc" while : do @@ -1059,4 +1073,4 @@ function assert_nz() { { main "$@" || exit 1 -} \ No newline at end of file +}