Migrate .zshrc -> config.fish

This commit is contained in:
Marley Rae 2024-01-25 18:19:27 -08:00
parent c525a7dc9f
commit 9f5dda2dac
7 changed files with 91 additions and 3 deletions

View file

@ -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

View file

@ -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

25
fish/install.sh Executable file
View file

@ -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"

View file

@ -6,4 +6,4 @@ cd "$(dirname "${BASH_SOURCE[0]}")" \
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
npm_install "gulp-cli" "gulp CLI"
npm_install "gulp CLI" "gulp-cli"

View file

@ -6,4 +6,4 @@ cd "$(dirname "${BASH_SOURCE[0]}")" \
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
npm_install "tldr" "tldr pages"
npm_install "tldr pages" "tldr"

View file

@ -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"
}

3
php/herd.fish Normal file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env fish
fish_add_path -U "$HOME/Library/Application Support/Herd/bin/"