Update shell configuration to consider macOS and Linux
This commit is contained in:
77
shell-common/profile.common
Normal file
77
shell-common/profile.common
Normal file
@@ -0,0 +1,77 @@
|
||||
#!/bin/sh
|
||||
# Common profile settings for all shells
|
||||
# This file is sourced by both bash and zsh
|
||||
|
||||
# Detect operating system
|
||||
case "$(uname -s)" in
|
||||
Darwin)
|
||||
OS="macos"
|
||||
# Homebrew on macOS (Apple Silicon and Intel)
|
||||
if [ -d "/opt/homebrew" ]; then
|
||||
export HOMEBREW_PREFIX="/opt/homebrew"
|
||||
elif [ -d "/usr/local/Homebrew" ]; then
|
||||
export HOMEBREW_PREFIX="/usr/local"
|
||||
fi
|
||||
|
||||
if [ -n "$HOMEBREW_PREFIX" ]; then
|
||||
export PATH="$HOMEBREW_PREFIX/bin:$PATH"
|
||||
export PATH="$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$PATH"
|
||||
export PATH="$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/lib/ruby/gems/3.4.0/bin:$PATH"
|
||||
fi
|
||||
;;
|
||||
Linux)
|
||||
OS="linux"
|
||||
# Homebrew on Linux
|
||||
if [ -d "/home/linuxbrew/.linuxbrew" ]; then
|
||||
export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew"
|
||||
export PATH="$HOMEBREW_PREFIX/bin:$PATH"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
OS="unknown"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Export OS for use in other scripts
|
||||
export OS
|
||||
|
||||
# Go path
|
||||
export GOPATH=$HOME/go
|
||||
export PATH="$GOPATH/bin:$PATH"
|
||||
|
||||
# User local paths (common for all systems)
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
export PATH="$HOME/.emacs.d/bin:$PATH"
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
|
||||
# API keys (consider moving to a separate, untracked file)
|
||||
export PERPLEXITY_API_KEY="your-api-key"
|
||||
|
||||
# FZF configuration (common for all shells that support it)
|
||||
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
|
||||
export FZF_DEFAULT_OPTS='
|
||||
--height 40%
|
||||
--layout=reverse
|
||||
--border
|
||||
--preview "bat --color=always --style=numbers --line-range=:500 {}"
|
||||
--preview-window=right:60%:wrap
|
||||
--bind "ctrl-/:toggle-preview"
|
||||
--bind "ctrl-y:execute-silent(echo {} | pbcopy)"
|
||||
'
|
||||
|
||||
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
||||
export FZF_CTRL_T_OPTS="
|
||||
--preview 'bat --color=always --style=numbers --line-range=:500 {}'
|
||||
--preview-window=right:60%:wrap
|
||||
"
|
||||
|
||||
export FZF_ALT_C_COMMAND='fd --type d --hidden --follow --exclude .git'
|
||||
export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"
|
||||
|
||||
export FZF_CTRL_R_OPTS="
|
||||
--preview 'echo {}'
|
||||
--preview-window=down:3:wrap
|
||||
--bind 'ctrl-y:execute-silent(echo {} | pbcopy)'
|
||||
"
|
||||
|
||||
export FZF_TMUX_OPTS='-p80%,60%'
|
||||
Reference in New Issue
Block a user