♻️ POSIX compliance; install git asap

This commit is contained in:
Marley Rae 2024-01-28 15:32:22 -08:00
parent 7aa9c81c7a
commit 1ede53da1d
9 changed files with 37 additions and 33 deletions

View file

@ -4,3 +4,4 @@ mar does dotfiles
## Sources
[oh-my-zsh git](https://kapeli.com/cheat_sheets/Oh-My-Zsh_Git.docset/Contents/Resources/Documents/index)
[git-prevision](https://gist.github.com/TheCodeArtist/a90978ebca0ff6743036)
[iTerm2 keymaps for tmux](https://web.archive.org/web/20230921160724/https://tangledhelix.com/blog/2012/04/28/iterm2-keymaps-for-tmux/)

View file

@ -31,7 +31,7 @@ for file in (string match -r '^.*\/path.fish$' $config_files)
end
# Load everything else, except completion.
for file in (string match -v -r '^.*\/(path|completion)\.fish$' $config_files)
for file in (string match -v -r '^.*\/(path|completion|install)\.fish$' $config_files)
source $file
end

View file

@ -1,7 +1,4 @@
# vim:set ft=toml sw=4 :
[alias]
prevision = nevermind =
# vim:set ft=gitconfig :
[color]
diff = always

6
git/install.fish Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env sh
. "$DOT/homebrew/brew_utils.sh"
brew_install "Github CLI" "gh"
brew_install "Gitmoji" "gitmoji"

View file

@ -1,9 +1,5 @@
#!/usr/bin/env bash
# vim:set ft=bash:
#!/usr/bin/env sh
cd "$(dirname "${BASH_SOURCE[0]}")" \
&& . "../homebrew/brew_utils.sh"
. "$DOT/homebrew/brew_utils.sh"
brew_install "Git" "git"
brew_install "Github CLI" "gh"
brew_install "Gitmoji" "gitmoji"

View file

@ -1,8 +1,6 @@
#!/usr/bin/env bash
# vim:set ft=bash:
#!/usr/bin/env sh
cd "$(dirname "${BASH_SOURCE[0]}")" \
&& . "../script/utils.sh"
. "$DOT/script/utils.sh"
################################################################################
# Install #
@ -10,10 +8,10 @@ cd "$(dirname "${BASH_SOURCE[0]}")" \
install()
{
if test ! $(which brew); then
if test ! "$(which brew)"; then
NONINTERACTIVE=1 \
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" \
&> /dev/null
>/dev/null 2>&1
print_result $? "Install"
fi
@ -25,18 +23,18 @@ install()
add_to_path()
{
if command -v brew &> /dev/null; then
if command -v brew >/dev/null 2>&1; then
return
fi
HARDWARE="$(uname -m)"
prefix=""
if [[ "$(uname)" == "Linux" ]]; then
if [ "$(uname)" = "Linux" ]; then
prefix="/home/linuxbrew/.linuxbrew"
elif [[ "$HARDWARE" == "arm64" ]]; then
elif [ "$HARDWARE" = "arm64" ]; then
prefix="/opt/homebrew"
elif [[ "$HARDWARE" == "x86_64" ]]; then
elif [ "$HARDWARE" = "x86_64" ]; then
prefix="/usr/local"
else
print_error "Homebrew is only supported on macOS Intel/ARM or Linux!"
@ -44,7 +42,7 @@ add_to_path()
PATH="$prefix/bin:$PATH"
command -v brew &> /dev/null
command -v brew >/dev/null 2>&1
print_result $? "Add to PATH"
}

View file

@ -1,13 +1,12 @@
#!/user/bin/env bash
#!/user/bin/env sh
cd "$(dirname "${BASH_SOURCE[0]}")" \
&& . "../script/utils.sh"
. "$DOT/script/utils.sh"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
brew_prefix()
{
local path=""
path=""
if path="$(brew --prefix 2>/dev/null)"; then
printf "%s" "$path"
@ -20,7 +19,7 @@ brew_prefix()
brew_tap()
{
brew tap "$1" &>/dev/null
brew tap "$1" >/dev/null 2>&1
}
brew_update()
@ -37,10 +36,10 @@ brew_upgrade()
brew_install()
{
declare -r FORMULA_READABLE_NAME="$1"
declare -r FORMULA="$2"
declare -r ARGUMENTS="$3"
declare -r TAP_VALUE="$4"
readonly FORMULA_READABLE_NAME="$1"
readonly FORMULA="$2"
readonly ARGUMENTS="$3"
readonly TAP_VALUE="$4"
# Check that Homebrew is installed.
@ -51,7 +50,7 @@ brew_install()
# If 'brew tap' needs to be executed, check if it executed correctly.
if [[ -n "$TAP_VALUE" ]]; then
if [ -n "$TAP_VALUE" ]; then
if ! brew_tap "$TAP_VALUE"; then
print_error "$FORMULA_READABLE_NAME ('brew tap $TAP_VALUE' failed)"
return 1
@ -61,7 +60,7 @@ brew_install()
# Install the specified formula.
# shellcheck disable=SC2086
if brew list "$FORMULA" &>/dev/null; then
if brew list "$FORMULA" >/dev/null 2>&1; then
print_success "$FORMULA_READABLE_NAME"
else
execute "brew install $FORMULA $ARGUMENTS" \

View file

@ -244,6 +244,8 @@ main()
"$DOT/homebrew/brew.sh"
"$DOT/git/install.sh"
"$DOT/fish/install.sh"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View file

@ -35,6 +35,11 @@ bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind-key J resize-pane -D
bind-key K resize-pane -U
bind-key H resize-pane -L
bind-key L resize-pane -R
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Install tpm if not already installed.