Added FZF plugin for ZSH
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -25,3 +25,6 @@
|
|||||||
[submodule "zsh/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"]
|
[submodule "zsh/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"]
|
||||||
path = zsh/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
|
path = zsh/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
|
||||||
url = https://github.com/zsh-users/zsh-syntax-highlighting.git
|
url = https://github.com/zsh-users/zsh-syntax-highlighting.git
|
||||||
|
[submodule "zsh/.oh-my-zsh/custom/plugins/fzf"]
|
||||||
|
path = zsh/.oh-my-zsh/custom/plugins/fzf
|
||||||
|
url = https://github.com/junegunn/fzf.git
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ alias ls="eza --color=always --group-directories-first --icons"
|
|||||||
# Replace some more things with better alternatives
|
# Replace some more things with better alternatives
|
||||||
if is_debian_based; then
|
if is_debian_based; then
|
||||||
alias bat='batcat'
|
alias bat='batcat'
|
||||||
|
alias fd='fdfind'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias cat='bat --style header --style snip --style changes --style header --pager never'
|
alias cat='bat --style header --style snip --style changes --style header --pager never'
|
||||||
|
|||||||
1
zsh/.oh-my-zsh/custom/plugins/fzf
Submodule
1
zsh/.oh-my-zsh/custom/plugins/fzf
Submodule
Submodule zsh/.oh-my-zsh/custom/plugins/fzf added at 4efcc344c3
@@ -1,9 +1,15 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Export Catppuccin Frappe theme for fzf
|
# Add fzf keybindings and enhancements
|
||||||
|
export FZF_CTRL_T_COMMAND="fd --type f"
|
||||||
|
export FZF_ALT_C_COMMAND="fd --type d"
|
||||||
|
export FZF_CTRL_R_OPTS="--preview 'echo {}'"
|
||||||
|
|
||||||
|
# Export Catppuccin Mocha theme for FZF
|
||||||
export FZF_DEFAULT_OPTS=" \
|
export FZF_DEFAULT_OPTS=" \
|
||||||
--color=bg+:#414559,bg:#303446,spinner:#F2D5CF,hl:#E78284 \
|
--height 60% --layout=reverse --border \
|
||||||
--color=fg:#C6D0F5,header:#E78284,info:#CA9EE6,pointer:#F2D5CF \
|
--color=bg+:#313244,bg:#1E1E2E,spinner:#F5E0DC,hl:#F38BA8 \
|
||||||
--color=marker:#BABBF1,fg+:#C6D0F5,prompt:#CA9EE6,hl+:#E78284 \
|
--color=fg:#CDD6F4,header:#F38BA8,info:#CBA6F7,pointer:#F5E0DC \
|
||||||
--color=selected-bg:#51576D \
|
--color=marker:#B4BEFE,fg+:#CDD6F4,prompt:#CBA6F7,hl+:#F38BA8 \
|
||||||
--color=border:#414559,label:#C6D0F5"
|
--color=selected-bg:#45475A \
|
||||||
|
--color=border:#313244,label:#CDD6F4"
|
||||||
|
|||||||
34
zsh/.zshrc
34
zsh/.zshrc
@@ -76,6 +76,7 @@ plugins=(
|
|||||||
aws
|
aws
|
||||||
colored-man-pages
|
colored-man-pages
|
||||||
command-not-found
|
command-not-found
|
||||||
|
fzf
|
||||||
gitignore
|
gitignore
|
||||||
mise
|
mise
|
||||||
zoxide
|
zoxide
|
||||||
@@ -120,3 +121,36 @@ fpath=(~/.zsh $fpath)
|
|||||||
|
|
||||||
autoload run-help
|
autoload run-help
|
||||||
autoload -Uz compinit && compinit -u
|
autoload -Uz compinit && compinit -u
|
||||||
|
|
||||||
|
# Key bindings using bindkey and fzf-tmux where possible
|
||||||
|
# Ctrl+R: Enhanced reverse history search
|
||||||
|
bindkey '^R' fzf-history-widget
|
||||||
|
|
||||||
|
# Ctrl+T: Fuzzy find file
|
||||||
|
bindkey '^T' fzf-file-widget
|
||||||
|
|
||||||
|
# Alt+C: Fuzzy change directory
|
||||||
|
bindkey '^[c' fzf-cd-widget
|
||||||
|
|
||||||
|
# Additional useful bindings
|
||||||
|
# Alt+H: Search and insert from history
|
||||||
|
fzf-history-widget() {
|
||||||
|
BUFFER=$(fc -l 1 | fzf --tac +s --no-sort --preview 'echo {}' | sed 's/^[ 0-9]*//')
|
||||||
|
CURSOR=$#BUFFER
|
||||||
|
zle reset-prompt
|
||||||
|
}
|
||||||
|
zle -N fzf-history-widget
|
||||||
|
|
||||||
|
fzf-file-widget() {
|
||||||
|
local file
|
||||||
|
file=$(fzf --preview 'bat --style=numbers --color=always --line-range :500 {}' 2> /dev/null) && LBUFFER+="$file"
|
||||||
|
zle reset-prompt
|
||||||
|
}
|
||||||
|
zle -N fzf-file-widget
|
||||||
|
|
||||||
|
fzf-cd-widget() {
|
||||||
|
local dir
|
||||||
|
dir=$(fd --type d | fzf --preview 'tree -a -C {} | head -100') && cd "$dir"
|
||||||
|
zle reset-prompt
|
||||||
|
}
|
||||||
|
zle -N fzf-cd-widget
|
||||||
|
|||||||
Reference in New Issue
Block a user