Dependencies:
Last active
July 3, 2023 13:54
-
-
Save roziscoding/6cda9570e60bb9cbd6fd84e82f020d1a to your computer and use it in GitHub Desktop.
WSL/ubuntu dotfiles
This file contains hidden or 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
#! /usr/bin/env zsh | |
realpath=${1:-$2} | |
batcommand=$(if type batcat > /dev/null; then echo 'batcat'; else echo 'bat'; fi) | |
if [[ ! -r $realpath ]]; then | |
where $realpath; | |
elif [[ -d $realpath ]]; then | |
exa -1 -lah --git --icons --color=always --octal-permissions --no-time --no-permissions --group-directories-first -s name $realpath; | |
elif [[ $realpath:t:e = "png" || $realpath:t:e = "jpg" ]]; then | |
chafa $realpath; | |
exiftool $realpath; | |
elif [[ `file --mime-encoding $realpath | grep "binary"` ]]; then | |
exiftool $realpath; | |
else | |
$batcommand -f $realpath; | |
fi; |
This file contains hidden or 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
export GPG_TTY=$TTY | |
# Adds `brew` to PATH | |
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) | |
# 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. | |
(( ${+commands[direnv]} )) && emulate zsh -c "$(direnv export zsh)" | |
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 | |
(( ${+commands[direnv]} )) && emulate zsh -c "$(direnv hook zsh)" | |
# Fixing completions | |
setopt automenu nolistambiguous | |
zstyle ':completion:*' menu select | |
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' | |
# Lines configured by zsh-newuser-install | |
HISTFILE=~/.histfile | |
HISTSIZE=1000 | |
SAVEHIST=1000 | |
setopt autocd beep extendedglob nomatch notify | |
# End of lines configured by zsh-newuser-install | |
# The following lines were added by compinstall | |
zstyle :compinstall filename '/home/roz/.zshrc' | |
autoload -Uz compinit | |
compinit | |
# End of lines added by compinstall | |
bindkey "^[[H" beginning-of-line | |
bindkey "^[[F" end-of-line | |
bindkey "^[[3~" delete-char | |
### Added by Zinit's installer | |
if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then | |
print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f" | |
command mkdir -p "$HOME/.zinit" && command chmod g-rwX "$HOME/.zinit" | |
command git clone [email protected]:zdharma-continuum/zinit.git "$HOME/.zinit/bin" && \ | |
print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \ | |
print -P "%F{160}▓▒░ The clone has failed.%f%b" | |
fi | |
source "$HOME/.zinit/bin/zinit.zsh" | |
autoload -Uz _zinit | |
(( ${+_comps} )) && _comps[zinit]=_zinit | |
# Load a few important annexes, without Turbo | |
# (this is currently required for annexes) | |
zinit light-mode for \ | |
srijanshetty/node.plugin.zsh \ | |
agkozak/zsh-z | |
### End of Zinit's installer chunk | |
### User added | |
# Loads powerlevel10k | |
zinit ice depth=1; zinit light romkatv/powerlevel10k | |
# Adds github shortcuts to PATH | |
export PATH=$PATH:/home/roziscoding/.bin/git-goodies | |
## Adds .bin folder to PATH | |
export PATH=$PATH:/home/roziscoding/.bin | |
export PATH=$PATH:/home/roziscoding/.local/bin | |
export PATH=$PATH:./node_modules/.bin | |
# Sets default editor to vim | |
export EDITOR=vim | |
export DENO_INSTALL="/home/roz/.deno" | |
export PATH="$DENO_INSTALL/bin:$PATH" | |
# Source to the minified fzf preview command | |
# preview_command() { | |
# if [[ ! -r $realpath ]]; then | |
# echo "Nothing to see here"; | |
# elif [[ -d $realpath ]]; then | |
# exa -1 -lah --icons --color=always --octal-permissions --no-time --no-permissions --group-directories-first -s name $realpath; | |
# elif [[ $realpath:t:e = "gif" || $realpath:t:e = "png" || $realpath:t:e = "jpg" ]]; then | |
# viu $realpath; | |
# elif [[ `file --mime-encoding $realpath | grep "binary"` ]]; then | |
# echo "Binary file"; | |
# else | |
# batcat -f $realpath; | |
# fi; | |
# } | |
# Sets the fzf preview command | |
zstyle ':fzf-tab:complete:*:*' fzf-preview '~/.preview ${(Q)realpath} $word' | |
zstyle ':fzf-tab:complete:*:*' fzf-flags --preview-window=right:70% --height=100% | |
zstyle ':fzf-tab:complete:service:*' fzf-preview 'SYSTEMD_COLORS=1 service $word status' | |
zstyle ':fzf-tab:complete:git-checkout:*' fzf-preview \ | |
'case "$group" in | |
"modified file") git diff $word | delta ;; | |
"recent commit object name") git show --color=always $word | delta ;; | |
*) git log --color=always $word ;; | |
esac' | |
# Loads plugins | |
zinit light Aloxaf/fzf-tab | |
zinit wait lucid for \ | |
atinit'ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay' \ | |
zdharma-continuum/fast-syntax-highlighting \ | |
blockf \ | |
zsh-users/zsh-completions \ | |
atload'!_zsh_autosuggest_start' \ | |
zsh-users/zsh-autosuggestions \ | |
hlissner/zsh-autopair \ | |
zpm-zsh/colorize \ | |
zpm-zsh/ls \ | |
atload'unalias gst; alias gst="git status"' davidde/git \ | |
atload'alias python=python3' amstrad/oh-my-matrix \ | |
reegnz/jq-zsh-plugin \ | |
atload'bindkey "^[[A" history-substring-search-up; bindkey "^[[B" history-substring-search-down;' zsh-users/zsh-history-substring-search \ | |
Tarrasch/zsh-colors | |
# Other variables | |
export ZSH_LS_DISABLE_GIT=true | |
# Aliases | |
function cz () { | |
code $(z -e $1) | |
} | |
function cfz () { | |
code $(fzf) | |
} | |
function mkd () { | |
mkdir -p $1 && cd $1 | |
} | |
function ghc () { | |
OWNER=$(basename $(pwd)) | |
gh repo clone $OWNER/$1 | |
} | |
alias rd="rm -rf" | |
alias mongo="docker exec -it mongodb mongo" | |
alias pbcopy="xclip -i -sel clip" | |
alias pbpaste="xclip -o -sel clip" | |
alias please="sudo !!" | |
alias cf=cloudflared | |
alias esudo='sudo -E env "PATH=$PATH"' | |
alias cat='bat' | |
alias c='cat' | |
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. | |
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh | |
function gi() { curl -sLw n https://www.toptal.com/developers/gitignore/api/$@ ;} | |
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh | |
# Load a few important annexes, without Turbo | |
# (this is currently required for annexes) | |
zinit light-mode for \ | |
zdharma-continuum/zinit-annex-as-monitor \ | |
zdharma-continuum/zinit-annex-bin-gem-node \ | |
zdharma-continuum/zinit-annex-patch-dl \ | |
zdharma-continuum/zinit-annex-rust | |
### End of Zinit's installer chunk | |
. $HOME/.asdf/asdf.sh | |
# append completions to fpath | |
fpath=(${ASDF_DIR}/completions $fpath) | |
# initialise completions with ZSH's compinit | |
autoload -Uz compinit && compinit | |
# bun completions | |
[ -s "/home/roziscoding/.bun/_bun" ] && source "/home/roziscoding/.bun/_bun" | |
# bun | |
export BUN_INSTALL="/home/roziscoding/.bun" | |
export PATH="$BUN_INSTALL/bin:$PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment