Switch back to FZF from skim

This commit is contained in:
Marko Korhonen 2021-11-13 13:07:50 +02:00
parent 98178a74f2
commit 6d92b744e1
3 changed files with 27 additions and 32 deletions

View file

@ -31,14 +31,19 @@ export PATH="/home/$USER/.bin:$PATH"
# go path
export GOPATH=~/.go
# skim settings
export SKIM_DEFAULT_COMMAND='fd -Ht f'
export SKIM_ALT_C_COMMAND='fd -Ht d'
export SKIM_DEFAULT_OPTS='-m --ansi --bind ctrl-a:toggle-all,ctrl-d:deselect-all,ctrl-t:toggle-all'
export SKIM_DEFAULT_OPTIONS="$SKIM_DEFAULT_OPTS" # TODO make an issue/PR about this difference
export SKIM_COMPLETION_TRIGGER='**'
export SKIM_CTRL_T_COMMAND="$SKIM_DEFAULT_COMMAND"
export SKIM_CTRL_T_OPTS='--preview "bat --color=always --style=numbers --line-range=:500 {}"'
# fzf settings
export FZF_DEFAULT_COMMAND='fd -Ht f'
export FZF_ALT_C_COMMAND='fd -Ht d'
export FZF_DEFAULT_OPTS='-m --ansi --bind ctrl-a:toggle-all,ctrl-d:deselect-all,ctrl-t:toggle-all'
export FZF_COMPLETION_TRIGGER='**'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_CTRL_T_OPTS='--preview "bat --color=always --style=numbers --line-range=:500 {}"'
_fzf_compgen_dir() {
fd -Ht d
}
_fzf_compgen_path() {
fd -Ht f
}
# dotfile repository location
export DOTREPO="$HOME/git/dotfiles"

View file

@ -10,7 +10,7 @@ source ~/.zinit/bin/zinit.zsh
zinit ice load multisrc'{async,pure}.zsh'
zinit light sindresorhus/pure
# skim as tab completion
# fzf as tab completion
zinit ice lucid
zinit light Aloxaf/fzf-tab
@ -18,7 +18,7 @@ zinit light Aloxaf/fzf-tab
zinit ice lucid
zinit light zsh-users/zsh-history-substring-search
# skim git awesomeness
# fzf git awesomeness
zinit ice wait'1' lucid atload'source $HOME/.config/zsh/03-aliases.zsh'
zinit light wfxr/forgit
@ -38,13 +38,13 @@ zinit snippet '$DOTREPO/dotdrop/completion/_dotdrop-completion.zsh'
zinit ice lucid atinit'zpcompinit'
zinit light zdharma-continuum/fast-syntax-highlighting
# use skim with zsh
# use fzf with zsh
{%@@ if profile == "mko-laptop" @@%}
# Source from home directory since mko-laptop is ubuntu and it doesn't
# have skim in it's repositories
source ~/Software/skim/shell/key-bindings.zsh
source ~/Software/skim/shell/completion.zsh
# Source from home directory since mko-laptop is ubuntu and it has an
# old version of FZF in it's repositories
source ~/Software/fzf/shell/key-bindings.zsh
source ~/Software/fzf/shell/completion.zsh
{%@@ else @@%}
source /usr/share/skim/key-bindings.zsh
source /usr/share/skim/completion.zsh
source /usr/share/fzf/key-bindings.zsh
source /usr/share/fzf/completion.zsh
{%@@ endif @@%}

View file

@ -5,14 +5,6 @@ alias gs='git status'
alias gpull='git pull'
alias gpush='git push'
# make skim zsh plugin use fd
_skim_compgen_dir() {
fd -Ht d
}
_skim_compgen_path() {
fd -Ht f
}
# Modern replacements for cat and ls
alias cat='bat --paging=never'
alias ls='exa'
@ -47,19 +39,17 @@ function command_not_found_handler {
}
{%@@ endif @@%}
# search and install packages with skim
# search and install/remove packages with fzf
pi() {
SELECTED_PKGS="$(paru -Slq | sk --header='Install packages' -m --preview 'paru -Si {1}')"
SELECTED_PKGS="$(paru -Slq | fzf --header='Install packages' -m --preview 'paru -Si {1}')"
if [ -n "$SELECTED_PKGS" ]; then
# Append the expanded command to history
print -s "paru -S $(echo $SELECTED_PKGS)"
paru -S $(echo $SELECTED_PKGS)
fi
}
# search and remove packages with skim
pr() {
SELECTED_PKGS="$(paru -Qsq | sk --header='Remove packages' -m --preview 'paru -Si {1}')"
SELECTED_PKGS="$(paru -Qsq | fzf --header='Remove packages' -m --preview 'paru -Si {1}')"
if [ -n "$SELECTED_PKGS" ]; then
# Append the expanded command to history
print -s "paru -Rns $(echo $SELECTED_PKGS)"
@ -67,9 +57,9 @@ pr() {
fi
}
# find and open man pages with skim
# find and open man pages with fzf
fman() {
man -k . | sk --prompt='Man> ' | awk '{print $1}' | xargs -r man
man -k . | fzf --prompt='Man> ' | awk '{print $1}' | xargs -r man
}
# I'm retarded so I need this