diff --git a/tmux/.tmux.conf.local b/tmux/.tmux.conf.local index 0dcf3dd..9b3dc0b 100644 --- a/tmux/.tmux.conf.local +++ b/tmux/.tmux.conf.local @@ -434,7 +434,7 @@ tmux_conf_urlscan_options="--compact --dedupe" # this is the place to override or undo settings # increase history size -#set -g history-limit 10000 +#set -g history-limit 999999 # start with mouse mode enabled #set -g mouse on diff --git a/zsh/.aliases b/zsh/.aliases index d96f640..550b130 100644 --- a/zsh/.aliases +++ b/zsh/.aliases @@ -18,6 +18,15 @@ yt() { fabric -y "$video_link" $transcript_flag } +for pattern_file in $HOME/.config/fabric/patterns/*; do + # Get the base name of the file (i.e., remove the directory path) + pattern_name=$(basename "$pattern_file") + # Create an alias in the form: alias pattern_name="fabric --pattern pattern_name" + alias_command="alias $pattern_name='fabric --pattern $pattern_name'" + # Evaluate the alias command to add it to the current shell + eval "$alias_command" +done + # TMUX-RECON Aliases # ---------------------------- @@ -52,6 +61,7 @@ alias k='kill $(ps aux | fzf | awk '\''{print $2}'\'')' # alias k9='kill -9 **' alias nf='fzf -m --preview="bat --color=always --style=numbers --line-range:300 {}" --bind "enter:become(hx {+})"' alias p='parallel' +alias rm='rm -I' if [[ -n "$ZSH_VERSION" ]]; then alias s='source ~/.zshrc; source ~/.aliases' @@ -90,7 +100,7 @@ function take { alias batclip='bat $1 | xclip' alias du='dust' -alias df='duf' +alias dfh='gdu -dn' alias dl='yt-dlp -f best $1' if [[ -n "$ZSH_VERSION" ]]; then @@ -229,7 +239,13 @@ alias serve='python3 -m http.server 80' alias xh='xh --style auto' alias myip='curl ifconfig.me' alias localip="ip a | grep inet" -alias ping='gping' + +if command -v mtr &> /dev/null; then + alias ping='mtr' +else + unalias ping +fi + alias net='bandwhich' alias sniff='sudo tcpdump -i any -n' alias ports='ss -tuln' @@ -246,3 +262,11 @@ alias gco='git checkout' alias ga='git add' alias gst='git rev-parse --git-dir > /dev/null 2>&1 && git status || eza' + +copy-line() { + rg --line-number . | fzf --delimiter ':' --preview 'bat --color=always --highlight-line {2} {1}' | awk -F ':' '{print "+"$2" "$1}' +} + +open-at-line() { + hx $(rg --line-number . | fzf --delimiter ':' --preview 'bat --color=always --highlight-line {2} {1}' | awk -F ':' '{print "+"$2" "$1}') +} diff --git a/zsh/.exports b/zsh/.exports index 14ba888..0c5b24c 100644 --- a/zsh/.exports +++ b/zsh/.exports @@ -6,6 +6,30 @@ export LANG=en_US.UTF-8 # avoid locale issues export LC_ALL=en_US.UTF-8 export GOROOT="/usr/local/go" export GOPATH="$HOME/go" +export PATH=$PATH:$GOROOT/bin + +# --- fzf --- +# export FZF_DEFAULT_COMMAND='find . -type f' \ +# fzf --bind 'ctrl-d:reload(find . -type d),ctrl-f:reload(eval "$FZF_DEFAULT_COMMAND")' \ +# --height=50% --layout=reverse + +# Preview file content using bat (https://github.com/sharkdp/bat) +# export FZF_CTRL_T_OPTS=" +# --walker-skip .git,node_modules,target +# --preview 'bat -n --color=always {}' +# --bind 'ctrl-/:change-preview-window(down|hidden|)'" + +# CTRL-Y to copy the command into clipboard using pbcopy +# export FZF_CTRL_R_OPTS=" +# --bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort' +# --color header:italic +# --header 'Press CTRL-Y to copy command into clipboard'" + +# Print tree structure in the preview window +# export FZF_ALT_C_OPTS=" +# --walker-skip .git,node_modules,target +# --preview 'tree -C {}'" + # Path export PATH="$PATH:$HOME/go/bin" @@ -13,11 +37,12 @@ export PATH="$PATH:$HOME/.scripts" export PATH="$PATH:$HOME/.cargo/bin" export PATH="$PATH:$GOPATH/bin:$GOROOT/bin" export PATH="$PATH:/usr/local/go/bin" +export PATH="$PATH:/go/bin" export PATH="$PATH:$HOME/.local/bin" #export PATH="$PATH:$HOME/miniconda3/bin" # clean path: -# export PATH=$(echo "$PATH" | tr ':' '\n' | awk '!seen[$0]++' | paste -sd:) +export PATH=$(echo "$PATH" | tr ':' '\n' | awk '!seen[$0]++' | paste -sd:) # PY3="python3 -c 'import pty;pty.spawn(\"bin/bash\")'" # SHELLEXPORTS="export TERM=xterm;stty rows $(tput lines) columns $(tput cols)" diff --git a/zsh/.zshrc b/zsh/.zshrc index 05153d2..4a02405 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -5,56 +5,61 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi -if [[ -f "/opt/homebrew/bin/brew" ]] then +if [[ -f "/opt/homebrew/bin/brew" ]]; then # If you're using macOS, you'll want this enabled eval "$(/opt/homebrew/bin/brew shellenv)" fi -# Set the directory we want to store zinit and plugins +# Kill conflicting alias if it exists +unalias z 2>/dev/null unalias zi 2>/dev/null -ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" -# Download Zinit, if it's not there yet -if [ ! -d "$ZINIT_HOME" ]; then - mkdir -p "$(dirname $ZINIT_HOME)" - git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" +# Clone zcomet if necessary +if [[ ! -f ${ZDOTDIR:-${HOME}}/.zcomet/bin/zcomet.zsh ]]; then + command git clone https://github.com/agkozak/zcomet.git ${ZDOTDIR:-${HOME}}/.zcomet/bin fi -# Source/Load zinit -source "${ZINIT_HOME}/zinit.zsh" +source ${ZDOTDIR:-${HOME}}/.zcomet/bin/zcomet.zsh -# Add in Powerlevel10k -zinit ice depth=1; zinit light romkatv/powerlevel10k +# Load a code snippet - no need to download an entire repository +zcomet snippet https://github.com/jreese/zsh-titles/blob/master/titles.plugin.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 - -# Add in snippets -zinit snippet OMZL::git.zsh -zinit snippet OMZP::git -zinit snippet OMZP::sudo -zinit snippet OMZP::archlinux -zinit snippet OMZP::aws -zinit snippet OMZP::kubectl -zinit snippet OMZP::kubectx -zinit snippet OMZP::command-not-found +# Lazy-load Prezto's archive module without downloading all of Prezto's +# submodules +zcomet trigger --no-submodules archive unarchive lsarchive \ + sorin-ionescu/prezto modules/archive +# Run compinit and compile its cache +zcomet compinit # Load completions -autoload -Uz compinit && compinit +# autoload -Uz compinit && compinit -zinit cdreplay -q +# Themes and UI +zcomet load romkatv/powerlevel10k -# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. -[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh +# Completions and plugins +zcomet load zsh-users/zsh-syntax-highlighting +zcomet load zsh-users/zsh-completions +zcomet load zsh-users/zsh-autosuggestions +zcomet load Aloxaf/fzf-tab + +# Oh My Zsh snippets +# zcomet load ohmyzsh/ohmyzsh lib/git.zsh +# zcomet load ohmyzsh/ohmyzsh plugins/git +# zcomet load ohmyzsh/ohmyzsh plugins/sudo +# zcomet load ohmyzsh/ohmyzsh plugins/archlinux +# zcomet load ohmyzsh/ohmyzsh plugins/aws +# zcomet load ohmyzsh/ohmyzsh plugins/kubectl +# zcomet load ohmyzsh/ohmyzsh plugins/kubectx +# zcomet load ohmyzsh/ohmyzsh plugins/command-not-found # Keybindings bindkey -e bindkey '^p' history-search-backward bindkey '^n' history-search-forward bindkey '^[w' kill-region +bindkey "^[[1;5C" forward-word # Ctrl+Right +bindkey "^[[1;5D" backward-word # Ctrl+Left # History HISTSIZE=99999 @@ -62,7 +67,7 @@ HISTFILE=~/.zsh_history SAVEHIST=$HISTSIZE HISTDUP=erase setopt appendhistory -setopt sharehistory +# setopt sharehistory setopt hist_ignore_space setopt hist_ignore_all_dups setopt hist_save_no_dups @@ -76,11 +81,6 @@ zstyle ':completion:*' menu no zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath' zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath' -# Aliases -alias ls='ls --color' -alias vim='nvim' -alias c='clear' - # Shell integrations # eval "$(fzf --zsh)" [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh @@ -91,24 +91,7 @@ source $HOME/.cargo/env [ -f ~/.aliases ] && source ~/.aliases [ -f ~/.exports ] && source ~/.exports [ -f ~/.p10k.zsh ] && source ~/.p10k.zsh -# unalias zi - -# Fix Ctrl+Arrow Keys in zsh -bindkey "^[[1;5C" forward-word # Ctrl+Right -bindkey "^[[1;5D" backward-word # Ctrl+Left - -# for pattern_file in $HOME/.config/fabric/patterns/*; do -# # Get the base name of the file (i.e., remove the directory path) -# pattern_name=$(basename "$pattern_file") - -# # Create an alias in the form: alias pattern_name="fabric --pattern pattern_name" -# alias_command="alias $pattern_name='fabric --pattern $pattern_name'" - -# # Evaluate the alias command to add it to the current shell -# eval "$alias_command" -# done - -source ~/.zshenv +source /usr/share/doc/pkgfile/command-not-found.zsh # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! @@ -125,3 +108,7 @@ fi unset __conda_setup # <<< conda initialize <<< + +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion