diff --git a/fish/.config/fish/config.fish.symlink b/fish/.config/fish/config.fish.symlink new file mode 100644 index 0000000..89b00a1 --- /dev/null +++ b/fish/.config/fish/config.fish.symlink @@ -0,0 +1,45 @@ +#!/usr/bin/env fish + +# Remove that annoying 'last logged in' message. +# Tested this method vs in iTerm settings - latter is less portable and slower. +printf '\33c\e[3J' + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +# Base path. +fish_add_path "$HOME/dotfiles/bin" "/usr/local/bin" "$HOME/bin" + +# Dotfiles root dir. +set -gx DOT "$HOME/dotfiles" + +# Projects dir. +set -gx HACK "$HOME/hackin" + +# Local environment variables. +if [ -e "$HOME/.local.env" ] + source "~/.local.env" +end + +# All fish dotfiles. +set config_files $DOT/**/*.fish + +# Load path files first. +for file in (string match -r '^.*\/path.fish$' $config_files) + source $file +end + +# Load everything else, except completion. +for file in (string match -v -r '^.*\/(path|completion)\.fish$' $config_files) + source $file +end + +# Load completions functions. +for file in (string match -r '^.*\/completion.fish$' $config_files) + source $file +end + +set -e config_files + +# Starship +set -gx STARSHIP_CONFIG "$DOT/zsh/starship.toml" +starship init fish | source diff --git a/fish/.config/fish/functions/fuck.fish.symlink b/fish/.config/fish/functions/fuck.fish.symlink new file mode 100644 index 0000000..047da80 --- /dev/null +++ b/fish/.config/fish/functions/fuck.fish.symlink @@ -0,0 +1,12 @@ +#!/usr/bin/env fish + +function fuck -d "Correct your previous console command" + set -l fucked_up_command $history[1] + env TF_SHELL=fish TF_ALIAS=fuck PYTHONIOENCODING=utf-8 thefuck $fucked_up_command THEFUCK_ARGUMENT_PLACEHOLDER $argv | read -l unfucked_command + if [ "$unfucked_command" != "" ] + eval $unfucked_command + builtin history delete --exact --case-sensitive -- $fucked_up_command + builtin history merge + end +end + diff --git a/fish/install.sh b/fish/install.sh new file mode 100755 index 0000000..7597128 --- /dev/null +++ b/fish/install.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# vim:set ft=bash: + +cd "$(dirname "${BASH_SOURCE[0]}")" \ + && source "../homebrew/brew_utils.sh" \ + && source "../script/utils.sh" + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +brew_install "Fish Shell" "fish" + +fish_path="$(which fish)" + +if ! grep "$fish_path" < /etc/shells &> /dev/null; then + execute \ + "printf '%s\n' '$fish_path' | sudo tee -a /etc/shells" \ + "Add '$fish_path' to '/etc/shells'" +fi + +chsh -s "$fish_path" &> /dev/null +print_result $? "Make OS use Fish as the default shell" + +execute \ + "curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher" \ + "Fisher" diff --git a/javascript/install.sh b/javascript/install.sh index 7f0b5eb..279efa0 100755 --- a/javascript/install.sh +++ b/javascript/install.sh @@ -6,4 +6,4 @@ cd "$(dirname "${BASH_SOURCE[0]}")" \ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -npm_install "gulp-cli" "gulp CLI" +npm_install "gulp CLI" "gulp-cli" diff --git a/misc/install.sh b/misc/install.sh index 15473e9..875aa54 100755 --- a/misc/install.sh +++ b/misc/install.sh @@ -6,4 +6,4 @@ cd "$(dirname "${BASH_SOURCE[0]}")" \ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -npm_install "tldr" "tldr pages" +npm_install "tldr pages" "tldr" diff --git a/node/node_utils.sh b/node/node_utils.sh index eff57ff..3806ff3 100644 --- a/node/node_utils.sh +++ b/node/node_utils.sh @@ -8,5 +8,8 @@ cd "$(dirname "${BASH_SOURCE[0]}")" \ npm_install() { - execute ". $DOT/node/path.zsh && npm install --global --silent $1" "$2" + local -r MSG="$1" + local -r PKG="$2" + + execute ". $DOT/node/path.zsh && npm install --global --silent $PKG" "$MSG" } diff --git a/php/herd.fish b/php/herd.fish new file mode 100644 index 0000000..d046834 --- /dev/null +++ b/php/herd.fish @@ -0,0 +1,3 @@ +#!/usr/bin/env fish + +fish_add_path -U "$HOME/Library/Application Support/Herd/bin/"