From 33f82903e4ca330aa7709d8186de199da0d2cf38 Mon Sep 17 00:00:00 2001 From: c Date: Thu, 13 Mar 2025 23:38:17 -0500 Subject: [PATCH] zshrc fzf history and ps1 --- zsh/.zshrc | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index 196df47..97378ae 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,15 +1,5 @@ -# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. -# Initialization code that may require console input (password prompts, [y/n] -# confirmations, etc.) must go above this block; everything else may go below. -if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then - source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" -fi - -# import keys -if [ -f ~/.keys ]; then - . ~/.keys - echo "keys loaded" -fi +# prompt +export PS1="%{%F{226}%}%n%{%F{220}%}@%{%F{214}%}%m %{%F{33}%}%1~ %{%f%}$ " # aliases # alias python="/Library/Frameworks/Python.framework/Versions/3.10/bin/python3" @@ -52,12 +42,6 @@ compinit _comp_options+=(globdots) zstyle ':completion:*' menu select -# start power theme -source ~/powerlevel10k/powerlevel10k.zsh-theme - -# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. -[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh - # auto cd setopt auto_cd @@ -71,4 +55,16 @@ eval "$(pyenv init --path)" eval "$(pyenv init -)" # eval "$(pyenv virtualenv-init -)" -source ~/powerlevel10k/powerlevel10k.zsh-theme + +# fzf +export FZF_DEFAULT_OPTS='--layout=reverse --height=50% --preview-window=right:50%:border-sharp --border-label=" command preview " --border=double' + +# Set up fzf key bindings and fuzzy completion +# Ctrl+R override for bash history +# Alt-C overried to cd into selected directory +eval "$(fzf --zsh)" + +# Quick file finder with preview and open with vim (Ctrl+T override) +# bind '"\C-t": "fzf --preview \"cat {}\" < <(find . -type f) | xargs $EDITOR\n"' + +