From cf6182f623058e4199b22a1dcec50d25e16815d4 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Tue, 16 Jan 2024 08:39:56 -0800 Subject: [PATCH] shell things --- .p10k.zsh | 4 +--- .profile | 3 +++ .zshrc | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 .profile diff --git a/.p10k.zsh b/.p10k.zsh index e705064..0bb7ff7 100644 --- a/.p10k.zsh +++ b/.p10k.zsh @@ -49,7 +49,7 @@ status # exit code of the last command command_execution_time # duration of the last command background_jobs # presence of background jobs - direnv # direnv status (https://direnv.net/) + # direnv # direnv status (https://direnv.net/) asdf # asdf version manager (https://github.com/asdf-vm/asdf) virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html) anaconda # conda environment (https://conda.io/) @@ -1375,8 +1375,6 @@ '*' OTHER) typeset -g POWERLEVEL9K_TERRAFORM_OTHER_FOREGROUND=38 # typeset -g POWERLEVEL9K_TERRAFORM_OTHER_VISUAL_IDENTIFIER_EXPANSION='⭐' - # Replace the content of terraform segment with an empty value. - typeset -g POWERLEVEL9K_TERRAFORM_CONTENT_EXPANSION= #############[ terraform_version: terraform version (https://www.terraform.io) ]############## # Terraform version color. diff --git a/.profile b/.profile new file mode 100644 index 0000000..cc12d25 --- /dev/null +++ b/.profile @@ -0,0 +1,3 @@ +if [[ $- == *"i"* ]]; then + exec zsh +fi diff --git a/.zshrc b/.zshrc index 7b6f572..1e6db48 100644 --- a/.zshrc +++ b/.zshrc @@ -72,8 +72,19 @@ path=(~/bin $path) # Export environment variables. export GPG_TTY=$TTY +export EDITOR=nvim +export VISUAL=nvim +export BAT_THEME=ashes +export FZF_DEFAULT_OPTS="--height 40% --layout=reverse --border" +export FZF_DEFAULT_COMMAND="fd --type f --strip-cwd-prefix --hidden --follow --exclude .git" +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" +export FZF_ALT_C_COMMAND="fd --type d --strip-cwd-prefix --hidden --follow --exclude .git" # Source additional local files if they exist. +if (( $+commands[fzf] )); then + [[ $- == *i* ]] && z4h source ${HOMEBREW_PREFIX:+$HOMEBREW_PREFIX/opt/fzf/shell/completion.zsh} +fi +z4h source ~/.dotfiles/src/fzf-git.sh/fzf-git.sh z4h source ~/.local.zsh # Use additional Git repositories pulled in with `z4h install`. @@ -91,6 +102,22 @@ z4h bindkey z4h-cd-forward Shift+Right # cd into the next directory z4h bindkey z4h-cd-up Shift+Up # cd into the parent directory z4h bindkey z4h-cd-down Shift+Down # cd into a child directory +z4h bindkey history-beginning-search-backward Ctrl+P +z4h bindkey history-beginning-search-forward Ctrl+N + +if (( $+commands[fzf] )); then + z4h source ${HOMEBREW_PREFIX:+$HOMEBREW_PREFIX/opt/fzf/shell/key-bindings.zsh} + + # Not sure how to do key sequences w/`z4h bindkey` + bindkey '^gg' fzf-git-branches-widget + + # ^gl doesn't work in tmux, but I need reflogs more than remotes probably? + bindkey '^gr' fzf-git-lreflogs-widget + + # https://github.com/junegunn/fzf/issues/164#issuecomment-581837757 + z4h bindkey fzf-cd-widget ç +fi + # Autoload functions. autoload -Uz zmv @@ -98,6 +125,14 @@ autoload -Uz zmv function md() { [[ $# == 1 ]] && mkdir -p -- "$1" && cd -- "$1" } compdef _directories md +# https://docs.brew.sh/Shell-Completion +if type brew &>/dev/null; then + FPATH=${HOMEBREW_PREFIX:+$HOMEBREW_PREFIX/share/zsh/site-functions:${FPATH}} + + autoload -Uz compinit + compinit +fi + # Define named directories: ~w <=> Windows home directory on WSL. # [[ -z $z4h_win_home ]] || hash -d w=$z4h_win_home