diff --git a/.dotfiles.d/init/ensure-locale.sh b/.dotfiles.d/init/ensure-locale.sh new file mode 100644 index 0000000..13218a4 --- /dev/null +++ b/.dotfiles.d/init/ensure-locale.sh @@ -0,0 +1,42 @@ +#!/bin/env bash +# ensure-locale.sh +# Ensures a UTF-8 locale is available and exported (works safely on hosts and in containers). + +ensure_utf8_locale() { + # If already UTF-8, nothing to do + if locale | grep -qi 'utf-8'; then + return 0 + fi + + # If en_US.UTF-8 (or equivalent) exists, just use it + if locale -a 2>/dev/null | grep -qi 'en_US\.utf8'; then + export LANG=en_US.UTF-8 + export LC_ALL=en_US.UTF-8 + return 0 + fi + + # Try to generate one if possible (Debian/Ubuntu) + if command -v locale-gen >/dev/null 2>&1; then + echo "[ensure-locale] Generating en_US.UTF-8 locale..." + locale-gen en_US.UTF-8 2>/dev/null || true + # If update-locale exists, register it + command -v update-locale >/dev/null 2>&1 && update-locale LANG=en_US.UTF-8 || true + export LANG=en_US.UTF-8 + export LC_ALL=en_US.UTF-8 + return 0 + fi + + # Alpine / musl–based systems: locale-gen doesn't exist + if [ -f /usr/lib/locale/locale-archive ] || grep -q musl /proc/self/maps 2>/dev/null; then + export LANG=C.UTF-8 + export LC_ALL=C.UTF-8 + return 0 + fi + + # Fallback if nothing else works + export LANG=C.UTF-8 + export LC_ALL=C.UTF-8 +} + +# Call it immediately if script is sourced/run directly +ensure_utf8_locale diff --git a/.dotfiles.d/init/init-dotfiles.sh b/.dotfiles.d/init/init-dotfiles.sh index b06a0b7..f0f2f1c 100755 --- a/.dotfiles.d/init/init-dotfiles.sh +++ b/.dotfiles.d/init/init-dotfiles.sh @@ -1,4 +1,4 @@ -#/bin/env bash +#!/bin/env bash cd $HOME git clone --separate-git-dir=$HOME/.dotfiles.git http://git.nixlab.in/chodak166/dotfiles.git $HOME/dotfiles-tmp diff --git a/.dotfiles.d/init/init-shell.sh b/.dotfiles.d/init/init-shell.sh new file mode 100644 index 0000000..978acf5 --- /dev/null +++ b/.dotfiles.d/init/init-shell.sh @@ -0,0 +1,21 @@ +#!/bin/env bash + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" + +# ubuntu +sudo apt update -y +sudo apt install -y zsh eza unzip locales + +source "${SCRIPT_DIR}/ensure-locale.sh" + +cd ~ +git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf +./.fzf/install + +mkdir -p ~/.local/share/fonts +cd ~/.local/share/fonts + +fontName=DejaVuSansMono +curl -L -O 'https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/${fontName}.zip' +unzip ${fontName}.zip +rm ${fontName}.zip diff --git a/.zshenv b/.zshenv new file mode 100644 index 0000000..33cf15f --- /dev/null +++ b/.zshenv @@ -0,0 +1 @@ +skip_global_compinit=1 diff --git a/.zshrc b/.zshrc index ccc884a..85d2182 100644 --- a/.zshrc +++ b/.zshrc @@ -163,6 +163,18 @@ if [[ "$TERM" == screen* ]]; then PROMPT_COMMAND="screen_set_window_title; $PROMPT_COMMAND" fi +typeset -U path +local custom_paths=( + "$HOME/.cargo/bin" + "$HOME/.local/kitty.app/bin" + "$HOME/.local/bin" +) + +for d in "${custom_paths[@]}"; do + [[ -d "$d" ]] && path=("$d" "${path[@]}") +done + +export PATH alias bat=batcat alias ll='eza --icons=auto -T --level 2 -lah --group-directories-first --color=always | less' @@ -173,7 +185,10 @@ alias config='/usr/bin/git --git-dir=$HOME/.dotfiles.git/ --work-tree=$HOME' config config status.showUntrackedFiles no +export TERM=xterm-256color export VCPKG_ROOT=/opt/vcpkg -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh . "$HOME/.local/bin/env" 2>/dev/null + +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh +