Update Neovim setup and macOS kitty icon
This commit is contained in:
69
install.sh
69
install.sh
@@ -49,10 +49,23 @@ command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
require_command() {
|
||||
command_name=$1
|
||||
|
||||
if ! command_exists "$command_name"; then
|
||||
error "$command_name is required but not installed. Install it first via your package manager."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
error() {
|
||||
echo ${RED}"Error: $@"${RESET} >&2
|
||||
}
|
||||
|
||||
skip() {
|
||||
echo "${YELLOW}Skipping $1${RESET}"
|
||||
}
|
||||
|
||||
setup_color() {
|
||||
# Only use colors if connected to a terminal
|
||||
if [ -t 1 ]; then
|
||||
@@ -75,28 +88,36 @@ setup_color() {
|
||||
apply_dotfiles() {
|
||||
echo "${BLUE}Applying dotfiles...${RESET}"
|
||||
|
||||
if ! command_exists lsd; then
|
||||
error "lsd is required but not installed. Install it first via your package manager."
|
||||
exit 1
|
||||
fi
|
||||
if ! command_exists tmux; then
|
||||
error "tmux is required but not installed. Install it first via your package manager."
|
||||
exit 1
|
||||
fi
|
||||
require_command lsd
|
||||
require_command tmux
|
||||
require_command nvim
|
||||
require_command rg
|
||||
|
||||
remove_legacy_dotfile "$HOME/.vimrc"
|
||||
link_dotfile "$DOTFILES_DIR/.zshrc" "$HOME/.zshrc"
|
||||
link_dotfile "$DOTFILES_DIR/.vimrc" "$HOME/.vimrc"
|
||||
link_dotfile "$DOTFILES_DIR/.zprofile" "$HOME/.zprofile"
|
||||
link_dotfile "$DOTFILES_DIR/.gitconfig" "$HOME/.gitconfig"
|
||||
link_dotfile "$DOTFILES_DIR/.p10k.zsh" "$HOME/.p10k.zsh"
|
||||
mkdir -p "$HOME/.config"
|
||||
link_dotfile "$DOTFILES_DIR/kitty" "$HOME/.config/kitty"
|
||||
link_dotfile "$DOTFILES_DIR/nvim" "$HOME/.config/nvim"
|
||||
link_dotfile "$DOTFILES_DIR/tmux" "$HOME/.config/tmux"
|
||||
install_kitty_icon
|
||||
install_tmux_plugins
|
||||
install_powerlevel10k
|
||||
|
||||
echo
|
||||
}
|
||||
|
||||
remove_legacy_dotfile() {
|
||||
target_path=$1
|
||||
|
||||
if [ -L "$target_path" ] || [ -e "$target_path" ]; then
|
||||
echo "${YELLOW}Removing legacy $target_path${RESET}"
|
||||
rm -rf "$target_path"
|
||||
fi
|
||||
}
|
||||
|
||||
replace_dir() {
|
||||
source_path=$1
|
||||
target_path=$2
|
||||
@@ -128,6 +149,36 @@ link_dotfile() {
|
||||
echo "${GREEN}Linked $target_path -> $source_path${RESET}"
|
||||
}
|
||||
|
||||
install_kitty_icon() {
|
||||
icon_path="$DOTFILES_DIR/kitty/kitty.app.png"
|
||||
|
||||
if [ "$(uname -s)" != "Darwin" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if ! command_exists kitty; then
|
||||
skip "kitty icon setup: kitty is not installed."
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -d /Applications/kitty.app ]; then
|
||||
skip "kitty icon setup: /Applications/kitty.app was not found."
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$icon_path" ]; then
|
||||
skip "kitty icon setup: $icon_path was not found."
|
||||
return
|
||||
fi
|
||||
|
||||
echo "${BLUE}Applying custom kitty icon...${RESET}"
|
||||
|
||||
kitty +runpy 'from kitty.fast_data_types import cocoa_set_app_icon; import sys; cocoa_set_app_icon(*sys.argv[1:]); print("OK")' \
|
||||
"$icon_path" /Applications/kitty.app
|
||||
|
||||
echo
|
||||
}
|
||||
|
||||
install_tmux_plugins() {
|
||||
echo "${BLUE}Installing tmux plugins...${RESET}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user