From 0ad3918fd600b62c03fc696c1b9f154bceff8ed1 Mon Sep 17 00:00:00 2001 From: Eduardo Cueto-Mendoza Date: Wed, 22 Jan 2025 19:01:38 +0000 Subject: [PATCH] Back to zsh and tmux --- .config/alacritty/alacritty.toml | 2 +- .config/alacritty/themes/tokyo_night.toml | 29 +++ .../themes/tokyo_night_enhanced.toml | 30 +++ .../alacritty/themes/tokyo_night_storm.toml | 29 +++ .config/alacritty/themes/xterm.toml | 28 +++ .../lua/user/plugins/29_tmux-navigator.lua | 18 ++ .gnupg/gpg-agent.conf | 2 +- .stow-local-ignore | 2 +- .zshrc | 232 ++++++++++++++++++ 9 files changed, 369 insertions(+), 3 deletions(-) create mode 100644 .config/alacritty/themes/tokyo_night.toml create mode 100644 .config/alacritty/themes/tokyo_night_enhanced.toml create mode 100644 .config/alacritty/themes/tokyo_night_storm.toml create mode 100644 .config/alacritty/themes/xterm.toml create mode 100644 .config/nvim/lua/user/plugins/29_tmux-navigator.lua create mode 100644 .zshrc diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml index 2d4f30b..213b037 100755 --- a/.config/alacritty/alacritty.toml +++ b/.config/alacritty/alacritty.toml @@ -2,7 +2,7 @@ live_config_reload = true import = [ - "~/.config/alacritty/themes/Homebrew.toml" + "~/.config/alacritty/themes/tokyo_night_enhanced.toml" ] [cursor.style] diff --git a/.config/alacritty/themes/tokyo_night.toml b/.config/alacritty/themes/tokyo_night.toml new file mode 100644 index 0000000..0642a90 --- /dev/null +++ b/.config/alacritty/themes/tokyo_night.toml @@ -0,0 +1,29 @@ +# Colors (Tokyo Night) +# Source https//github.com/zatchheems/tokyo-night-alacritty-theme + +# Default colors +[colors.primary] +background = '#1a1b26' +foreground = '#a9b1d6' + +# Normal colors +[colors.normal] +black = '#32344a' +red = '#f7768e' +green = '#9ece6a' +yellow = '#e0af68' +blue = '#7aa2f7' +magenta = '#ad8ee6' +cyan = '#449dab' +white = '#787c99' + +# Bright colors +[colors.bright] +black = '#444b6a' +red = '#ff7a93' +green = '#b9f27c' +yellow = '#ff9e64' +blue = '#7da6ff' +magenta = '#bb9af7' +cyan = '#0db9d7' +white = '#acb0d0' diff --git a/.config/alacritty/themes/tokyo_night_enhanced.toml b/.config/alacritty/themes/tokyo_night_enhanced.toml new file mode 100644 index 0000000..90ba82b --- /dev/null +++ b/.config/alacritty/themes/tokyo_night_enhanced.toml @@ -0,0 +1,30 @@ +[colors.primary] +background = "#08080b" +foreground = "#787c99" + +[colors.cursor] +cursor = "#787c99" + +[colors.selection] +text = "CellForeground" +background = "#515c7e" + +[colors.normal] +black = "#363b54" +red = "#f7768e" +green = "#41a6b5" +yellow = "#e0af68" +blue = "#7aa2f7" +magenta = "#bb9af7" +cyan = "#7dcfff" +white = "#787c99" + +[colors.bright] +black = "#363b54" +red = "#f7768e" +green = "#41a6b5" +yellow = "#e0af68" +blue = "#7aa2f7" +magenta = "#bb9af7" +cyan = "#7dcfff" +white = "#787c99" diff --git a/.config/alacritty/themes/tokyo_night_storm.toml b/.config/alacritty/themes/tokyo_night_storm.toml new file mode 100644 index 0000000..992f1d3 --- /dev/null +++ b/.config/alacritty/themes/tokyo_night_storm.toml @@ -0,0 +1,29 @@ +# Colors (Tokyo Night Storm variant) +# Source https//github.com/zatchheems/tokyo-night-alacritty-theme + +# Default colors +[colors.primary] +background = '#24283b' +foreground = '#a9b1d6' + +# Normal colors +[colors.normal] +black = '#32344a' +red = '#f7768e' +green = '#9ece6a' +yellow = '#e0af68' +blue = '#7aa2f7' +magenta = '#ad8ee6' +cyan = '#449dab' +white = '#9699a8' + +# Bright colors +[colors.bright] +black = '#444b6a' +red = '#ff7a93' +green = '#b9f27c' +yellow = '#ff9e64' +blue = '#7da6ff' +magenta = '#bb9af7' +cyan = '#0db9d7' +white = '#acb0d0' diff --git a/.config/alacritty/themes/xterm.toml b/.config/alacritty/themes/xterm.toml new file mode 100644 index 0000000..47fd62c --- /dev/null +++ b/.config/alacritty/themes/xterm.toml @@ -0,0 +1,28 @@ +# XTerm's default colors + +# Default colors +[colors.primary] +background = '#000000' +foreground = '#ffffff' + +# Normal colors +[colors.normal] +black = '#000000' +red = '#cd0000' +green = '#00cd00' +yellow = '#cdcd00' +blue = '#0000ee' +magenta = '#cd00cd' +cyan = '#00cdcd' +white = '#e5e5e5' + +# Bright colors +[colors.bright] +black = '#7f7f7f' +red = '#ff0000' +green = '#00ff00' +yellow = '#ffff00' +blue = '#5c5cff' +magenta = '#ff00ff' +cyan = '#00ffff' +white = '#ffffff' diff --git a/.config/nvim/lua/user/plugins/29_tmux-navigator.lua b/.config/nvim/lua/user/plugins/29_tmux-navigator.lua new file mode 100644 index 0000000..cee53d3 --- /dev/null +++ b/.config/nvim/lua/user/plugins/29_tmux-navigator.lua @@ -0,0 +1,18 @@ +return { + "christoomey/vim-tmux-navigator", + cmd = { + "TmuxNavigateLeft", + "TmuxNavigateDown", + "TmuxNavigateUp", + "TmuxNavigateRight", + "TmuxNavigatePrevious", + "TmuxNavigatorProcessList", + }, + keys = { + { "", "TmuxNavigateLeft" }, + { "", "TmuxNavigateDown" }, + { "", "TmuxNavigateUp" }, + { "", "TmuxNavigateRight" }, + { "", "TmuxNavigatePrevious" }, + }, +} diff --git a/.gnupg/gpg-agent.conf b/.gnupg/gpg-agent.conf index 549e052..511c800 100644 --- a/.gnupg/gpg-agent.conf +++ b/.gnupg/gpg-agent.conf @@ -6,7 +6,7 @@ #pinentry-program /usr/local/bin/pinentry-curses #pinentry-program /usr/local/bin/pinentry-mac #pinentry-program /opt/homebrew/bin/pinentry-mac -pinentry-program /usr/bin/pinentry-curses +pinentry-program /opt/homebrew/bin/pinentry-mac enable-ssh-support ttyname $GPG_TTY default-cache-ttl 60 diff --git a/.stow-local-ignore b/.stow-local-ignore index 8cbbf3f..ab163b9 100755 --- a/.stow-local-ignore +++ b/.stow-local-ignore @@ -9,5 +9,5 @@ \.gnupg/reader_0.status \.ssh/known_hosts* \.ssh/authorized_keys +LICENCE README.md -LICENSE diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..f922772 --- /dev/null +++ b/.zshrc @@ -0,0 +1,232 @@ +# Setup zinit home and startup +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" +[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)" +[ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" + +# source zinit +source "${ZINIT_HOME}/zinit.zsh" + +# Add in zsh plugins +zinit light zsh-users/zsh-syntax-highlighting +zinit light zsh-users/zsh-completions +zinit light zsh-users/zsh-autosuggestions +#zinit light Aloxaf/fzf-tab +zinit light junegunn/fzf-git.sh + +# Load completions +autoload -U compinit && compinit + +# My configurations +# Colors +autoload -U colors && colors + +# Prompt +PROMPT="%(!.%F{red}%n.%F{green}%n)%{$reset_color%}@%F{magenta}%m %F{blue}%(5~|%-2~/…/%2~|%4~) %(?.%F{green}.%F{red})%(?..[%?] )%{$reset_color%}%(!.%F{red}%#.%F{green}%#)%{$reset_color%} " + +# keybindings +bindkey -v +bindkey "^p" history-search-backward +bindkey "^n" history-search-forward +bindkey -r "^G^B" fzf-git-branches-widget +bindkey -r "^G^E" fzf-git-each_ref-widget +bindkey -r "^G^F" fzf-git-files-widget +bindkey -r "^G^H" fzf-git-hashes-widget +bindkey -r "^G^L" fzf-git-lreflogs-widget +bindkey -r "^G^R" fzf-git-remotes-widget +bindkey -r "^G^S" fzf-git-stashes-widget +bindkey -r "^G^T" fzf-git-tags-widget +bindkey -r "^G^W" fzf-git-worktrees-widget +bindkey -r "^Gb" fzf-git-branches-widget +bindkey -r "^Ge" fzf-git-each_ref-widget +bindkey -r "^Gf" fzf-git-files-widget +bindkey -r "^Gh" fzf-git-hashes-widget +bindkey -r "^Gl" fzf-git-lreflogs-widget +bindkey -r "^Gr" fzf-git-remotes-widget +bindkey -r "^Gs" fzf-git-stashes-widget +bindkey -r "^Gt" fzf-git-tags-widget +bindkey "^[w" fzf-git-worktrees-widget +bindkey "^[b" fzf-git-branches-widget +bindkey "^[e" fzf-git-each_ref-widget +bindkey "^[f" fzf-git-files-widget +bindkey "^[h" fzf-git-hashes-widget +bindkey "^[l" fzf-git-lreflogs-widget +bindkey "^[r" fzf-git-remotes-widget +bindkey "^[s" fzf-git-stashes-widget +bindkey "^[t" fzf-git-tags-widget +bindkey "^[w" fzf-git-worktrees-widget + + +# History +HISTSIZE=5000 +HISTFILE=~/.zsh_history +SAVEHIST=$HISTSIZE +HISTDUP=erase +setopt appendhistory +setopt sharehistory +setopt hist_ignore_space +setopt hist_ignore_all_dups +setopt hist_save_no_dups +setopt hist_ignore_dups +setopt hist_find_no_dups + +# Copmletion styling +zstyle ":completion:*" matcher-list "m:{a-z}={A-Za-z}" +zstyle ":completion:*" list-colors "${(s.:.)LS_COLORS}" +## disable sort when completing `git checkout` +#zstyle ":completion:*:git-checkout:*" sort false +## set descriptions format to enable group support +## NOTE: don"t use escape sequences (like "%F{red}%d%f") here, fzf-tab will ignore them +#zstyle ":completion:*:descriptions" format "[%d]" +## set list-colors to enable filename colorizing +#zstyle ":completion:*" list-colors ${(s.:.)LS_COLORS} +## force zsh not to show completion menu, which allows fzf-tab to capture the unambiguous prefix +#zstyle ":completion:*" menu no +## preview directory"s content with eza when completing cd +#zstyle ":fzf-tab:complete:cd:*" fzf-preview "eza -1 --color=always $realpath" +## custom fzf flags +## NOTE: fzf-tab does not follow FZF_DEFAULT_OPTS by default +#zstyle ":fzf-tab:*" fzf-flags --color=fg:1,fg+:2 --bind=tab:accept +## To make fzf-tab follow FZF_DEFAULT_OPTS. +## NOTE: This may lead to unexpected behavior since some flags break this plugin. See Aloxaf/fzf-tab#455. +#zstyle ":fzf-tab:*" use-fzf-default-opts yes +## switch group using `<` and `>` +#zstyle ":fzf-tab:*" switch-group "<" ">" +#zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup + +# Start tmux +ID=$(id -u) +if [[ "$TMUX" = "" && $ID != 0 ]]; then + /opt/homebrew/bin/tmux +fi + +# PATH +# Homebrew +export PATH="/opt/homebrew/bin:$PATH" +export PATH="/opt/homebrew/sbin:$PATH" + +# Local PATH +export PATH=$PATH:$HOME/.local/bin + +# Mason PATH +export PATH=$PATH:$HOME/.local/share/nvim/mason/bin + +# Java +export PATH="$PATH:/opt/homebrew/Cellar/openjdk/23.0.1/bin" + +# Ruby +#export PATH=$PATH:/opt/homebrew/opt/ruby/bin +#export PATH=$PATH:/opt/homebrew/lib/ruby/gems/3.4.0/bin + +# Zig +export PATH=$PATH:/opt/zig + +# pyenv +export PYENV_ROOT="$HOME/.pyenv" +[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" +eval "$(pyenv init - zsh)" +eval "$(pyenv virtualenv-init -)" + + +# VARIABLES +if [ $ID != 0 ]; then + # ssh and gpg + export GPG_TTY=$(tty) + export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + gpgconf --launch gpg-agent + gpg-connect-agent updatestartuptty /bye > /dev/null +fi + +# bat +export BAT_THEME='tokyonight_night' + +# Editor +export EDITOR='nvim' + +# Manpager +#export PAGER='nvim +Man!' + +# fzf +export FZF_CTRL_T_OPTS="--preview 'bat -n --color=always --line-range :500 {}'" +export FZF_ALT_C_OPTS="--preview 'eza --tree --color=always {} | head 200'" + +# Term for ssh +#export TERM="xterm-256color" + +# Homebrew +export HOMEBREW_NO_AUTO_UPDATE=1 +export HOMEBREW_NO_ENV_HINTS=1 + +# DBUS for zathura +#export DBUS_LAUNCHD_SESSION_BUS_SOCKET=/tmp/(id -u) +#export DBUS_SESSION_BUS_ADDRESS='unix:path='$DBUS_LAUNCHD_SESSION_BUS_SOCKET +#if pgrep -x dbus-daemon &> /dev/null +# printf (_ "%sdbus-daemon%s is running\n") (set_color red) (set_color normal) +#else +# #echo "dbus-daemon is not running" +# dbus-daemon --fork --session --address=$DBUS_SESSION_BUS_ADDRESS +#end + +# fzf +export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git" +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" +export FZF_DEFAULT_COMMAND="fd --type=d --hidden --strip-cwd-prefix --exclude .git" +export FZF_CTRL_T_OPTS="--preview 'bat -n --color=always --line-range :500 {}'" +export FZF_ALT_C_OPTS="--preview 'eza --tree --color=always {} | head -200'" + +_fzf_compgen_path() { + fd --hidden --exclude .git . "$1" +} + +_fzf_compgen_dir() { + fd --type=d --hidden --exclude .git . "$1" +} + +_fzf_comprun() { + local command=$1 + shift + case "$command" in + cd) fzf --preview "eza --tree --color=always {} | head -200" "$@" ;; + export|unset) fzf --preview "eval 'echo \$' {}" "$@" ;; + ssh) fzf --preview "dig {}" "$@" ;; + *) fzf --preview "bat -n --color=always --line-range :500 {}" "$@" ;; + esac +} + +# ALIAS +# convinience +alias doas="sudo" + +# Neovim +alias vi="nvim" +alias vim="nvim" + +# cat +alias cat="bat" + +# ls +alias ls="eza --color=always --long --git --icons=always --group" + +# cd +alias cd="z" + +# mutt +#alias mutt='neomutt' + +# rsync +alias rsync="rsync -h -v -r -P -p -t --stats" + +# wget folder +alias wget_f="wget -r -np -R 'index.html*'" + +# btop +alias top="btop" + +# Shell integrations +# The fuck +eval $(thefuck --alias) + +#zoxide +eval "$(zoxide init zsh)" + +# fzf +eval "$(fzf --zsh)"