- ZSH
- curl
- wget
- git
- xclip
- ripgrep
- fd
- bat
- lsd
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
And add replace this in the plugins
variable in zshrc
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
)
# Allow vi mode in zsh
bindkey -v
# Alias
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
alias l="lsd -l --blocks=permission,name"
alias la="lsd -la --blocks=permission,name"
alias ll="lsd -la"
alias lt="lsd -l --blocks=permission,date,name"
alias lta="lsd -la --blocks=permission,date,name"
alias lw="lsd -l --blocks=permission,size,name"
alias lwa="lsd -la --blocks=permission,size,name"
zstyle ':completion:*' menu select
zmodload zsh/complist
# ...
# use the vi navigation keys in menu completion
bindkey -M menuselect '^H' vi-backward-char
bindkey -M menuselect '^K' vi-up-line-or-history
bindkey -M menuselect '^L' vi-forward-char
bindkey -M menuselect '^J' vi-down-line-or-history
# Add fzf autocompletion
export FZF_DEFAULT_COMMAND='fd .'
bindkey -s '^S' ' **^I'
# ^I == TAB
# ripgrep config
if type rg &> /dev/null; then
export FZF_DEFAULT_COMMAND='rg --files --hidden'
fi
# More fzf utils
function check_req () {
$(type bat > /dev/null 2>&1) && $(type fd > /dev/null 2>&1) && $(type fzf > /dev/null 2>&1)
}
function fzf-nvim () {
if $(check_req); then
local selected_file=$( \
fd --type f \
--hidden \
--follow \
--max-depth 1 \
--exclude .git | \
fzf \
--info inline \
--bind 'ctrl-d:preview-down,ctrl-u:preview-up' \
--preview "bat --style=numbers --theme=gruvbox-dark --color=always {} | head -500" \
--color=dark \
--color=fg:-1,bg:-1,hl:#5fff87,fg+:-1,bg+:-1,hl+:#ffaf5f \
--color=info:#af87ff,prompt:#5fff87,pointer:#ff87d7,marker:#ff87d7,spinner:#ff87d7 \
--query "$LBUFFER" --prompt="nvim file > "
)
if [ -n "$selected_file" ]; then
BUFFER="nvim $selected_file"
zle accept-line
fi
zle reset-prompt
fi
}
function fzf-cd () {
if $(check_req); then
local selected_file=$( \
fd --type d \
--max-depth 1 \
--hidden \
--follow \
--exclude .git | \
fzf --preview "lsd -l --blocks=permission,name {} | head -50" \
--bind 'ctrl-d:preview-down,ctrl-u:preview-up' \
--info inline \
--color=dark \
--color=fg:-1,bg:-1,hl:#5fff87,fg+:-1,bg+:-1,hl+:#ffaf5f \
--color=info:#af87ff,prompt:#5fff87,pointer:#ff87d7,marker:#ff87d7,spinner:#ff87d7 \
--query "$LBUFFER" --prompt="Change dir to > "
)
if [ -n "$selected_file" ]; then
BUFFER="cd $selected_file"
zle accept-line
fi
zle reset-prompt
fi
}
zle -N fzf-cd
zle -N fzf-nvim
bindkey '^F' fzf-cd
bindkey '^K' fzf-nvim
# Enable autocompletation again
source ~/.fzf/shell/completion.zsh