2021-07-02 13:54:21 +00:00
|
|
|
|
########
|
|
|
|
|
# INIT #
|
|
|
|
|
########
|
|
|
|
|
#===============================================================================================
|
2022-03-13 10:37:07 +00:00
|
|
|
|
declare -A ZINIT
|
|
|
|
|
# zinit, don't pollute my home!
|
|
|
|
|
ZINIT[BIN_DIR]="$HOME/.local/share/zinit/zinit.git"
|
|
|
|
|
ZINIT[HOME_DIR]="$HOME/.local/share/zinit"
|
|
|
|
|
ZINIT[MAN_DIR]="$HOME/.local/share/zinit/man"
|
|
|
|
|
ZINIT[ZCOMPDUMP_PATH]="$HOME/.cache/zinit/.zcompdump"
|
|
|
|
|
|
|
|
|
|
ZDOTDIR="$HOME/.cache/zsh/"
|
|
|
|
|
|
2021-07-02 13:54:21 +00:00
|
|
|
|
### Added by Zinit's installer
|
2022-03-13 10:37:07 +00:00
|
|
|
|
if [[ ! -f "${ZINIT[BIN_DIR]}/zinit.zsh" ]]; then
|
2021-07-02 13:54:21 +00:00
|
|
|
|
print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f"
|
2022-03-13 10:37:07 +00:00
|
|
|
|
command mkdir -p $ZINIT[HOME_DIR] && command chmod g-rwX $ZINIT[HOME_DIR]
|
|
|
|
|
command git clone https://github.com/zdharma-continuum/zinit $ZINIT[BIN_DIR] && \
|
2021-07-02 13:54:21 +00:00
|
|
|
|
print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \
|
|
|
|
|
print -P "%F{160}▓▒░ The clone has failed.%f%b"
|
|
|
|
|
fi
|
|
|
|
|
|
2022-03-13 10:37:07 +00:00
|
|
|
|
source "${ZINIT[BIN_DIR]}/zinit.zsh"
|
2021-07-02 13:54:21 +00:00
|
|
|
|
autoload -Uz _zinit
|
|
|
|
|
(( ${+_comps} )) && _comps[zinit]=_zinit
|
|
|
|
|
|
|
|
|
|
# Load a few important annexes, without Turbo
|
|
|
|
|
# (this is currently required for annexes)
|
|
|
|
|
#zinit light-mode for \
|
|
|
|
|
#zinit-zsh/z-a-rust \
|
|
|
|
|
#zinit-zsh/z-a-as-monitor \
|
|
|
|
|
#zinit-zsh/z-a-patch-dl \
|
|
|
|
|
#zinit-zsh/z-a-bin-gem-node
|
|
|
|
|
|
|
|
|
|
### End of Zinit's installer chunk
|
|
|
|
|
#===============================================================================================
|
|
|
|
|
|
|
|
|
|
###########
|
|
|
|
|
# PLUGINS #
|
|
|
|
|
###########
|
|
|
|
|
|
|
|
|
|
#===============================================================================================
|
|
|
|
|
#zplugin load zdharma/history-search-multi-word
|
|
|
|
|
|
|
|
|
|
zplugin ice wait'1' lucid
|
|
|
|
|
zplugin snippet OMZ::plugins/fzf/fzf.plugin.zsh
|
|
|
|
|
zplugin ice wait'1' lucid
|
|
|
|
|
zplugin snippet OMZ::plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh
|
|
|
|
|
zplugin snippet OMZ::plugins/vi-mode/vi-mode.plugin.zsh
|
|
|
|
|
|
|
|
|
|
|
2022-02-07 10:24:13 +00:00
|
|
|
|
zplugin ice wait'2' lucid
|
2022-01-05 10:10:35 +00:00
|
|
|
|
zplugin load zdharma-continuum/fast-syntax-highlighting
|
2021-07-02 13:54:21 +00:00
|
|
|
|
|
2021-09-06 06:38:06 +00:00
|
|
|
|
zplugin ice wait'0' lucid
|
2021-07-02 13:54:21 +00:00
|
|
|
|
zplugin load 'flinner/zsh-emacs'
|
|
|
|
|
|
|
|
|
|
zplugin ice wait lucid atload'_zsh_autosuggest_start'
|
|
|
|
|
zplugin light zsh-users/zsh-autosuggestions
|
|
|
|
|
|
2021-07-18 06:01:51 +00:00
|
|
|
|
zplugin ice wait'0' lucid
|
|
|
|
|
zinit load agkozak/zsh-z
|
|
|
|
|
|
|
|
|
|
|
2023-03-31 10:23:01 +00:00
|
|
|
|
zplugin ice wait'5' lucid
|
|
|
|
|
zplugin load chisui/zsh-nix-shell
|
|
|
|
|
|
|
|
|
|
|
2021-07-02 13:54:21 +00:00
|
|
|
|
#zplugin ice wait'1' lucid
|
|
|
|
|
#zplugin load marlonrichert/zsh-autocomplete
|
|
|
|
|
|
|
|
|
|
# This one to be ran just once, in interactive session
|
|
|
|
|
#
|
|
|
|
|
autoload -Uz compinit
|
|
|
|
|
|
|
|
|
|
compinit
|
|
|
|
|
|
|
|
|
|
compdef _gnu_generic ytfzf
|
2022-02-07 10:24:13 +00:00
|
|
|
|
compdef _gnu_generic emacs
|
2021-07-02 13:54:21 +00:00
|
|
|
|
# insensitve completion
|
|
|
|
|
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setopt HIST_IGNORE_ALL_DUPS # do not put duplicated command into history list
|
2022-03-11 20:47:28 +00:00
|
|
|
|
setopt HIST_IGNORE_SPACE # Remove commands from history when the first character is a space
|
2021-07-02 13:54:21 +00:00
|
|
|
|
setopt HIST_SAVE_NO_DUPS # do not save duplicated command
|
|
|
|
|
setopt HIST_REDUCE_BLANKS # remove unnecessary blanks
|
2022-03-13 10:37:07 +00:00
|
|
|
|
setopt CORRECT # Correct spelling of commands
|
|
|
|
|
setopt CORRECT_ALL # Correct spelling of arguments
|
2022-04-02 20:05:20 +00:00
|
|
|
|
setopt INTERACTIVE_COMMENTS # can have comments at the prompt
|
2022-07-14 10:48:09 +00:00
|
|
|
|
setopt HIST_VERIFY # history expansions get verified in a new line
|
|
|
|
|
setopt SHARE_HISTORY # SHARE_HISTORY between zsh sessins
|
|
|
|
|
# disabled due to SHARE_HISTORY being used
|
|
|
|
|
#setopt INC_APPEND_HISTORY_TIME # append command to history file immediately after execution
|
|
|
|
|
setopt EXTENDED_HISTORY # record command start time
|
2022-03-13 10:37:07 +00:00
|
|
|
|
SAVEHIST=1000
|
|
|
|
|
HISTSIZE=1000
|
|
|
|
|
HISTFILE="$HOME/.local/share/zsh/zsh_history"
|
2021-07-02 13:54:21 +00:00
|
|
|
|
#===============================================================================================
|
|
|
|
|
|
|
|
|
|
############
|
|
|
|
|
# KEYBINDS #
|
|
|
|
|
############
|
|
|
|
|
|
|
|
|
|
#===============================================================================================
|
|
|
|
|
|
|
|
|
|
bindkey -e
|
|
|
|
|
function zle-keymap-select zle-line-init zle-line-finish
|
|
|
|
|
{
|
|
|
|
|
case $KEYMAP in
|
|
|
|
|
vicmd) print -n '\033[1 q';; #line cursor
|
|
|
|
|
viins|main) print -n '\033[6 q';; # block cursor
|
|
|
|
|
esac
|
|
|
|
|
}
|
2022-05-22 21:39:55 +00:00
|
|
|
|
# Quit with jk or ESC
|
2021-07-02 13:54:21 +00:00
|
|
|
|
bindkey jk vi-cmd-mode
|
2022-05-22 21:39:55 +00:00
|
|
|
|
bindkey '\e' vi-cmd-mode
|
2021-07-02 13:54:21 +00:00
|
|
|
|
|
|
|
|
|
# exit on partianl command with Ctrl-D
|
|
|
|
|
exit_zsh() { exit }
|
|
|
|
|
zle -N exit_zsh
|
2021-09-06 06:38:06 +00:00
|
|
|
|
bindkey '^v' edit-command-line
|
2021-07-02 13:54:21 +00:00
|
|
|
|
bindkey '^D' exit_zsh
|
|
|
|
|
|
|
|
|
|
#===============================================================================================
|
|
|
|
|
|
|
|
|
|
#########
|
|
|
|
|
# OTHER #
|
|
|
|
|
#########
|
|
|
|
|
|
|
|
|
|
#disable url globbing (for mpv) # https://superuser.com/questions/649635/zsh-says-no-matches-found-when-trying-to-download-video-with-youtube-dl
|
|
|
|
|
#TODO: delete this
|
|
|
|
|
#autoload -Uz bracketed-paste-magic
|
|
|
|
|
#zle -N bracketed-paste bracketed-paste-magic
|
|
|
|
|
autoload -Uz url-quote-magic
|
|
|
|
|
zle -N self-insert url-quote-magic
|
|
|
|
|
|
2021-10-12 04:37:08 +00:00
|
|
|
|
# should kill upto to the slash
|
|
|
|
|
autoload -U select-word-style
|
|
|
|
|
select-word-style bash
|
|
|
|
|
|
|
|
|
|
|
2021-07-02 13:54:21 +00:00
|
|
|
|
|
|
|
|
|
#zle -N zle-line-init
|
|
|
|
|
#zle -N zle-line-finish
|
|
|
|
|
#zle -N zle-keymap-select
|
|
|
|
|
#===============================================================================================
|
|
|
|
|
|
|
|
|
|
#########################
|
|
|
|
|
# ALIASES AND FUNCTIONS #
|
|
|
|
|
#########################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#===============================================================================================
|
|
|
|
|
copy () { xclip -selection c "$@" }
|
|
|
|
|
|
|
|
|
|
chmodx-last () { chmod +x "$_" ; }
|
|
|
|
|
|
|
|
|
|
# get weather, example: weather New York
|
|
|
|
|
weather () { curl wttr.in/"$*"; }
|
|
|
|
|
|
|
|
|
|
# get public ip address
|
|
|
|
|
ip.me () { curl eth0.me ; curl ipv6.icanhazip.com } # or ip.me
|
|
|
|
|
|
|
|
|
|
# 0x0, upload files and use as pastebin example: 0x0 file.sh
|
|
|
|
|
0x0 () {
|
|
|
|
|
[ ! -z "$1" ] && file=$1 || file=$(find . -maxdepth 2 -type f | fzf)
|
|
|
|
|
[ -z "$file" ] && return
|
|
|
|
|
echo "file=@$file"
|
2022-04-11 19:35:42 +00:00
|
|
|
|
_URL=$(curl -F "file=@$file" 0x0.st)
|
|
|
|
|
echo "$_URL" | xclip -sel clip
|
|
|
|
|
echo "$_URL"
|
2021-07-02 13:54:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-06 06:38:06 +00:00
|
|
|
|
# curl with cache
|
|
|
|
|
curl_cache(){
|
|
|
|
|
local cache_path=`echo $1 | sed 's|/|_|g'`
|
|
|
|
|
local cache_path="/tmp/$cache_path"
|
|
|
|
|
|
|
|
|
|
[ -f "$cache_path" ] || curl -s "$1" -o "$cache_path"
|
|
|
|
|
|
|
|
|
|
cat "$cache_path"
|
|
|
|
|
}
|
2021-12-31 14:49:15 +00:00
|
|
|
|
alias ..='cd ..'
|
|
|
|
|
alias ...='cd ../..'
|
|
|
|
|
alias ....='cd ../../'
|
2021-09-06 06:38:06 +00:00
|
|
|
|
|
|
|
|
|
|
2021-07-02 13:54:21 +00:00
|
|
|
|
alias doas='sudo '
|
|
|
|
|
alias sudo='sudo '
|
|
|
|
|
|
|
|
|
|
alias fm='ranger'
|
|
|
|
|
alias fm.='. ranger'
|
2023-03-31 10:23:01 +00:00
|
|
|
|
alias books="fm ~/Nextcloud/Books"
|
2021-07-02 13:54:21 +00:00
|
|
|
|
|
|
|
|
|
alias ll='ls -alF'
|
|
|
|
|
alias la='ls -A'
|
|
|
|
|
alias l='ls -CF'
|
|
|
|
|
alias sl='ls -CF'
|
|
|
|
|
alias ls='ls --color=auto'
|
|
|
|
|
|
2021-10-12 04:37:08 +00:00
|
|
|
|
alias please='sudo $(fc -ln -1)'
|
2021-12-31 14:49:15 +00:00
|
|
|
|
alias plz='echo sudo $(fc -ln -1); sudo $(fc -ln -1)'
|
2021-10-12 04:37:08 +00:00
|
|
|
|
|
2021-07-02 13:54:21 +00:00
|
|
|
|
alias p='paru'
|
|
|
|
|
|
|
|
|
|
alias grep='grep --color=auto'
|
|
|
|
|
alias fgrep='fgrep --color=auto'
|
|
|
|
|
alias egrep='egrep --color=auto'
|
|
|
|
|
|
|
|
|
|
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
|
|
|
|
|
|
|
|
|
|
alias ip='ip --color=auto'
|
|
|
|
|
alias ytfzfd='YTFZF_PLAYER="youtube-dl --embed-subs --write-sub --sub-lang en" ytfzf'
|
|
|
|
|
|
2021-09-06 06:38:06 +00:00
|
|
|
|
alias cargo-doc-server="python -m http.server -d target/doc/ -b 127.0.0.1"
|
2023-03-31 10:23:01 +00:00
|
|
|
|
alias startx="exec startx"
|
2021-09-06 06:38:06 +00:00
|
|
|
|
|
2021-07-02 13:54:21 +00:00
|
|
|
|
#===============================================================================================
|
|
|
|
|
|
|
|
|
|
#VARS
|
|
|
|
|
|
|
|
|
|
#===============================================================================================
|
|
|
|
|
|
|
|
|
|
#xdg specs
|
|
|
|
|
export XDG_CONFIG_HOME="$HOME"/.config
|
|
|
|
|
export XDG_CACHE_HOME="$HOME"/.cache
|
|
|
|
|
export XDG_DATA_HOME="$HOME"/.local/share
|
|
|
|
|
|
|
|
|
|
export CARGO_HOME="$XDG_DATA_HOME"/cargo
|
|
|
|
|
|
|
|
|
|
export GOPATH="$XDG_DATA_HOME"/go
|
|
|
|
|
export GOBIN="$XDG_DATA_HOME"/go
|
|
|
|
|
export DOOM_PATH="$HOME/.emacs.d/bin"
|
2024-11-14 13:15:47 +00:00
|
|
|
|
#export YARN_PATH="$HOME/.yarn/bin"
|
2021-07-02 13:54:21 +00:00
|
|
|
|
|
2022-02-07 10:24:13 +00:00
|
|
|
|
export PATH="$DOOM_PATH:$HOME/.local/bin:$HOME/bin:$CARGO_HOME/bin:$YARN_PATH:$GOPATH:$PATH"
|
2021-07-02 13:54:21 +00:00
|
|
|
|
|
2021-07-18 06:01:51 +00:00
|
|
|
|
|
2021-07-02 13:54:21 +00:00
|
|
|
|
# colored GCC warnings and errors
|
|
|
|
|
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
|
|
|
|
|
|
|
|
|
# z-jumper to store symbolc links
|
|
|
|
|
export _Z_NO_RESOLVE_SYMLINKS=1
|
|
|
|
|
export _Z_DATA="$HOME/.local/share/z"
|
|
|
|
|
|
|
|
|
|
# jupyter garbage export JUPYTERLAB_DIR=$HOME/.local/share/jupyter/lab
|
|
|
|
|
|
|
|
|
|
# python path for jupyter garbage
|
|
|
|
|
export PYTHONPATH="$HOME/.local/bin"
|
|
|
|
|
|
|
|
|
|
# andriod studio, not that I use it
|
|
|
|
|
# also needed by shitlab! (matlab)
|
|
|
|
|
export _JAVA_AWT_WM_NONREPARENTING=1
|
|
|
|
|
export _JAVA_OPTIONS="-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
|
|
|
|
|
|
|
|
|
|
#support for gpg
|
|
|
|
|
export GPG_TTY=$(tty)
|
|
|
|
|
|
|
|
|
|
# ZSH Home
|
|
|
|
|
export ZSH="$HOME/.config/.oh-my-zsh"
|
|
|
|
|
|
|
|
|
|
# fish
|
|
|
|
|
export fish_greeting="" #disable greeting
|
|
|
|
|
|
|
|
|
|
#Preferred editor for local and remote sessions
|
|
|
|
|
if [[ -n $SSH_CONNECTION ]]; then
|
|
|
|
|
export EDITOR='vim'
|
|
|
|
|
else
|
|
|
|
|
export EDITOR='nvim'
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
export TERMINAL="alacritty"
|
|
|
|
|
|
|
|
|
|
# man colors
|
|
|
|
|
export LESS_TERMCAP_mb=$(printf '\e[01;31m') # enter blinking mode - red
|
|
|
|
|
export LESS_TERMCAP_md=$(printf '\e[01;35m') # enter double-bright mode - bold, magenta
|
|
|
|
|
export LESS_TERMCAP_me=$(printf '\e[0m') # turn off all appearance modes (mb, md, so, us)
|
|
|
|
|
export LESS_TERMCAP_se=$(printf '\e[0m') # leave standout mode
|
|
|
|
|
export LESS_TERMCAP_so=$(printf '\e[01;33m') # enter standout mode - yellow
|
|
|
|
|
export LESS_TERMCAP_ue=$(printf '\e[0m') # leave underline mode
|
|
|
|
|
export LESS_TERMCAP_us=$(printf '\e[04;36m') # enter underline mode - cyan
|
2021-07-18 06:01:51 +00:00
|
|
|
|
|
2023-03-31 10:23:01 +00:00
|
|
|
|
# fcitx (japanese)
|
|
|
|
|
GTK_IM_MODULE='fcitx'
|
|
|
|
|
QT_IM_MODULE='fcitx'
|
|
|
|
|
SDL_IM_MODULE='fcitx'
|
|
|
|
|
XMODIFIERS='@im=fcitx'
|
|
|
|
|
|
2024-11-14 13:15:47 +00:00
|
|
|
|
# for emacs-ng
|
|
|
|
|
WINIT_X11_SCALE_FACTOR=1
|
|
|
|
|
|
2021-07-02 13:54:21 +00:00
|
|
|
|
#===============================================================================================
|
|
|
|
|
|
|
|
|
|
# Load the pure theme, with zsh-async library that's bundled with it
|
|
|
|
|
PS1="> "
|
|
|
|
|
RPS1=" "
|
|
|
|
|
#zplugin ice wait'!0' lucid pick"async.zsh" src"pure.zsh"; zplugin light sindresorhus/pure
|
|
|
|
|
eval "$(starship init zsh)"
|
2021-09-06 06:38:06 +00:00
|
|
|
|
|
|
|
|
|
#~/bin/dennis
|
|
|
|
|
#cutefetch 2> /dev/null
|
2024-11-14 13:15:47 +00:00
|
|
|
|
~/bin/is-reboot-needed
|
|
|
|
|
|
|
|
|
|
export QSYS_ROOTDIR="/home/lambda/Programs/intelQuartus/quartus/sopc_builder/bin"
|
|
|
|
|
export JUPYTERLAB_DIR=$HOME/.local/share/jupyter/lab
|