Last active
September 29, 2022 04:13
-
-
Save wwarriner/63e8524a7c05887a4fd1daecec90b619 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. | |
# Initialization code that may require console input (password prompts, [y/n] | |
# confirmations, etc.) must go above this block; everything else may go below. | |
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then | |
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" | |
fi | |
# Lines configured by zsh-newuser-install | |
HISTFILE=~/.histfile | |
HISTSIZE=1000 | |
SAVEHIST=1000 | |
unsetopt beep | |
bindkey -e | |
# End of lines configured by zsh-newuser-install | |
# The following lines were added by compinstall | |
zstyle :compinstall filename '/home/$USER/.zshrc' | |
autoload -Uz compinit | |
compinit | |
# End of lines added by compinstall | |
# functions | |
function detect-clipboard() { | |
emulate -L zsh | |
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then | |
function clipcopy() { cat "${1:-/dev/stdin}" | pbcopy; } | |
function clippaste() { pbpaste; } | |
elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then | |
function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; } | |
function clippaste() { cat /dev/clipboard; } | |
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then | |
function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; } | |
function clippaste() { wl-paste; } | |
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then | |
function clipcopy() { cat "${1:-/dev/stdin}" | xsel --clipboard --input; } | |
function clippaste() { xsel --clipboard --output; } | |
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then | |
function clipcopy() { cat "${1:-/dev/stdin}" | xclip -selection clipboard -in &>/dev/null &|; } | |
function clippaste() { xclip -out -selection clipboard; } | |
elif (( ${+commands[lemonade]} )); then | |
function clipcopy() { cat "${1:-/dev/stdin}" | lemonade copy; } | |
function clippaste() { lemonade paste; } | |
elif (( ${+commands[doitclient]} )); then | |
function clipcopy() { cat "${1:-/dev/stdin}" | doitclient wclip; } | |
function clippaste() { doitclient wclip -r; } | |
elif (( ${+commands[win32yank]} )); then | |
function clipcopy() { cat "${1:-/dev/stdin}" | win32yank -i; } | |
function clippaste() { win32yank -o; } | |
elif [[ $OSTYPE == linux-android* ]] && (( $+commands[termux-clipboard-set] )); then | |
function clipcopy() { cat "${1:-/dev/stdin}" | termux-clipboard-set; } | |
function clippaste() { termux-clipboard-get; } | |
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then | |
function clipcopy() { tmux load-buffer "${1:--}"; } | |
function clippaste() { tmux save-buffer -; } | |
elif [[ $(uname -r) = *icrosoft* ]]; then | |
function clipcopy() { cat "${1:-/dev/stdin}" | clip.exe; } | |
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; } | |
else | |
function _retry_clipboard_detection_or_fail() { | |
local clipcmd="${1}"; shift | |
if detect-clipboard; then | |
"${clipcmd}" "$@" | |
else | |
print "${clipcmd}: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 | |
return 1 | |
fi | |
} | |
function clipcopy() { _retry_clipboard_detection_or_fail clipcopy "$@"; } | |
function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; } | |
return 1 | |
fi | |
} | |
detect-clipboard | |
### Added by Zinit's installer | |
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then | |
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f" | |
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit" | |
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \ | |
print -P "%F{33} %F{34}Installation successful.%f%b" || \ | |
print -P "%F{160} The clone has failed.%f%b" | |
fi | |
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh" | |
autoload -Uz _zinit | |
(( ${+_comps} )) && _comps[zinit]=_zinit | |
### End of Zinit's installer chunk | |
### ZINIT | |
# PL10K | |
zinit ice depth=1 | |
zinit light romkatv/powerlevel10k | |
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. | |
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh | |
### Zinit | |
# junegunn/fzf | |
zinit ice wait lucid from"gh-r" as"program" | |
zinit light junegunn/fzf | |
# urbainvaes/fzf-marks | |
zinit ice wait lucid | |
zinit light urbainvaes/fzf-marks | |
# sharkdp/bat | |
zinit ice wait lucid as"command" from"gh-r" mv"bat* -> bat" pick"bat/bat" | |
zinit light sharkdp/bat | |
# ogham/exa | |
zinit ice wait lucid from"gh-r" as"program" pick"bin/exa" | |
zinit light ogham/exa | |
# Autosuggestions & fast-syntax-highlighting | |
zinit ice wait lucid atinit"ZINIT[COMPINIT_OPTS]=-C; zpcompinit; zpcdreplay" | |
zinit light zdharma-continuum/fast-syntax-highlighting | |
# zsh-autosuggestions | |
zinit ice wait lucid atload"!_zsh_autosuggest_start" | |
zinit load zsh-users/zsh-autosuggestions | |
# BurntSushi/ripgrep | |
zinit ice wait lucid as"program" from"gh-r" mv"ripgrep* -> rg" pick"rg/rg" | |
zinit light BurntSushi/ripgrep | |
# omz/copypath | |
zinit ice wait lucid | |
zinit snippet OMZP::copypath | |
# omz/copybuffer | |
zinit ice wait lucid | |
zinit snippet OMZP::copybuffer | |
# omz/dirhistory | |
zinit ice wait lucid | |
zinit snippet OMZP::dirhistory | |
# omz/history | |
zinit ice wait lucid | |
zinit snippet OMZP::history | |
# peco/peco | |
zinit ice wait lucid as"program" from"gh-r" mv"peco* -> peco" pick"peco/peco" | |
zinit light peco/peco | |
# skywind3000/z.lua | |
zinit ice wait lucid | |
zinit light skywind3000/z.lua | |
# denisidoro/navi | |
zinit ice wait lucid as"program" from"gh-r" mv"navi* -> navi" pick"navi/navi" | |
zinit light denisidoro/navi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)" | |
exec zsh | |
zinit self-update |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment