From 3a60e845bd256ee5f647f0c129eea62b69e9877c Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Wed, 22 Feb 2023 10:24:37 -0600 Subject: [PATCH] more fzf thoughts --- home/private_dot_config/git/config.tmpl | 1 + .../zsh/zexists.d/cmd/fzf.zsh | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/home/private_dot_config/git/config.tmpl b/home/private_dot_config/git/config.tmpl index 50c0d94..b7ec31f 100644 --- a/home/private_dot_config/git/config.tmpl +++ b/home/private_dot_config/git/config.tmpl @@ -40,6 +40,7 @@ save = !git add -A && git commit -m \"time: $(date +\"%Y.%m.%d %H:%M:%S\")\" la = "!git config -l | grep alias | cut -c 7-" gl = config --global -l rb5 = rebase -i HEAD~5 +frbi = "!f() { git rebase -i $(git log --pretty=oneline --color=always --abbrev-commit | fzf --ansi | cut -d ' ' -f1)^ ; }; f" [filter "lfs"] clean = git-lfs clean -- %f diff --git a/home/private_dot_config/zsh/zexists.d/cmd/fzf.zsh b/home/private_dot_config/zsh/zexists.d/cmd/fzf.zsh index 0eb2299..293cca0 100644 --- a/home/private_dot_config/zsh/zexists.d/cmd/fzf.zsh +++ b/home/private_dot_config/zsh/zexists.d/cmd/fzf.zsh @@ -7,5 +7,51 @@ FZF_COLORS=" --color=marker:#F8BD96,fg+:#F2CDCD,prompt:#DDB6F2,hl+:#F28FAD " +FZF_LAYOUT=" +--height=40% +--border=rounded +--margin=0,5,5% +--layout=reverse +" + export FZF_DEFAULT_OPTS=${FZF_COLORS}${FZF_LAYOUT} +zstyle ':fzf-tab:*' fzf-pad 4 + +# +# old fzf config +# +# export FZF_CTRL_GENERAL="--height=100% --margin=0,0,0" +# +# #adapted from https://github.com/zimfw/fzf/blob/master/init.zsh +# # TODO: fix this so it works with $ ** +# if [ -x "$(command -v fd)" ]; then +# export FZF_DEFAULT_COMMAND="command fd --type file --exclude ".git/" --hidden --no-ignore" +# _fzf_compgen_path() { +# command fd --type file --exclude ".git/" --hidden --no-ignore "${1}" +# } +# elif [ -x "$(command -v rg)" ]; then +# export FZF_DEFAULT_COMMAND="command rg -uu -g '!.git' --files" +# _fzf_compgen_path() { +# command rg -uu -g '!.git' --files "${1}" +# } +# fi +# +# if [ -x "$(command -v bat)" ]; then +# export FZF_CTRL_T_OPTS=" +# --preview 'command bat --style numbers --color=always --line-range :500 {}' +# --preview-window up,70%,border-rounded +# ${FZF_CTRL_GENERAL} +# " +# fi +# +# export FZF_ALT_C_OPTS=" +# --height 60% +# --preview 'lsd --tree --color always --icon always {}' +# --preview-window right,60%,border-rounded +# " +# +# # [[ -v FZF_CTRL_T_COMMAND ]] && && export FZF_CTRL_T_COMMAND=${FZF_DEFAULT_COMMAND} +# [[ -z $FZF_CTRL_T_COMMAND ]] && export FZF_CTRL_T_COMMAND="${FZF_DEFAULT_COMMAND}" + +# fix spacing on fzf-tab to show max options