From d916c3315d1b2b86f5bb1733d9661faebd595246 Mon Sep 17 00:00:00 2001 From: Lockszmith Date: Sun, 29 May 2022 00:17:40 +0000 Subject: [PATCH] Some separation of chezmoi logic Added commands to change GitHub URL --- _home/dot_bashrc | 2 +- _home/dot_sz.shrc.d/21_aliases | 3 --- _home/dot_sz.shrc.d/98_chezmoi | 19 +++++++++++++++++++ _home/dot_sz.shrc.d/98_chezmoi.changes | 5 ----- _home/private_dot_config/nvim/init.vim | 1 + 5 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 _home/dot_sz.shrc.d/98_chezmoi delete mode 100644 _home/dot_sz.shrc.d/98_chezmoi.changes diff --git a/_home/dot_bashrc b/_home/dot_bashrc index 6e84ad1..12a3b54 100644 --- a/_home/dot_bashrc +++ b/_home/dot_bashrc @@ -4,7 +4,7 @@ # If not running interactively, don't do anything case $- in - *i*) ;; + *i*) echo "Welcome $USER to $(hostname)";; *) return;; esac diff --git a/_home/dot_sz.shrc.d/21_aliases b/_home/dot_sz.shrc.d/21_aliases index b67c309..64b6274 100644 --- a/_home/dot_sz.shrc.d/21_aliases +++ b/_home/dot_sz.shrc.d/21_aliases @@ -11,6 +11,3 @@ alias lessr="less --raw-control-chars " alias ed="nvim " alias sz-edshrc="ed ~/.sz.shrc.d ; exec $SHELL" -alias cz="chezmoi " -alias cz-refresh="chezmoi status | cut -d\ -f2 | grep '^\.sz\.shrc\.d' | xargs chezmoi forget --force; chezmoi add ~/.sz.shrc.d --recursive; chezmoi status; chezmoi git status" -alias cz-commit="chezmoi git -- commit -a " diff --git a/_home/dot_sz.shrc.d/98_chezmoi b/_home/dot_sz.shrc.d/98_chezmoi new file mode 100644 index 0000000..9affbc9 --- /dev/null +++ b/_home/dot_sz.shrc.d/98_chezmoi @@ -0,0 +1,19 @@ +if [[ -n "$(type -fP chezmoi)" ]]; then + alias cz="chezmoi " + alias cz-refresh="chezmoi status | cut -d\ -f2 | grep '^\.sz\.shrc\.d' | xargs chezmoi forget --force; chezmoi add ~/.sz.shrc.d --recursive; chezmoi status; chezmoi git status" + alias cz-commit="chezmoi git -- commit -a " + + function cz-set-ssh-github() { + chezmoi git -- remote set-url origin "$(chezmoi git -- remote get-url origin | sed 's|https://github.com/|git@github.com:|')" + chezmoi git -- remote get-url origin + } + + function cz-set-https-github() { + chezmoi git -- remote set-url origin "$(chezmoi git -- remote get-url origin | sed 's|git@github.com:|https://github.com/|')" + chezmoi git -- remote get-url origin + } + + CHEZMOI_OUT="$(chezmoi status || true)x" + [[ "x" != "$CHEZMOI_OUT" ]] && printf "\nChezmoi changes:\n" && echo "${CHEZMOI_OUT%?}" + unset CHEZMOI_OUT +fi diff --git a/_home/dot_sz.shrc.d/98_chezmoi.changes b/_home/dot_sz.shrc.d/98_chezmoi.changes deleted file mode 100644 index a1daf97..0000000 --- a/_home/dot_sz.shrc.d/98_chezmoi.changes +++ /dev/null @@ -1,5 +0,0 @@ -if [[ -n "$(type -fP chezmoi)" ]]; then - CHEZMOI_OUT="$(chezmoi status || true)x" - [[ -n "$CHEZMOI_OUT" ]] && printf "\nChezmoi changes:\n" && echo "${CHEZMOI_OUT%?}" - unset CHEZMOI_OUT -fi diff --git a/_home/private_dot_config/nvim/init.vim b/_home/private_dot_config/nvim/init.vim index 98efb0f..7fa8dd1 100644 --- a/_home/private_dot_config/nvim/init.vim +++ b/_home/private_dot_config/nvim/init.vim @@ -1,3 +1,4 @@ +set background=dark " Install vim-plug if not found let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' if empty(glob(data_dir . '/autoload/plug.vim'))