dotfiles/.zshrc

224 lines
7.1 KiB
Bash
Raw Normal View History

2020-05-08 05:10:34 +02:00
# Zgodovina ukazov
2016-12-17 01:22:06 +01:00
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=10000
2020-05-08 05:10:34 +02:00
# Vi zadeve, se mi zdi
2016-12-17 01:22:06 +01:00
bindkey -v
export KEYTIMEOUT=1
zstyle :compinstall filename '/home/g1smo/.zshrc'
autoload -Uz compinit
compinit
2020-05-08 05:10:34 +02:00
# Barve
2016-12-17 01:22:06 +01:00
autoload colors zsh/terminfo
colors
2020-01-11 00:47:01 +01:00
2020-05-08 05:10:34 +02:00
# BARVE!
export GREP_COLORS='1;32'
2020-05-08 05:10:34 +02:00
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
2016-12-17 01:22:06 +01:00
2020-08-04 17:07:00 +02:00
# PATH additions
export GOPATH=~/Sredstva/go
export PATH="/home/g1smo/bin:/home/g1smo/.cargo/bin:$GOPATH/bin:$PATH"
# Default term (i3)
#export TERMINAL="termite"
export TERMINAL="kitty"
export TERM="xterm-256color"
2022-06-16 16:26:11 +02:00
function man() {
LESS_TERMCAP_mb=$(printf "\e[1;35m") \
LESS_TERMCAP_md=$(printf "\e[1;34m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[7;40m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;33m") \
command man "$@"
2020-05-08 05:10:34 +02:00
}
function perldoc() { command perldoc -n less "$@" |man -l -; }
2016-12-17 01:22:06 +01:00
2020-05-08 05:10:34 +02:00
# Prompt za git
2016-12-17 01:22:06 +01:00
autoload -U promptinit
promptinit
autoload -Uz vcs_info
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' enable git svn hg
zstyle ':vcs_info:*' formats '(%b) '
precmd () {
vcs_info
}
setopt prompt_subst
PROMPT='%n@%m %1~ %{$fg[green]%}${vcs_info_msg_0_}%{$fg[blue]%}» %{$reset_color%}'
2020-08-04 17:07:00 +02:00
# Aliases
alias ls='ls --color=auto'
#alias vim='TERM=xterm-256color vim'
alias vi='vim'
alias sudo="sudo "
alias grep="grep --color=auto"
# Remove not-required-anymore packages
alias paclean="sudo pacman -R \$(pacman -Qdt | awk '{print \$1}')"
# List packages by size
alias pacsize="expac -H M '%m\t%n' | sort -h"
alias ffon="sudo cp /etc/resolv.conf.ff /etc/resolv.conf"
alias gitclean="git fetch -p && for branch in \$(git branch -vv | grep ': gone]' | gawk '{print \$1}'); do git branch -D \$branch; echo 'deleted \$branch'; done"
alias sctl="systemctl"
# Firefox scaling!
alias sf="find ~/.mozilla/firefox -name \"prefs.js\" -exec sed -ri 's/(devPixelsPerPx\\\", \\\")[0-9\\.]+/\\11\.00/' {} + ; firefox"
# regular firefox
alias ff="find ~/.mozilla/firefox -name \"prefs.js\" -exec sed -ri 's/(devPixelsPerPx\\\", \\\")[0-9\\.]+/\\11\.75/' {} + ; firefox"
2020-01-11 00:47:01 +01:00
# Reverse search shortcut
bindkey '^R' history-incremental-pattern-search-backward
2020-05-08 05:10:34 +02:00
# Splosno barvanje zadev
[[ -s "/etc/grc.zsh" ]] && source /etc/grc.zsh
# CCCAMP 2019 fahrplan
#camp() {
# curl -s https://fahrplan.events.ccc.de/camp/2019/Fahrplan/schedule.json \
# | jq -r '.schedule.conference.days | .[] | select(.date=="'$(date +%F)'") | .rooms | .[] | .[] | select(.date|strptime("%Y-%m-%dT%H:%M:%S%z") > now) | "\(.start) \(.duration)|\(.room)|\(.title)"' \
# | sort -V | column -t -s'|'
#}
# Aliasi
2023-07-10 23:14:40 +02:00
alias ll='ls -l'
alias grep='grep --color=auto'
2022-02-02 17:31:25 +01:00
alias ls='ls --color -C'
2016-12-17 01:22:06 +01:00
alias vi='vim'
2024-05-16 13:05:05 +02:00
alias sudo='sudo '
alias ag="rg"
2022-02-02 17:31:25 +01:00
alias less="less -R"
2020-05-08 05:10:34 +02:00
2016-12-17 01:22:06 +01:00
alias gitclean="git fetch -p && for branch in \$(git branch -vv | grep ': gone]' | gawk '{print \$1}'); do git branch -D \$branch; echo 'deleted \$branch'; done"
2018-03-23 05:12:23 +01:00
alias sctl="systemctl"
2020-01-11 00:47:01 +01:00
alias ddrush="ddev exec drush"
alias dcomposer="ddev exec composer"
2020-05-08 05:10:34 +02:00
alias offer-files="python3 -m http.server"
alias make-home="cd $HOME/sredstva/dotfiles; make guix-home"
2016-12-17 01:41:34 +01:00
2017-07-22 03:07:05 +02:00
# X on wayland
alias wxon="xhost +local:"
2017-05-03 03:54:47 +02:00
2020-01-11 00:47:01 +01:00
# Ljudmila
alias scdev="ssh culture@milci.ljudmila.org"
alias scnew="ssh culture@zala.ljudmila.org"
2020-01-11 00:47:01 +01:00
2017-10-13 03:37:11 +02:00
# Dolzina mp3 fajlov
alias mp3len="for i in \$(ls *.mp3); do echo \$i; soxi -d \$i; done"
# Hiter ping za net preverit
2020-01-11 00:47:01 +01:00
alias pg="ping 1.1.1.1"
2017-10-13 03:37:11 +02:00
# Najvecji fajli
alias najvecji="find . -printf '%s %p\n'| sort -nr | head -30"
2020-05-08 05:10:34 +02:00
# RŠ ssh
alias srs='f(){ ssh jurijp@$1.radiostudent.local };f'
alias srr='f(){ ssh root@$1.radiostudent.local };f'
alias rss='f(){ ssh jurijp@$1.radiostudent.si };f'
alias rsr='f(){ ssh root@$1.radiostudent.si };f'
alias rs='ssh radiostudent.si'
alias rr='ssh root@radiostudent.si'
2020-01-11 00:47:01 +01:00
2020-05-08 05:10:34 +02:00
# Poslusaj snemanje
alias poslusaj='pactl load-module module-loopback latency_msec=1'
alias tisina='pactl unload-module module-loopback'
2020-08-04 17:07:00 +02:00
# Guix guile things
#export GUILE_LOAD_PATH=$HOME/.guix-profile/share/guile/site/2.2:$GUILE_LOAD_PATH
#export GUILE_LOAD_COMPILED_PATH=$HOME/.guix-profile/lib/guile/2.2/site-ccache:$GUILE_LOAD_COMPILED_PATH
2022-06-16 16:26:11 +02:00
# Na prostem sajt(i)
alias nps='cd ~/ljudmila/naprostem/sajt'
alias np='f(){ ssh root@$1.na-prostem.si };f'
# Kill element
2021-09-29 21:48:08 +02:00
alias kill-element='kill $(ps aux | grep element | awk '\''{print $2;}'\'')'
2022-06-16 16:26:11 +02:00
alias kill-zoom='pkill zoom'
alias nmc='nmcli con up '
# OBS fix
#alias obs="QT_QPA_PLATFORM=xcb obs"
2021-09-29 21:48:08 +02:00
# Build deb pkg
#alias deb-build="dpkg-buildpackage -us -uc"
alias deb-build="dpkg-buildpackage -b -rfakeroot -us -uc"
alias run-gamma="pkill -f gammastep; sleep 3; screen -dm -- gammastep -m wayland -l 46.05108:14.50513"
2022-06-16 16:26:11 +02:00
# Spanje / nespanje
alias insomnia="sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target"
alias pocivanje="sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target"
alias lowdelay="PIPEWIRE_LATENCY=128/48000 "
# zvok prek mreze!
alias pulse-listen="pactl load-module module-native-protocol-tcp port=4656 listen="
alias pulse-connect="pactl load-module module-tunnel-sink server=tcp:${PULSEIP}:4656"
alias pulse-virtual-sink="pactl load-module module-null-sink media.class=Audio/Source/Virtual sink_name=my-virtualmic channel_map=front-left,front-right"
alias sardon="source $HOME/mska/sardine/venv/bin/activate"
alias powersave="sudo cpupower frequency-set -g powersave"
alias powerfull="sudo cpupower frequency-set -g ondemand"
alias imgcrop1920="mogrify -resize 1920x1920 "
alias ustvari-drupal="composer create-project drupal/recommended-project "
# Za LXD!
if command -v go &> /dev/null; then
export PATH="${PATH}:$(go env GOPATH)/bin"
fi
#export LD_LIBRARY_PATH="$(go env GOPATH)/deps/dqlite/.libs/:$(go env GOPATH)/deps/raft/.libs/:${LD_LIBRARY_PATH}"
# ??? fix crashanja
#export LD_LIBRARY_PATH="/lib/x86_64-linux-gnu:/lib/i386-linux-gnu"
2021-04-25 00:43:50 +02:00
# JS fix (prevec nov za openssl)
#export NODE_OPTIONS="--openssl-legacy-provider"
2021-12-15 14:58:03 +01:00
# Terminal podpora
alias termfix="TERM=rxvt-256color "
#export TERM=rxvt-256color
2024-05-16 13:05:05 +02:00
# Deli internet (iz wifi na eth)
alias share-internet="sudo iptables --table nat -A POSTROUTING --out-interface enp5s0 -j MASQUERADE && sudo iptables -A FORWARD --in-interface enp5s0 -j ACCEPT"
2024-05-16 13:05:05 +02:00
# Android studio in SDK
export ANDROID_HOME="$HOME/Android/Sdk"
export PATH=$PATH:$ANDROID_HOME/emulator
2024-05-16 13:05:05 +02:00
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
2024-05-16 13:05:05 +02:00
#export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin/
export PATH=$PATH:$HOME/android-studio/bin
export PATH=$PATH:/opt/gradle-8.7/bin
# Cargo!
export PATH=$HOME/.cargo/bin:$PATH
# CC = gcc
export CC=gcc
# Direnv
eval "$(direnv hook zsh)"
# Restart pipewire(debian)
alias restart-pipewire-debian="systemctl restart --user wireplumber pipewire pipewire-pulse"
function abeceda {
for x in {A..Z}; do; y=$(echo "$x" | tr '[:upper:]' '[:lower:]'); echo -e "\t$x\t$y"; done
}
function ajpi {
IPV4=$(curl -s 'https://api.ipify.org?format=json' | jq '.ip') && HOME_IPV4='"193.77.221.150"' && if [ "$HOME_IPV4" = "$IPV4" ]; then; echo "LIO: $IPV4"; else; printf 'ipv4: %s\n' "$IPV4"; fi && printf 'ipv6: %s\n' $(curl -s 'https://api64.ipify.org?format=json' | jq '.ip')
}