mirror of
https://git.korhonen.cc/FunctionalHacker/dotfiles.git
synced 2024-11-18 21:27:42 +00:00
ZSH improvements:
- Move from FZF to skim (seems to be a bit faster and smooth) - Improve history * Add new options to not save duplicate entries etc * pi/pr aliases expand the paru command to history now
This commit is contained in:
parent
f6fc1d4bdf
commit
9103822ae8
@ -1,14 +1,23 @@
|
||||
# zsh key timeout
|
||||
# key timeout
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
# prompt customization
|
||||
export PURE_PROMPT_SYMBOL="λ"
|
||||
export PURE_PROMPT_VICMD_SYMBOL="y"
|
||||
|
||||
# zsh history settings
|
||||
# history settings
|
||||
export HISTFILE=~/.zsh_history
|
||||
export HISTSIZE=1000
|
||||
export SAVEHIST=1000
|
||||
export HISTSIZE=10000
|
||||
export SAVEHIST=10000
|
||||
# Ignore these functions from history since they will
|
||||
# append the expandend command to the history
|
||||
export HISTORY_IGNORE="(pi|pr)"
|
||||
# Additional settings (source https://jdhao.github.io/2021/03/24/zsh_history_setup)
|
||||
setopt HIST_IGNORE_ALL_DUPS
|
||||
setopt HIST_SAVE_NO_DUPS
|
||||
setopt HIST_REDUCE_BLANKS
|
||||
setopt INC_APPEND_HISTORY_TIME
|
||||
setopt EXTENDED_HISTORY
|
||||
|
||||
# Variable to pass to sdotdrop to get current user
|
||||
export USRNAME=$USER
|
||||
@ -16,16 +25,21 @@ export USRNAME=$USER
|
||||
# go path
|
||||
export GOPATH=~/.bin/go
|
||||
|
||||
# fzf settings
|
||||
export FZF_DEFAULT_COMMAND='fd -Ht f'
|
||||
export FZF_ALT_C_COMMAND='fd -Ht d'
|
||||
export FZF_DEFAULT_OPTS='-m --bind ctrl-a:select-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 {}"'
|
||||
|
||||
# use lesspipe with less
|
||||
export LESSOPEN="|lesspipe.sh %s"
|
||||
# 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 {}"'
|
||||
# copy for fzf, incase I ever use it
|
||||
export FZF_DEFAULT_COMMAND="$SKIM_DEFAULT_COMMAND"
|
||||
export FZF_ALT_C_COMMAND="$SKIM_ALT_C_COMMAND"
|
||||
export FZF_DEFAULT_OPTS="$SKIM_DEFAULT_OPTS"
|
||||
export FZF_COMPLETION_TRIGGER="$SKIM_COMPLETION_TRIGGER"
|
||||
export FZF_CTRL_T_COMMAND="$SKIM_DEFAULT_COMMAND"
|
||||
export FZF_CTRL_T_OPTS="$SKIM_CTRL_T_OPTS"
|
||||
|
||||
# dotfile repository location
|
||||
export DOTREPO="$HOME/git/dotfiles"
|
||||
|
@ -40,8 +40,8 @@ zinit light zdharma/fast-syntax-highlighting
|
||||
|
||||
# use fzf with zsh
|
||||
{%@@ if profile == "mko-laptop" @@%}
|
||||
source ~/.fzf.zsh
|
||||
source ~/.skim.zsh
|
||||
{%@@ else @@%}
|
||||
source /usr/share/fzf/key-bindings.zsh
|
||||
source /usr/share/fzf/completion.zsh
|
||||
source /usr/share/skim/key-bindings.zsh
|
||||
source /usr/share/skim/completion.zsh
|
||||
{%@@ endif @@%}
|
||||
|
@ -6,16 +6,7 @@ alias gpush='git push'
|
||||
|
||||
alias mutt='neomutt'
|
||||
|
||||
# Syntax highlighting cat
|
||||
alias cat='bat'
|
||||
|
||||
rip() {
|
||||
abcde
|
||||
printf "Ripping done. Importing to library"
|
||||
beet import ~/Documents/Rip/flac/*
|
||||
}
|
||||
|
||||
# make fzf zsh plugin use ripgrep
|
||||
# make fzf zsh plugin use fd
|
||||
_fzf_compgen_dir() {
|
||||
fd -Ht d
|
||||
}
|
||||
@ -23,18 +14,22 @@ _fzf_compgen_path() {
|
||||
fd -Ht f
|
||||
}
|
||||
|
||||
# search and install packages with fzf
|
||||
# search and install packages with skim
|
||||
pi() {
|
||||
SELECTED_PKGS="$(paru -Slq | fzf --header='Install packages' -m --preview 'paru -Si {1}')"
|
||||
SELECTED_PKGS="$(paru -Slq | sk --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 fzf
|
||||
# search and remove packages with skim
|
||||
pr() {
|
||||
SELECTED_PKGS="$(paru -Qsq | fzf --header='Remove packages' -m --preview 'paru -Si {1}')"
|
||||
SELECTED_PKGS="$(paru -Qsq | sk --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)"
|
||||
paru -Rns $(echo $SELECTED_PKGS)
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user