From dafc207f96b63a68e52fc618e34b632c9cfc6b2a Mon Sep 17 00:00:00 2001 From: "Andrew R. M" Date: Mon, 15 Apr 2024 14:38:06 +0000 Subject: [PATCH 1/4] Add a vim option select --- bash/.aliases | 3 +-- bash/.functions | 10 ++++++++++ install.sh | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bash/.aliases b/bash/.aliases index 71ca0be..c1b6a99 100644 --- a/bash/.aliases +++ b/bash/.aliases @@ -1,7 +1,5 @@ #{- ~/.aliases -}# -alias vim="nvim " - #{- FILE OPERATIONS -}# # Allow alias expansion for commands executed with sudo @@ -40,6 +38,7 @@ alias df="df -h" alias du="du -sh" # History searches +alias phistory='cat ${PERSISTENT_HISTFILE}' alias hgrep='history | grep --color' alias phgrep="cat ${PERSISTENT_HISTFILE} | grep --color" diff --git a/bash/.functions b/bash/.functions index 41c5043..c412f00 100644 --- a/bash/.functions +++ b/bash/.functions @@ -21,3 +21,13 @@ cat_with_newline() cat "$@" && echo } alias cat="cat_with_newline" + +vim_option_select() +{ + if which nvim &> /dev/null; then + nvim "$@" + else + vim "$@" + fi +} +alias vim="vim_option_select " diff --git a/install.sh b/install.sh index d4d8483..15c7aae 100755 --- a/install.sh +++ b/install.sh @@ -7,8 +7,8 @@ if [ -f /etc/os-release ]; then echo "Idenitfying OS to install GNU stow..." if grep -q -i debian /etc/os-release; then echo "You've got Debian!"; - sudo apt update; - sudo apt install -y stow; + sudo apt-get update; + sudo apt-get install -y stow; elif grep -q -i rhel /etc/os-release || grep -q -i fedora /etc/os-release; then echo "You've got RedHat (or maybe Fedora)! Which is unsupported right now sorry!"; # sudo yum install -y stow; From 16545b322ff262786aec007726b8ea37299268f1 Mon Sep 17 00:00:00 2001 From: "Andrew R. M" Date: Mon, 15 Apr 2024 14:48:22 +0000 Subject: [PATCH 2/4] Attempt to fix recursive cloning for submodules --- install.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 15c7aae..978a71c 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,11 @@ #!/usr/bin/env bash +# Install my dotfiles on a variety of systems -echo "CURRENT LOCATION: $PWD" +set -ex + +echo "PWD: $PWD" +# Coder dotfiles (and most other ways of doing this) will not do a recursive clone, so do that in install script. +git submodule init && git submodule update echo "Installing dotfiles..." if [ -f /etc/os-release ]; then @@ -28,6 +33,6 @@ else fi # Apply the dotfiles with stow -echo "RUNNING APPLY DOTFILES" +echo "Running apply dotfiles" ./apply-dotfiles -echo "RAN APPLY DOTFILES" +echo "Dotfiles applied successfully" From bc00f7a310a923392911579d46832617796d94a8 Mon Sep 17 00:00:00 2001 From: "Andrew R. M" Date: Mon, 15 Apr 2024 16:43:28 +0000 Subject: [PATCH 3/4] Option select on tput working or use old fallback control codes --- bash/.bashrc | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/bash/.bashrc b/bash/.bashrc index 7497f46..677f67a 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -2,13 +2,23 @@ #{- PROMPT -}# -red="\001$(tput bold)$(tput setaf 1)\002" -green="\001$(tput bold)$(tput setaf 2)\002" -yellow="\001$(tput bold)$(tput setaf 3)\002" -blue="\001$(tput bold)$(tput setaf 4)\002" -magenta="\001$(tput bold)$(tput setaf 5)\002" -cyan="\001$(tput bold)$(tput setaf 6)\002" -no_color="\001$(tput sgr0)\002" +if which tput &> /dev/null && tput bold &> /dev/null; then + red="\001$(tput bold)$(tput setaf 1)\002" + green="\001$(tput bold)$(tput setaf 2)\002" + yellow="\001$(tput bold)$(tput setaf 3)\002" + blue="\001$(tput bold)$(tput setaf 4)\002" + magenta="\001$(tput bold)$(tput setaf 5)\002" + cyan="\001$(tput bold)$(tput setaf 6)\002" + no_color="\001$(tput sgr0)\002" +else + red="\[\033[1;31m\]" + green="\[\033[1;32m\]" + yellow="\[\033[1;33m\]" + blue="\[\033[1;34m\]" + magenta="\[\033[1;35m\]" + cyan="\[\033[1;36m\]" + no_color="\[\033[0m\]" +fi export PS1="${green}\$${no_color} " From 51b8138cf3bce418ea153b074ef12a3cc156e2d8 Mon Sep 17 00:00:00 2001 From: "Andrew R. M." Date: Mon, 3 Jun 2024 16:31:27 -0400 Subject: [PATCH 4/4] Update regex to match new direnv versions --- bash/.bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash/.bashrc b/bash/.bashrc index ddabf3b..04331fc 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -31,7 +31,7 @@ export ORIG_PS1=${PS1} if which direnv &> /dev/null; then update_prompt() { - if direnv status | grep -iq 'RC allowed true'; then + if direnv status | grep -iEq 'RC allowed (true|0)'; then PS1=${DIRENV_PS1} else PS1=${ORIG_PS1}