Removed commit history
Signed-off-by: Marko Korhonen <marko.korhonen@reekynet.com>
This commit is contained in:
commit
b1335a3628
199 changed files with 36930 additions and 0 deletions
34
home/.config/zsh/01-env.zsh
Normal file
34
home/.config/zsh/01-env.zsh
Normal file
|
@ -0,0 +1,34 @@
|
|||
# zsh key timeout
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
# zsh history settings
|
||||
export HISTFILE=~/.zsh_history
|
||||
export HISTSIZE=1000
|
||||
export SAVEHIST=1000
|
||||
export setopt appendhistory
|
||||
|
||||
# go path
|
||||
export GOPATH=~/.bin/go
|
||||
|
||||
# fzf settings
|
||||
export FZF_DEFAULT_COMMAND='rg --files --hidden 2>/dev/null'
|
||||
export FZF_COMPLETION_TRIGGER='**'
|
||||
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
||||
|
||||
# use lesspipe with less
|
||||
export LESSOPEN="|lesspipe.sh %s"
|
||||
|
||||
# dotdrop repository location
|
||||
export DOTREPO="$HOME/Git/dotfiles"
|
||||
|
||||
# nvim ftw!
|
||||
export EDITOR=nvim
|
||||
export PAGER="nvimpager -p"
|
||||
|
||||
# use gpg for ssh
|
||||
export GPG_TTY="$(tty)"
|
||||
export SSH_AUTH_SOCK="/run/user/$UID/gnupg/S.gpg-agent.ssh"
|
||||
gpg-connect-agent updatestartuptty /bye > /dev/null
|
||||
|
||||
# tehfuk
|
||||
eval $(thefuck --alias)
|
34
home/.config/zsh/02-plugins.zsh
Normal file
34
home/.config/zsh/02-plugins.zsh
Normal file
|
@ -0,0 +1,34 @@
|
|||
# install zplugin if it's not
|
||||
if [ ! -f ~/.zplugin/bin/zplugin.zsh ]; then
|
||||
mkdir ~/.zplugin
|
||||
git clone https://github.com/zdharma/zplugin.git ~/.zplugin/bin
|
||||
fi
|
||||
|
||||
source ~/.zplugin/bin/zplugin.zsh
|
||||
|
||||
# pure prompt
|
||||
zplugin ice lucid pick'async.zsh' src'pure.zsh' onlight'prompt_pure_setup'
|
||||
zplugin light sindresorhus/pure
|
||||
|
||||
# substring search
|
||||
zplugin ice wait'1' lucid
|
||||
zplugin light zsh-users/zsh-history-substring-search
|
||||
|
||||
zplugin ice wait'1' lucid
|
||||
zplugin snippet OMZ::lib/completion.zsh
|
||||
|
||||
# fzf git awesomeness
|
||||
zplugin ice wait'1' lucid atload'source $HOME/.config/zsh/03-functions.zsh'
|
||||
zplugin light wfxr/forgit
|
||||
|
||||
# dotdrop completion
|
||||
zplugin ice wait'1' lucid as'completion'
|
||||
zplugin snippet $DOTREPO/dotdrop/completion/_dotdrop-completion.zsh
|
||||
|
||||
# syntax highlighting
|
||||
zplugin ice wait'1' lucid atinit'zpcompinit'
|
||||
zplugin light zdharma/fast-syntax-highlighting
|
||||
|
||||
# use fzf with zsh
|
||||
source /usr/share/fzf/key-bindings.zsh
|
||||
source /usr/share/fzf/completion.zsh
|
142
home/.config/zsh/03-functions.zsh
Normal file
142
home/.config/zsh/03-functions.zsh
Normal file
|
@ -0,0 +1,142 @@
|
|||
# signoff every commit
|
||||
git() {
|
||||
if [[ "$1" == "commit" && $# -eq 1 ]]; then
|
||||
/usr/bin/git commit -S -s
|
||||
else
|
||||
/usr/bin/git $@
|
||||
fi
|
||||
}
|
||||
|
||||
# git shorthands
|
||||
gc() { git commit $@ }
|
||||
gpull() { git pull $@ }
|
||||
gpush() { git push $@ }
|
||||
|
||||
# Syntax highlighting cat
|
||||
cat() { nvimpager -c $@ }
|
||||
|
||||
|
||||
rip() {
|
||||
abcde
|
||||
printf "Ripping done. Importing to library"
|
||||
beet import ~/Documents/Rip/flac/*
|
||||
}
|
||||
|
||||
# search and install packages with fzf
|
||||
yi() {
|
||||
SELECTED_PKGS="$(yay -Slq | fzf --header='Install packages' -m --preview 'yay -Si {1}')"
|
||||
if [ -n "$SELECTED_PKGS" ]; then
|
||||
yay -S $(echo $SELECTED_PKGS)
|
||||
fi
|
||||
}
|
||||
|
||||
# search and remove packages with fzf
|
||||
yr() {
|
||||
SELECTED_PKGS="$(yay -Qsq | fzf --header='Remove packages' -m --preview 'yay -Si {1}')"
|
||||
if [ -n "$SELECTED_PKGS" ]; then
|
||||
yay -Rns $(echo $SELECTED_PKGS)
|
||||
fi
|
||||
}
|
||||
|
||||
# find and open man pages with fzf
|
||||
fman() {
|
||||
man -k . | fzf --prompt='Man> ' | awk '{print $1}' | xargs -r man
|
||||
}
|
||||
|
||||
# I'm retarded so I need this
|
||||
:q() { 'exit' }
|
||||
:wq() { 'exit' }
|
||||
|
||||
# zbar output only data
|
||||
zbarimg() { /usr/bin/zbarimg -q --raw $@ }
|
||||
zbarcam() { /usr/bin/zbarcam -q --raw $@ }
|
||||
|
||||
# switch to desktop mode
|
||||
dock() { swaymsg output eDP-1 disable }
|
||||
|
||||
# move to trash instead of remove
|
||||
rm() { trash $@ }
|
||||
|
||||
# clean stuff
|
||||
clean() {
|
||||
DFCMD="df -h / | tail -n 1 | cut -d' ' -f8- | cut -d' ' -f1 | sed 's/[^0-9]*//g'"
|
||||
SPACEBEFORE=$(eval "$DFCMD")
|
||||
trash-empty 10
|
||||
sudo journalctl --vacuum-size=500M
|
||||
yay -Sc --noconfirm
|
||||
SPACEAFTER=$(eval "$DFCMD")
|
||||
echo "Saved $(calc $SPACEAFTER - $SPACEBEFORE)G of space"
|
||||
}
|
||||
|
||||
# connect to wireguard
|
||||
startvpn() { sudo systemctl start wg-quick@wg0.service }
|
||||
stopvpn() { sudo systemctl stop wg-quick@wg0.service }
|
||||
|
||||
# connect to metropolia vpn
|
||||
metropoliavpn() { sudo openconnect -u markoak --passwd-on-stdin vpn.metropolia.fi }
|
||||
|
||||
# read qrcode from selection
|
||||
qr() { grim -g "$(slurp -d)" - | zbarimg PNG:- }
|
||||
|
||||
# generate qr code in terminal
|
||||
qrencode() { /usr/bin/qrencode -t ansiutf8 $@ }
|
||||
|
||||
# color picker
|
||||
cpick() { grim -g "$(slurp -p)" -t ppm - | convert - -format "%[pixel:p{0,0}]" txt:- }
|
||||
|
||||
# eclim daemon location
|
||||
eclimd() { /usr/lib/eclipse/eclimd }
|
||||
|
||||
#iwctl aliases
|
||||
i() { iwctl station wlan $@ }
|
||||
|
||||
# download firefox customizations
|
||||
ffcustom() { wget "https://gist.githubusercontent.com/Sporif/db6b3440fba0b1bcf5477afacf93f875/raw/2a1be65a12f8f0c88ba84a69697e542ad62d4624/userChrome.css" "https://gist.github.com/mrkwatz/277fb19d210a7539304ca2388f24d8e3/raw/d5b47f4089a3ef29cc719ecb9f3bc0d333ab866a/userChrome.js" "https://gist.github.com/mrkwatz/277fb19d210a7539304ca2388f24d8e3/raw/d5b47f4089a3ef29cc719ecb9f3bc0d333ab866a/userChrome.xml" }
|
||||
|
||||
# nvim ftw!
|
||||
vim() { nvim $@ }
|
||||
v() { nvim $@ }
|
||||
|
||||
# change cpu power settings
|
||||
performanceg() { sudo cpupower frequency-set -g performance }
|
||||
powersaveg() { sudo cpupower frequency-set -g powersave }
|
||||
performance() { performanceg && sudo ryzenadj --stapm-limit=45000 --fast-limit=45000 --slow-limit=45000 --tctl-temp=90 }
|
||||
powersave() { powersaveg && sudo ryzenadj --stapm-limit=25000 --fast-limit=25000 --slow-limit=25000 --tctl-temp=55 }
|
||||
ultimatepowersave() { powersave && sudo ryzenadj --stapm-limit=25000 --fast-limit=25000 --slow-limit=25000 --tctl-temp=20; }
|
||||
|
||||
# monitor cpu freq
|
||||
cpufreq() { watch -n 1 eval "cat /proc/cpuinfo |grep MHz" }
|
||||
|
||||
# dotdrop
|
||||
updatesecrets() { bash $DOTREPO/secrets/secrets.sh }
|
||||
dotdrop() { source $DOTREPO/secrets/secrets && $DOTREPO/dotdrop/dotdrop.sh --cfg=$DOTREPO/config-home.yaml $@ }
|
||||
sdotdrop() { source $DOTREPO/secrets/secrets && sudo -E $DOTREPO/dotdrop/dotdrop.sh --cfg=$DOTREPO/config-root.yaml $@ }
|
||||
dotgit() { git -C $DOTREPO $@ }
|
||||
dotsync() { cd $DOTREPO && gpull && ga && gc && gpush && cd $OLDPWD }
|
||||
|
||||
# sync password manager
|
||||
passync() { pass git pull && pass git push && updatesecrets }
|
||||
|
||||
# update stuff
|
||||
plugupdate() { vim +PlugUpgrade +PlugUpdate +qa && zplug update }
|
||||
dotupdate() { dotgit submodule update --init --recursive && dotgit submodule update --remote dotdrop && dotsync }
|
||||
update() { yay -Syu firefox-nightly; flatpak update }
|
||||
updateall() { update; plugupdate; dotupdate; passync; sudo awman-update }
|
||||
|
||||
# remove unneeded packages
|
||||
autoremove() { sudo pacman -R $(pacman -Qdtq) }
|
||||
|
||||
# start neomutt instead of mutt
|
||||
mutt() { neomutt $@ }
|
||||
|
||||
# turn on usb tethering on my android phone
|
||||
tether() { adb shell su -c "service call connectivity 33 i32 1 s16 me" > /dev/null }
|
||||
|
||||
# update arch mirrorlist
|
||||
reflect() { sudo reflector --latest 200 --threads 8 --verbose --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist }
|
||||
|
||||
# better ls
|
||||
ls() { ls_extended $@ }
|
||||
|
||||
# default icon for notify-send
|
||||
notify-send() { /usr/bin/notify-send --icon=alarm $@ }
|
39
home/.config/zsh/04-keybinds.zsh
Normal file
39
home/.config/zsh/04-keybinds.zsh
Normal file
|
@ -0,0 +1,39 @@
|
|||
# this is from https://github.com/robbyrussell/oh-my-zsh/issues/7330#issuecomment-475844784
|
||||
typeset -A key
|
||||
|
||||
key[Home]=${terminfo[khome]}
|
||||
|
||||
key[End]=${terminfo[kend]}
|
||||
key[Insert]=${terminfo[kich1]}
|
||||
key[Delete]=${terminfo[kdch1]}
|
||||
key[Up]=${terminfo[kcuu1]}
|
||||
key[Down]=${terminfo[kcud1]}
|
||||
key[Left]=${terminfo[kcub1]}
|
||||
key[Right]=${terminfo[kcuf1]}
|
||||
key[PageUp]=${terminfo[kpp]}
|
||||
key[PageDown]=${terminfo[knp]}
|
||||
|
||||
# setup key accordingly
|
||||
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
|
||||
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
|
||||
[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
|
||||
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
|
||||
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" history-substring-search-up
|
||||
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" history-substring-search-down
|
||||
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
|
||||
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
|
||||
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
|
||||
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
|
||||
|
||||
# Finally, make sure the terminal is in application mode, when zle is
|
||||
# active. Only then are the values from $terminfo valid.
|
||||
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
|
||||
function zle-line-init () {
|
||||
printf '%s' "${terminfo[smkx]}"
|
||||
}
|
||||
function zle-line-finish () {
|
||||
printf '%s' "${terminfo[rmkx]}"
|
||||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
fi
|
4
home/.config/zsh/05-misc.zsh
Normal file
4
home/.config/zsh/05-misc.zsh
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Launch tmux if logging in over ssh
|
||||
if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then
|
||||
tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue