From a08a31ec298ec854700c43f637f3390baf0aa2b4 Mon Sep 17 00:00:00 2001 From: doman Date: Sat, 22 Jul 2023 14:46:26 +0200 Subject: [PATCH] initial commit --- .bashrc | 51 ++ .config/aliasrc/android.sh | 7 + .config/aliasrc/apple | 9 + .config/aliasrc/base | 3 + .config/aliasrc/cd.sh | 19 + .config/aliasrc/conda.sh | 14 + .config/aliasrc/convert_git_remote.sh | 7 + .config/aliasrc/fun | 3 + .config/aliasrc/nvm.sh | 13 + .config/aliasrc/personal | 53 ++ .config/aliasrc/programs | 61 ++ .config/aliasrc/snn.sh | 8 + .config/aliasrc/studies | 15 + .config/aliasrc/thinkpad | 4 + .config/aliasrc/work | 34 + .config/aliasrc/xclipimg.sh | 5 + .config/fasttyper/config.json | 1 + .config/kitty/kitty.conf | 39 ++ .config/kitty/theme.conf | 32 + .config/neofetch/config.conf | 864 ++++++++++++++++++++++++++ .config/pycodestyle | 3 + .inputrc | 3 + .tmux.conf | 30 + .vimrc | 155 +++++ .zshrc | 265 ++++++++ 25 files changed, 1698 insertions(+) create mode 100644 .bashrc create mode 100644 .config/aliasrc/android.sh create mode 100644 .config/aliasrc/apple create mode 100755 .config/aliasrc/base create mode 100644 .config/aliasrc/cd.sh create mode 100644 .config/aliasrc/conda.sh create mode 100644 .config/aliasrc/convert_git_remote.sh create mode 100755 .config/aliasrc/fun create mode 100644 .config/aliasrc/nvm.sh create mode 100755 .config/aliasrc/personal create mode 100755 .config/aliasrc/programs create mode 100644 .config/aliasrc/snn.sh create mode 100755 .config/aliasrc/studies create mode 100644 .config/aliasrc/thinkpad create mode 100755 .config/aliasrc/work create mode 100644 .config/aliasrc/xclipimg.sh create mode 100644 .config/fasttyper/config.json create mode 100644 .config/kitty/kitty.conf create mode 100644 .config/kitty/theme.conf create mode 100644 .config/neofetch/config.conf create mode 100644 .config/pycodestyle create mode 100644 .inputrc create mode 100644 .tmux.conf create mode 100755 .vimrc create mode 100755 .zshrc diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..0ba9179 --- /dev/null +++ b/.bashrc @@ -0,0 +1,51 @@ +# DOMAN bashrc + +# PS1 +export PS1="\e[0;31m[\e[m\e[0;33m\u\e[m\e[0;35m@\e[m\e[0;36m\h\e[m \e[0;35m\w\e[m\e[0;31m]\e[m\e[0;35m\\$\e[m \[$(tput sgr0)\]" + +# VIM mode +set -o vi + +# Load aliases and shortcuts if existent. +if [ -d "$HOME/.config/aliasrc" ]; then + for ALIASFILE in $(ls $HOME/.config/aliasrc); do + source "$HOME/.config/aliasrc/$ALIASFILE" + done +fi + +# IMPORTA +if [ ! -z "$(which nvim 2>/dev/null)" ]; then + export EDITOR=nvim +else + export EDITOR=vim +fi + +# must have function! +ex () +{ + if [ -f $1 ] ; then + case $1 in + *.tar.bz2) tar xjf $1 ;; + *.tar.gz) tar xzf $1 ;; + *.bz2) bunzip2 $1 ;; + *.rar) unrar x $1 ;; + *.gz) gunzip $1 ;; + *.tar) tar xf $1 ;; + *.tbz2) tar xjf $1 ;; + *.tgz) tar xzf $1 ;; + *.zip) unzip $1 ;; + *.Z) uncompress $1;; + *.7z) 7z x $1 ;; + *) echo "'$1' cannot be extracted via ex()" ;; + esac + else + echo "'$1' is not a valid file" + fi +} + +# exports +export PATH="$HOME/.local/bin:$HOME/.bin:$PATH" + +# run neofetch! +neofetch 2>/dev/null +. "$HOME/.cargo/env" diff --git a/.config/aliasrc/android.sh b/.config/aliasrc/android.sh new file mode 100644 index 0000000..b1166cc --- /dev/null +++ b/.config/aliasrc/android.sh @@ -0,0 +1,7 @@ +# android +function load_android() { + export ANDROID_SDK_ROOT=$HOME/Library/Android/Sdk + export ANDROID_HOME=$HOME/Library/Android/Sdk + export PATH="$HOME/Library/Android/Sdk/emulator:$PATH" + alias run_avd="emulator -avd $(emulator -list-avds | head --lines=1) -netdelay none -netspeed full" +} diff --git a/.config/aliasrc/apple b/.config/aliasrc/apple new file mode 100644 index 0000000..2a168b1 --- /dev/null +++ b/.config/aliasrc/apple @@ -0,0 +1,9 @@ +export PATH=/usr/local/opt/openvpn/sbin/:$PATH + +setupmac() { + defaults write com.apple.dock expose-animation-duration -float 0.1 + defaults write -g InitialKeyRepeat -int 12 + defaults write -g KeyRepeat -int 1 + defaults write com.apple.Dock autohide-delay -float 0; killall Dock + defaults write -g com.apple.mouse.scaling -integer -1 +} diff --git a/.config/aliasrc/base b/.config/aliasrc/base new file mode 100755 index 0000000..74d2449 --- /dev/null +++ b/.config/aliasrc/base @@ -0,0 +1,3 @@ +# managing aliases +alias aliases='cat ~/.config/aliasrc/*' +alias editalias='vim ~/.config/aliasrc' diff --git a/.config/aliasrc/cd.sh b/.config/aliasrc/cd.sh new file mode 100644 index 0000000..478fbb1 --- /dev/null +++ b/.config/aliasrc/cd.sh @@ -0,0 +1,19 @@ +function cd +{ + if [ $# -eq 0 ]; then + pushd ~ > /dev/null + elif [ " $1" = " -" ]; then + pushd "$OLDPWD" > /dev/null + else + pushd "$@" > /dev/null + fi +} + +function cdd +{ + if [ $# -eq 0 ]; then + cd - + else + cd +$1 + fi +} diff --git a/.config/aliasrc/conda.sh b/.config/aliasrc/conda.sh new file mode 100644 index 0000000..6c6e921 --- /dev/null +++ b/.config/aliasrc/conda.sh @@ -0,0 +1,14 @@ +# >>> conda initialize >>> +# !! Contents within this block are managed by 'conda init' !! +__conda_setup="$('/home/doman/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" +if [ $? -eq 0 ]; then + eval "$__conda_setup" +else + if [ -f "/home/doman/anaconda3/etc/profile.d/conda.sh" ]; then + . "/home/doman/anaconda3/etc/profile.d/conda.sh" + else + export PATH="/home/doman/anaconda3/bin:$PATH" + fi +fi +unset __conda_setup +# <<< conda initialize <<< diff --git a/.config/aliasrc/convert_git_remote.sh b/.config/aliasrc/convert_git_remote.sh new file mode 100644 index 0000000..05a2fc4 --- /dev/null +++ b/.config/aliasrc/convert_git_remote.sh @@ -0,0 +1,7 @@ +# converts old https remote to ssh +function convert_git_remote() { + local remote="${1:-origin}" + new_remote=$(git remote get-url ${remote} | sed 's/https:\/\/github.com\//git@github.com:/' | sed 's/$/.git/') + git remote set-url ${remote} ${new_remote} + echo "set ${remote} to ${new_remote}" +} diff --git a/.config/aliasrc/fun b/.config/aliasrc/fun new file mode 100755 index 0000000..7adfaa1 --- /dev/null +++ b/.config/aliasrc/fun @@ -0,0 +1,3 @@ +# fun +alias ='cat' +alias toansi='python3 $HOME/Projects/Personal/image-to-ansi/image-to-ansi.py' diff --git a/.config/aliasrc/nvm.sh b/.config/aliasrc/nvm.sh new file mode 100644 index 0000000..95c1dc2 --- /dev/null +++ b/.config/aliasrc/nvm.sh @@ -0,0 +1,13 @@ +# loadnvm +loadnvm() +{ + NVM_DIR="$HOME/.nvm" + if [ -d "$NVM_DIR" ]; then + export NVM_DIR="$NVM_DIR" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm + [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion + else + echo "$NVM_DIR does not exists" + fi +} + diff --git a/.config/aliasrc/personal b/.config/aliasrc/personal new file mode 100755 index 0000000..9d51b5b --- /dev/null +++ b/.config/aliasrc/personal @@ -0,0 +1,53 @@ +# Personal +alias my='cd ~/Projects/Personal' +alias ot='cd ~/Projects/Other' + +# KRAKEN +alias set_kraken='sudo colctl --fan_speed 40 --pump_speed 80 -m Breathing -c 255,255,255 -cc 2 -c0 255,255,255 -c1 0,0,0' +alias fast_kraken='sudo colctl --fan_speed 60 --pump_speed 90 -m Breathing -c 255,255,255 -cc 2 -c0 255,255,255 -c1 0,0,0' +alias max_kraken='sudo colctl --fan_speed 100 --pump_speed 100 -m Breathing -c 255,255,255 -cc 2 -c0 255,255,255 -c1 0,0,0' + +# sorter +alias srt='py /home/doman/Projects/Personal/folder_observer/observer.py -v --sort-old' + +# sync +alias syncpi='~/Projects/Personal/services/syncpi.sh' + +# reload vertical +alias rr="~/Projects/Personal/scripts/reload_vertical.sh" + +# resizer +alias res="python3 ~/Projects/Personal/scripts/resizer.py" + +# android scrcpy and sndcpy +alias andek="python3 ~/Projects/Personal/scripts/andek.py" + +# skirmish +alias skm="cd ~/Projects/Personal/skirmish-online" + +# xdg-open +[ "$(uname)" = "Darwin" ] || alias open='xdg-open' + +# stats +alias startstats='python /home/doman/Projects/Personal/scripts/stats.py' + +# fasttyper +alias ff='fasttyper' +fff () { + while true; do + fortune | python -c "import sys; print(sys.stdin.read().split('--')[0].strip())" | python -m fasttyper || break + done +} + +# genpswd +alias genpswd="python -c \"import random, pyperclip; pyperclip.copy(''.join([chr(random.randrange(40,127)) for _ in range(40)]))\"" + +# cds +alias cm="cd /run/media/${USER}/*/" +alias dwn="cd ${HOME}/Downloads" +alias dcs="cd ${HOME}/Documents" +alias pct="cd ${HOME}/Pictures" + +# killing +alias killq="gsettings set org.gnome.desktop.wm.keybindings close \"['q']\"" +alias nokillq="gsettings set org.gnome.desktop.wm.keybindings close \"['F13']\"" diff --git a/.config/aliasrc/programs b/.config/aliasrc/programs new file mode 100755 index 0000000..3de8318 --- /dev/null +++ b/.config/aliasrc/programs @@ -0,0 +1,61 @@ +# just for security and for fun because i have typing -rf every time +alias cp='cp -v' +alias mv='mv -v' +alias rm='rm -v' + +# program shortcuts +alias dc='docker-compose' +alias e='exit' +alias grep='grep --color=auto' +alias killdocker='docker kill $(docker ps -q)' +alias cleardocker='docker system prune && docker volume prune' +alias balancedocker='sudo btrfs filesystem balance /var/lib/docker' +alias ls='exa --icons -g' +alias ll='ls -lh' +alias lls='ls -lhrs modified' +alias la='ls -a' +alias lla='ls -lha' +alias l='ls' +alias py='python3' +alias py3='python3' +alias pip='python3 -m pip' +alias ipy='ipython --TerminalInteractiveShell.editing_mode=vi --TerminalInteractiveShell.timeoutlen=0.2' +alias vim='nvim' +alias v='vim' +alias vv='vifm' +if [ "$TERM" = "xterm-kitty" ]; then + alias kssh='kitty +kitten ssh' +fi + +# pacman and yay +alias spa='sudo pacman -S' +alias spaa='sudo pacman -S --overwrite="*"' +alias spu='sudo pacman -Syyuu' +alias spm='sudo pacman -Syy' +alias spr='sudo pacman -R' +alias ys='yay -S' +alias yss='yay -S --overwrite="*"' +alias yr='yay -R' +alias yu='yay -Syyuu' + +# brew +alias bu='brew update && brew update --cask' +alias bup='brew upgrade && brew upgrade --cask' +alias bd='brew doctor' +alias bp='brew pin' +alias bi='brew install' +alias bic='brew install --cask' + +# pandoc +alias npandoc='pandoc --from markdown --template ~/.config/pandoc/eisvogel.tex' + +# other +lst() { \ls --sort=time | head --lines=1; } +hlst() { history | tail --lines=1 | cut -d " " -f 4-; } +cpy() { python -c "import sys, pyperclip; pyperclip.copy(sys.stdin.read().strip())"; } +lstc() { lst | cpy; } +hlstc() { hlst | cpy; } + +# docker +alias startdocker='open -a Docker' +alias stopdocker="pkill -SIGHUP -f /Applications/Docker.app 'docker serve'" diff --git a/.config/aliasrc/snn.sh b/.config/aliasrc/snn.sh new file mode 100644 index 0000000..570bd78 --- /dev/null +++ b/.config/aliasrc/snn.sh @@ -0,0 +1,8 @@ +# scanning +function snn() { + local name="${1:-output}" + local format="${2:-png}" + local resolution="${3:-300}" + local fname=$name.$format + scanimage --format $format --progress --device "hpaio:/net/envy_6000_series?ip=192.168.0.45&queue=false" --output-file $fname --resolution $resolution +} diff --git a/.config/aliasrc/studies b/.config/aliasrc/studies new file mode 100755 index 0000000..3f9735e --- /dev/null +++ b/.config/aliasrc/studies @@ -0,0 +1,15 @@ +# Studies - Nextcloud +alias stu='cd ~/Nextcloud/Studia' +alias strak='stu && cd TRAK' +alias sinz='stu && cd INZ' +alias skoda='stu && cd KODA' +alias smgr='stu && cd MGR' +alias sporr='stu && cd PORR' +alias spti='stu && cd PTI' +alias strak='stu && cd TRAK' +alias saso='stu && cd ASO' + +# Studies - Projects +alias stud='cd ~/Projects/Studies' +alias eng='stud && cd eng' +alias mgr='stud && cd mgr' diff --git a/.config/aliasrc/thinkpad b/.config/aliasrc/thinkpad new file mode 100644 index 0000000..21458f5 --- /dev/null +++ b/.config/aliasrc/thinkpad @@ -0,0 +1,4 @@ +# thinkpad +alias fsize='gsettings set org.gnome.desktop.interface text-scaling-factor' +alias sfont='fsize "1.0"' +alias bfont='fsize "1.9"' diff --git a/.config/aliasrc/work b/.config/aliasrc/work new file mode 100755 index 0000000..609b0c5 --- /dev/null +++ b/.config/aliasrc/work @@ -0,0 +1,34 @@ +# Work directories +WORK="$HOME/Projects/Work" +UTIL="$HOME/Projects/Work/utility" +BPS="$HOME/Projects/Work/BPS" +PUB="$HOME/Projects/Work/publikator/" +PUBS="$HOME/Projects/Work/publikator/publikator_server" +PUBB="$HOME/Projects/Work/publikator/publikator_stable" +PUBO="$HOME/Projects/Work/publikator/publikator_oracle" +PUBC="$HOME/Projects/Work/publikator/publikator_cruz" +PUBG="$HOME/Projects/Work/publikator/publikator_barlinek" +AR="$HOME/Projects/Work/arriva_server/server" +ARD="$HOME/Projects/Work/arriva_server/arriva_android" +KOT="$HOME/Projects/Work/kotlin-base-server" +KRD="$HOME/Projects/Work/robots/krd_syncer" +NEG="$HOME/Projects/Work/negocjator/negocjator_server" +NEGO="$HOME/Projects/Work/negocjator/negocjator_ostrow" + +# Workflow +alias work="cd $WORK && make" +alias util="cd $UTIL && make" +alias bps="cd $BPS && make" +alias pub="cd $PUB" +alias pubs="cd $PUBS && source .venv/bin/activate && make" +alias pubb="cd $PUBB && make" +alias pubo="cd $PUBO && make" +alias pubc="cd $PUBC && make" +alias pubg="cd $PUBG && make" +alias ar="cd $AR && make" +alias arr="ar" +alias ard="cd $ARD" +alias kot="cd $KOT" +alias krd="cd $KRD" +alias neg="cd $NEG" +alias nego="cd $NEGO && source .venv/bin/activate && make" diff --git a/.config/aliasrc/xclipimg.sh b/.config/aliasrc/xclipimg.sh new file mode 100644 index 0000000..cc8bce3 --- /dev/null +++ b/.config/aliasrc/xclipimg.sh @@ -0,0 +1,5 @@ +xclipimg() { + filename=$1 + mimetype="$(file $1 -b --mime-type)" + xclip -selection clipboard -t $mimetype -i $filename +} diff --git a/.config/fasttyper/config.json b/.config/fasttyper/config.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.config/fasttyper/config.json @@ -0,0 +1 @@ +{} diff --git a/.config/kitty/kitty.conf b/.config/kitty/kitty.conf new file mode 100644 index 0000000..d0e5da1 --- /dev/null +++ b/.config/kitty/kitty.conf @@ -0,0 +1,39 @@ +include ./theme.conf + +scrollback_lines 2000 +wheel_scroll_multiplier 5.0 + +detect_urls yes +url_prefixes http https file ftp gemini irc gopher mailto news git + +# tabs management +map ctrl+shift+t new_tab + +map ctrl+shift+k next_tab +map ctrl+shift+j previous_tab + +map ctrl+shift+l move_tab_forward +map ctrl+shift+h move_tab_backward + +tab_bar_edge top + +enabled_layouts splits + +map ctrl+shift+y launch --location=hsplit --cwd=current +map ctrl+shift+u launch --location=vsplit --cwd=current +map ctrl+shift+i launch --location=split --cwd=current + +# resize windows +map ctrl+shift+r start_resizing_window + +# Move the active window in the indicated direction +map ctrl+shift+alt+k move_window up +map ctrl+shift+alt+h move_window left +map ctrl+shift+alt+l move_window right +map ctrl+shift+alt+j move_window down + +# Switch focus to the neighboring window in the indicated direction +map ctrl+alt+h neighboring_window left +map ctrl+alt+l neighboring_window right +map ctrl+alt+k neighboring_window up +map ctrl+alt+j neighboring_window down diff --git a/.config/kitty/theme.conf b/.config/kitty/theme.conf new file mode 100644 index 0000000..f6505ee --- /dev/null +++ b/.config/kitty/theme.conf @@ -0,0 +1,32 @@ +background #2b303b +background_opacity 0.75 +foreground #c0c5ce +cursor #7f7f7f +selection_background #c0c5ce +selection_foreground #2b303b + +color0 #2b303b +color1 #bf616a +color2 #a3be8c +color3 #ebcb8b +color4 #8fa1b3 +color5 #b48ead +color6 #96b5b4 +color7 #c0c5ce + +color8 #65737e +color9 #bf616a +color10 #a3be8c +color11 #ebcb8b +color12 #8fa1b3 +color13 #b48ead +color14 #96b5b4 +color15 #eff1f5 + +url_color #bf616a +url_style curly + +font_family Comic Mono +bold_font auto +italic_font auto +bold_italic_font auto diff --git a/.config/neofetch/config.conf b/.config/neofetch/config.conf new file mode 100644 index 0000000..fd29201 --- /dev/null +++ b/.config/neofetch/config.conf @@ -0,0 +1,864 @@ +# See this wiki page for more info: +# https://github.com/dylanaraps/neofetch/wiki/Customizing-Info +print_info() { + info title + info underline + + info "OS" distro + info "Host" model + # info "Kernel" kernel + # info "Uptime" uptime + # info "Packages" packages + # info "Shell" shell + # info "Resolution" resolution + # info "DE" de + # info "WM" wm + # info "WM Theme" wm_theme + # info "Theme" theme + # info "Icons" icons + # info "Terminal" term + # info "Terminal Font" term_font + info "CPU" cpu + # info "GPU" gpu + # info "Memory" memory + + # info "GPU Driver" gpu_driver # Linux/macOS only + # info "CPU Usage" cpu_usage + # info "Disk" disk + # info "Battery" battery + # info "Font" font + # info "Song" song + # [[ "$player" ]] && prin "Music Player" "$player" + # info "Local IP" local_ip + # info "Public IP" public_ip + # info "Users" users + # info "Locale" locale # This only works on glibc systems. + + info cols +} + +# Title + + +# Hide/Show Fully qualified domain name. +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --title_fqdn +title_fqdn="off" + + +# Kernel + + +# Shorten the output of the kernel function. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --kernel_shorthand +# Supports: Everything except *BSDs (except PacBSD and PC-BSD) +# +# Example: +# on: '4.8.9-1-ARCH' +# off: 'Linux 4.8.9-1-ARCH' +kernel_shorthand="on" + + +# Distro + + +# Shorten the output of the distro function +# +# Default: 'off' +# Values: 'on', 'tiny', 'off' +# Flag: --distro_shorthand +# Supports: Everything except Windows and Haiku +distro_shorthand="off" + +# Show/Hide OS Architecture. +# Show 'x86_64', 'x86' and etc in 'Distro:' output. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --os_arch +# +# Example: +# on: 'Arch Linux x86_64' +# off: 'Arch Linux' +os_arch="on" + + +# Uptime + + +# Shorten the output of the uptime function +# +# Default: 'on' +# Values: 'on', 'tiny', 'off' +# Flag: --uptime_shorthand +# +# Example: +# on: '2 days, 10 hours, 3 mins' +# tiny: '2d 10h 3m' +# off: '2 days, 10 hours, 3 minutes' +uptime_shorthand="on" + + +# Memory + + +# Show memory pecentage in output. +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --memory_percent +# +# Example: +# on: '1801MiB / 7881MiB (22%)' +# off: '1801MiB / 7881MiB' +memory_percent="off" + +# Change memory output unit. +# +# Default: 'mib' +# Values: 'kib', 'mib', 'gib' +# Flag: --memory_unit +# +# Example: +# kib '1020928KiB / 7117824KiB' +# mib '1042MiB / 6951MiB' +# gib: ' 0.98GiB / 6.79GiB' +memory_unit="mib" + + +# Packages + + +# Show/Hide Package Manager names. +# +# Default: 'tiny' +# Values: 'on', 'tiny' 'off' +# Flag: --package_managers +# +# Example: +# on: '998 (pacman), 8 (flatpak), 4 (snap)' +# tiny: '908 (pacman, flatpak, snap)' +# off: '908' +package_managers="on" + + +# Shell + + +# Show the path to $SHELL +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --shell_path +# +# Example: +# on: '/bin/bash' +# off: 'bash' +shell_path="off" + +# Show $SHELL version +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --shell_version +# +# Example: +# on: 'bash 4.4.5' +# off: 'bash' +shell_version="on" + + +# CPU + + +# CPU speed type +# +# Default: 'bios_limit' +# Values: 'scaling_cur_freq', 'scaling_min_freq', 'scaling_max_freq', 'bios_limit'. +# Flag: --speed_type +# Supports: Linux with 'cpufreq' +# NOTE: Any file in '/sys/devices/system/cpu/cpu0/cpufreq' can be used as a value. +speed_type="bios_limit" + +# CPU speed shorthand +# +# Default: 'off' +# Values: 'on', 'off'. +# Flag: --speed_shorthand +# NOTE: This flag is not supported in systems with CPU speed less than 1 GHz +# +# Example: +# on: 'i7-6500U (4) @ 3.1GHz' +# off: 'i7-6500U (4) @ 3.100GHz' +speed_shorthand="off" + +# Enable/Disable CPU brand in output. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --cpu_brand +# +# Example: +# on: 'Intel i7-6500U' +# off: 'i7-6500U (4)' +cpu_brand="on" + +# CPU Speed +# Hide/Show CPU speed. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --cpu_speed +# +# Example: +# on: 'Intel i7-6500U (4) @ 3.1GHz' +# off: 'Intel i7-6500U (4)' +cpu_speed="on" + +# CPU Cores +# Display CPU cores in output +# +# Default: 'logical' +# Values: 'logical', 'physical', 'off' +# Flag: --cpu_cores +# Support: 'physical' doesn't work on BSD. +# +# Example: +# logical: 'Intel i7-6500U (4) @ 3.1GHz' (All virtual cores) +# physical: 'Intel i7-6500U (2) @ 3.1GHz' (All physical cores) +# off: 'Intel i7-6500U @ 3.1GHz' +cpu_cores="logical" + +# CPU Temperature +# Hide/Show CPU temperature. +# Note the temperature is added to the regular CPU function. +# +# Default: 'off' +# Values: 'C', 'F', 'off' +# Flag: --cpu_temp +# Supports: Linux, BSD +# NOTE: For FreeBSD and NetBSD-based systems, you'll need to enable +# coretemp kernel module. This only supports newer Intel processors. +# +# Example: +# C: 'Intel i7-6500U (4) @ 3.1GHz [27.2°C]' +# F: 'Intel i7-6500U (4) @ 3.1GHz [82.0°F]' +# off: 'Intel i7-6500U (4) @ 3.1GHz' +cpu_temp="off" + + +# GPU + + +# Enable/Disable GPU Brand +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --gpu_brand +# +# Example: +# on: 'AMD HD 7950' +# off: 'HD 7950' +gpu_brand="on" + +# Which GPU to display +# +# Default: 'all' +# Values: 'all', 'dedicated', 'integrated' +# Flag: --gpu_type +# Supports: Linux +# +# Example: +# all: +# GPU1: AMD HD 7950 +# GPU2: Intel Integrated Graphics +# +# dedicated: +# GPU1: AMD HD 7950 +# +# integrated: +# GPU1: Intel Integrated Graphics +gpu_type="all" + + +# Resolution + + +# Display refresh rate next to each monitor +# Default: 'off' +# Values: 'on', 'off' +# Flag: --refresh_rate +# Supports: Doesn't work on Windows. +# +# Example: +# on: '1920x1080 @ 60Hz' +# off: '1920x1080' +refresh_rate="off" + + +# Gtk Theme / Icons / Font + + +# Shorten output of GTK Theme / Icons / Font +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --gtk_shorthand +# +# Example: +# on: 'Numix, Adwaita' +# off: 'Numix [GTK2], Adwaita [GTK3]' +gtk_shorthand="off" + + +# Enable/Disable gtk2 Theme / Icons / Font +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --gtk2 +# +# Example: +# on: 'Numix [GTK2], Adwaita [GTK3]' +# off: 'Adwaita [GTK3]' +gtk2="on" + +# Enable/Disable gtk3 Theme / Icons / Font +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --gtk3 +# +# Example: +# on: 'Numix [GTK2], Adwaita [GTK3]' +# off: 'Numix [GTK2]' +gtk3="on" + + +# IP Address + + +# Website to ping for the public IP +# +# Default: 'http://ident.me' +# Values: 'url' +# Flag: --ip_host +public_ip_host="http://ident.me" + +# Public IP timeout. +# +# Default: '2' +# Values: 'int' +# Flag: --ip_timeout +public_ip_timeout=2 + + +# Desktop Environment + + +# Show Desktop Environment version +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --de_version +de_version="on" + + +# Disk + + +# Which disks to display. +# The values can be any /dev/sdXX, mount point or directory. +# NOTE: By default we only show the disk info for '/'. +# +# Default: '/' +# Values: '/', '/dev/sdXX', '/path/to/drive'. +# Flag: --disk_show +# +# Example: +# disk_show=('/' '/dev/sdb1'): +# 'Disk (/): 74G / 118G (66%)' +# 'Disk (/mnt/Videos): 823G / 893G (93%)' +# +# disk_show=('/'): +# 'Disk (/): 74G / 118G (66%)' +# +disk_show=('/') + +# Disk subtitle. +# What to append to the Disk subtitle. +# +# Default: 'mount' +# Values: 'mount', 'name', 'dir', 'none' +# Flag: --disk_subtitle +# +# Example: +# name: 'Disk (/dev/sda1): 74G / 118G (66%)' +# 'Disk (/dev/sdb2): 74G / 118G (66%)' +# +# mount: 'Disk (/): 74G / 118G (66%)' +# 'Disk (/mnt/Local Disk): 74G / 118G (66%)' +# 'Disk (/mnt/Videos): 74G / 118G (66%)' +# +# dir: 'Disk (/): 74G / 118G (66%)' +# 'Disk (Local Disk): 74G / 118G (66%)' +# 'Disk (Videos): 74G / 118G (66%)' +# +# none: 'Disk: 74G / 118G (66%)' +# 'Disk: 74G / 118G (66%)' +# 'Disk: 74G / 118G (66%)' +disk_subtitle="mount" + +# Disk percent. +# Show/Hide disk percent. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --disk_percent +# +# Example: +# on: 'Disk (/): 74G / 118G (66%)' +# off: 'Disk (/): 74G / 118G' +disk_percent="on" + + +# Song + + +# Manually specify a music player. +# +# Default: 'auto' +# Values: 'auto', 'player-name' +# Flag: --music_player +# +# Available values for 'player-name': +# +# amarok +# audacious +# banshee +# bluemindo +# clementine +# cmus +# deadbeef +# deepin-music +# dragon +# elisa +# exaile +# gnome-music +# gmusicbrowser +# gogglesmm +# guayadeque +# io.elementary.music +# iTunes +# juk +# lollypop +# mocp +# mopidy +# mpd +# muine +# netease-cloud-music +# olivia +# playerctl +# pogo +# pragha +# qmmp +# quodlibet +# rhythmbox +# sayonara +# smplayer +# spotify +# strawberry +# tauonmb +# tomahawk +# vlc +# xmms2d +# xnoise +# yarock +music_player="auto" + +# Format to display song information. +# +# Default: '%artist% - %album% - %title%' +# Values: '%artist%', '%album%', '%title%' +# Flag: --song_format +# +# Example: +# default: 'Song: Jet - Get Born - Sgt Major' +song_format="%artist% - %album% - %title%" + +# Print the Artist, Album and Title on separate lines +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --song_shorthand +# +# Example: +# on: 'Artist: The Fratellis' +# 'Album: Costello Music' +# 'Song: Chelsea Dagger' +# +# off: 'Song: The Fratellis - Costello Music - Chelsea Dagger' +song_shorthand="off" + +# 'mpc' arguments (specify a host, password etc). +# +# Default: '' +# Example: mpc_args=(-h HOST -P PASSWORD) +mpc_args=() + + +# Text Colors + + +# Text Colors +# +# Default: 'distro' +# Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num' +# Flag: --colors +# +# Each number represents a different part of the text in +# this order: 'title', '@', 'underline', 'subtitle', 'colon', 'info' +# +# Example: +# colors=(distro) - Text is colored based on Distro colors. +# colors=(4 6 1 8 8 6) - Text is colored in the order above. +colors=(4 5 8 8 8 7 2) + + +# Text Options + + +# Toggle bold text +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --bold +bold="on" + +# Enable/Disable Underline +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --underline +underline_enabled="on" + +# Underline character +# +# Default: '-' +# Values: 'string' +# Flag: --underline_char +underline_char="." + + +# Info Separator +# Replace the default separator with the specified string. +# +# Default: ':' +# Flag: --separator +# +# Example: +# separator="->": 'Shell-> bash' +# separator=" =": 'WM = dwm' +separator=" ->" + + +# Color Blocks + + +# Color block range +# The range of colors to print. +# +# Default: '0', '15' +# Values: 'num' +# Flag: --block_range +# +# Example: +# +# Display colors 0-7 in the blocks. (8 colors) +# neofetch --block_range 0 7 +# +# Display colors 0-15 in the blocks. (16 colors) +# neofetch --block_range 0 15 +block_range=(0 15) + +# Toggle color blocks +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --color_blocks +color_blocks="on" + +# Color block width in spaces +# +# Default: '3' +# Values: 'num' +# Flag: --block_width +block_width=3 + +# Color block height in lines +# +# Default: '1' +# Values: 'num' +# Flag: --block_height +block_height=1 + +# Color Alignment +# +# Default: 'auto' +# Values: 'auto', 'num' +# Flag: --col_offset +# +# Number specifies how far from the left side of the terminal (in spaces) to +# begin printing the columns, in case you want to e.g. center them under your +# text. +# Example: +# col_offset="auto" - Default behavior of neofetch +# col_offset=7 - Leave 7 spaces then print the colors +col_offset="auto" + +# Progress Bars + + +# Bar characters +# +# Default: '-', '=' +# Values: 'string', 'string' +# Flag: --bar_char +# +# Example: +# neofetch --bar_char 'elapsed' 'total' +# neofetch --bar_char '-' '=' +bar_char_elapsed="-" +bar_char_total="=" + +# Toggle Bar border +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --bar_border +bar_border="on" + +# Progress bar length in spaces +# Number of chars long to make the progress bars. +# +# Default: '15' +# Values: 'num' +# Flag: --bar_length +bar_length=15 + +# Progress bar colors +# When set to distro, uses your distro's logo colors. +# +# Default: 'distro', 'distro' +# Values: 'distro', 'num' +# Flag: --bar_colors +# +# Example: +# neofetch --bar_colors 3 4 +# neofetch --bar_colors distro 5 +bar_color_elapsed="distro" +bar_color_total="distro" + + +# Info display +# Display a bar with the info. +# +# Default: 'off' +# Values: 'bar', 'infobar', 'barinfo', 'off' +# Flags: --cpu_display +# --memory_display +# --battery_display +# --disk_display +# +# Example: +# bar: '[---=======]' +# infobar: 'info [---=======]' +# barinfo: '[---=======] info' +# off: 'info' +cpu_display="off" +memory_display="off" +battery_display="off" +disk_display="off" + + +# Backend Settings + + +# Image backend. +# +# Default: 'ascii' +# Values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', 'off', +# 'pot', 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty' +# Flag: --backend +image_backend="ascii" + +# Image Source +# +# Which image or ascii file to display. +# +# Default: 'auto' +# Values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/' +# 'command output (neofetch --ascii "$(fortune | cowsay -W 30)")' +# Flag: --source +# +# NOTE: 'auto' will pick the best image source for whatever image backend is used. +# In ascii mode, distro ascii art will be used and in an image mode, your +# wallpaper will be used. +image_source="auto" + + +# Ascii Options + + +# Ascii distro +# Which distro's ascii art to display. +# +# Default: 'auto' +# Values: 'auto', 'distro_name' +# Flag: --ascii_distro +# NOTE: AIX, Alpine, Anarchy, Android, Antergos, antiX, "AOSC OS", +# "AOSC OS/Retro", Apricity, ArcoLinux, ArchBox, ARCHlabs, +# ArchStrike, XFerience, ArchMerge, Arch, Artix, Arya, Bedrock, +# Bitrig, BlackArch, BLAG, BlankOn, BlueLight, bonsai, BSD, +# BunsenLabs, Calculate, Carbs, CentOS, Chakra, ChaletOS, +# Chapeau, Chrom*, Cleanjaro, ClearOS, Clear_Linux, Clover, +# Condres, Container_Linux, CRUX, Cucumber, Debian, Deepin, +# DesaOS, Devuan, DracOS, DarkOs, DragonFly, Drauger, Elementary, +# EndeavourOS, Endless, EuroLinux, Exherbo, Fedora, Feren, FreeBSD, +# FreeMiNT, Frugalware, Funtoo, GalliumOS, Garuda, Gentoo, Pentoo, +# gNewSense, GNOME, GNU, GoboLinux, Grombyang, Guix, Haiku, Huayra, +# Hyperbola, janus, Kali, KaOS, KDE_neon, Kibojoe, Kogaion, +# Korora, KSLinux, Kubuntu, LEDE, LFS, Linux_Lite, +# LMDE, Lubuntu, Lunar, macos, Mageia, MagpieOS, Mandriva, +# Manjaro, Maui, Mer, Minix, LinuxMint, MX_Linux, Namib, +# Neptune, NetBSD, Netrunner, Nitrux, NixOS, Nurunner, +# NuTyX, OBRevenge, OpenBSD, openEuler, OpenIndiana, openmamba, +# OpenMandriva, OpenStage, OpenWrt, osmc, Oracle, OS Elbrus, PacBSD, +# Parabola, Pardus, Parrot, Parsix, TrueOS, PCLinuxOS, Peppermint, +# popos, Porteus, PostMarketOS, Proxmox, Puppy, PureOS, Qubes, Radix, +# Raspbian, Reborn_OS, Redstar, Redcore, Redhat, Refracted_Devuan, +# Regata, Rosa, sabotage, Sabayon, Sailfish, SalentOS, Scientific, +# Septor, SereneLinux, SharkLinux, Siduction, Slackware, SliTaz, +# SmartOS, Solus, Source_Mage, Sparky, Star, SteamOS, SunOS, +# openSUSE_Leap, openSUSE_Tumbleweed, openSUSE, SwagArch, Tails, +# Trisquel, Ubuntu-Budgie, Ubuntu-GNOME, Ubuntu-MATE, Ubuntu-Studio, +# Ubuntu, Venom, Void, Obarun, windows10, Windows7, Xubuntu, Zorin, +# and IRIX have ascii logos +# NOTE: Arch, Ubuntu, Redhat, and Dragonfly have 'old' logo variants. +# Use '{distro name}_old' to use the old logos. +# NOTE: Ubuntu has flavor variants. +# Change this to Lubuntu, Kubuntu, Xubuntu, Ubuntu-GNOME, +# Ubuntu-Studio, Ubuntu-Mate or Ubuntu-Budgie to use the flavors. +# NOTE: Arcolinux, Dragonfly, Fedora, Alpine, Arch, Ubuntu, +# CRUX, Debian, Gentoo, FreeBSD, Mac, NixOS, OpenBSD, android, +# Antrix, CentOS, Cleanjaro, ElementaryOS, GUIX, Hyperbola, +# Manjaro, MXLinux, NetBSD, Parabola, POP_OS, PureOS, +# Slackware, SunOS, LinuxLite, OpenSUSE, Raspbian, +# postmarketOS, and Void have a smaller logo variant. +# Use '{distro name}_small' to use the small variants. +ascii_distro="auto" + +# Ascii Colors +# +# Default: 'distro' +# Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num' +# Flag: --ascii_colors +# +# Example: +# ascii_colors=(distro) - Ascii is colored based on Distro colors. +# ascii_colors=(4 6 1 8 8 6) - Ascii is colored using these colors. +ascii_colors=(4 8 7 4 8 7) + +# Bold ascii logo +# Whether or not to bold the ascii logo. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --ascii_bold +ascii_bold="on" + + +# Image Options + + +# Image loop +# Setting this to on will make neofetch redraw the image constantly until +# Ctrl+C is pressed. This fixes display issues in some terminal emulators. +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --loop +image_loop="off" + +# Thumbnail directory +# +# Default: '~/.cache/thumbnails/neofetch' +# Values: 'dir' +thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch" + +# Crop mode +# +# Default: 'normal' +# Values: 'normal', 'fit', 'fill' +# Flag: --crop_mode +# +# See this wiki page to learn about the fit and fill options. +# https://github.com/dylanaraps/neofetch/wiki/What-is-Waifu-Crop%3F +crop_mode="normal" + +# Crop offset +# Note: Only affects 'normal' crop mode. +# +# Default: 'center' +# Values: 'northwest', 'north', 'northeast', 'west', 'center' +# 'east', 'southwest', 'south', 'southeast' +# Flag: --crop_offset +crop_offset="center" + +# Image size +# The image is half the terminal width by default. +# +# Default: 'auto' +# Values: 'auto', '00px', '00%', 'none' +# Flags: --image_size +# --size +image_size="auto" + +# Gap between image and text +# +# Default: '3' +# Values: 'num', '-num' +# Flag: --gap +gap=3 + +# Image offsets +# Only works with the w3m backend. +# +# Default: '0' +# Values: 'px' +# Flags: --xoffset +# --yoffset +yoffset=0 +xoffset=0 + +# Image background color +# Only works with the w3m backend. +# +# Default: '' +# Values: 'color', 'blue' +# Flag: --bg_color +background_color= + + +# Misc Options + +# Stdout mode +# Turn off all colors and disables image backend (ASCII/Image). +# Useful for piping into another command. +# Default: 'off' +# Values: 'on', 'off' +stdout="off" diff --git a/.config/pycodestyle b/.config/pycodestyle new file mode 100644 index 0000000..f338ae4 --- /dev/null +++ b/.config/pycodestyle @@ -0,0 +1,3 @@ +[pycodestyle] +max-line-length = 88 +ignore = E203,W503,E722,W293,W391 diff --git a/.inputrc b/.inputrc new file mode 100644 index 0000000..062813b --- /dev/null +++ b/.inputrc @@ -0,0 +1,3 @@ +set show-mode-in-prompt on +set vi-cmd-mode-string "\1\e[2 q\2" +set vi-ins-mode-string "\1\e[6 q\2" diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..31429b0 --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,30 @@ +set -g mouse on + +set -s escape-time 0 +set -g status-interval 0 + +set-option -g automatic-rename on +set-option -g automatic-rename-format '#{b:pane_current_path}' +set-option -g set-titles on +set-option -g set-titles-string "#T / #W" + +set-option -g history-limit 131072 + +setw -g mode-keys vi +bind -T copy-mode-vi v send -X begin-selection +bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy" +bind P paste-buffer +bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy" + +bind-key -n M-y copy-mode + +bind-key -n M-s split-window -h -c "#{pane_current_path}" +bind-key -n M-S split-window -v -c "#{pane_current_path}" +bind-key -n M-u swap-pane -s :+.top \; rotate-window -Ut :+ +bind-key -n M-h swap-pane -U +bind-key -n M-l swap-pane -D + +bind-key -n M-t new-window -c "#{pane_current_path}" +bind-key -n M-w kill-window +bind-key -n M-k next-window +bind-key -n M-j previous-window diff --git a/.vimrc b/.vimrc new file mode 100755 index 0000000..17da323 --- /dev/null +++ b/.vimrc @@ -0,0 +1,155 @@ +" Doman vimrc + +set nocompatible " required by Vundle +set encoding=utf-8 " for better polish letters +set number relativenumber " relative number - gamechanger +set clipboard=unnamedplus " to yank into clipboard easily +set ignorecase smartcase " set search to case insensitive +set undofile +filetype off " required by Vundle + +" set the runtime path to include Vundle and initialize +set rtp+=~/.vim/bundle/Vundle.vim + +" add all your plugins here +" VERY IMPORTANT +" BEFORE YOU INSTALL PLUGINS YOU NEED TO HAVE VIM PLUGGED +" PLUGIN MENAGER. TO INSTALL IT CLONE IT TO .vim/autoload/plug.vim: +" VIM_PLUG_INSTALL="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" +" curl -fLo ~/.vim/autoload/plug.vim --create-dirs ${VIM_PLUG_INSTALL} +" vim +PlugInstall +qall + +call plug#begin() +Plug 'sainnhe/edge' +Plug 'preservim/nerdtree' +Plug 'chriskempson/base16-vim' +Plug 'ryanoasis/vim-devicons' +Plug 'dense-analysis/ale' +call plug#end() + +if has("unix") + let s:uname = system("uname -s") + if s:uname == "Darwin" + set mouse=a + set alt_send_esc=true + endif +endif +" ... + +" All of your Plugins must be added before the following line +filetype plugin indent on " required + +" leader +let mapleader = "," + +" Specify areas where screen splits +set splitbelow +set splitright +set mouse=a + +" Enable folding +set foldmethod=indent +set foldlevel=99 +let g:xml_syntax_folding=1 +au FileType xml setlocal foldmethod=syntax + +" PEP8 indent +au BufNewFile,BufRead *.py,*.kt,*.c,*.cpp,*.h,*.hpp,*.cs + \ set tabstop=4 | + \ set softtabstop=4 | + \ set shiftwidth=4 | + \ set textwidth=0 | + \ set expandtab | + \ set autoindent | + \ set fileformat=unix + +" 2 space indent +au BufNewFile,BufRead *.js,*.html,*.css,*.scss,*.yaml,*.yml,*.xlm,*.json + \ set tabstop=2 | + \ set softtabstop=2 | + \ set shiftwidth=2 + +au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/ + +" better fold +let g:SimpylFold_docstring_preview=1 + +" Python syntax highlighting +let python_highlight_all=1 +syntax on + +" Theme config +" set termguicolors +let base16colorspace=256 +colorscheme base16-ocean + +" nerdtree settings +let NERDTreeIgnore=['\.pyc$', '\~$'] + +" FZF configuration +nnoremap :Files +nnoremap :Rg + +" open FZF if no file specified +autocmd StdinReadPre * let s:std_in=1 +autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | execute 'NERDTree' | wincmd l | endif +autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | execute 'NERDTree' argv()[0] | wincmd l | endif +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif + +" cursor +let &t_SI.="\e[5 q" "SI = INSERT mode +let &t_SR.="\e[4 q" "SR = REPLACE mode +let &t_EI.="\e[1 q" "EI = NORMAL mode (ELSE) + +" KEYBINDINGS AND MAPS +" redraws the screen and removes any search highlighting. +nnoremap :nohl + +" keybinding for nerdtree +map :NERDTreeToggle + +" Enable folding with the spacebar +nnoremap za + +" Moving between splits +nnoremap +nnoremap +nnoremap +nnoremap + +" delete without yanking +nnoremap d "_d +vnoremap d "_d + +" replace currently selected text with default register +" without yanking it +vnoremap p "_dP + +set signcolumn=yes +" ALE config +let g:ale_linters = { + \ 'python': ['pyls', 'flake8', 'mypy'], + \ 'cs': ['OmniSharp'], + \} + +let g:ale_fixers = { + \ '*': ['trim_whitespace'], + \ 'python': ['black'], + \ 'css': ['prettier'], + \ 'scss': ['prettier'], + \ 'html': ['prettier'], + \ 'javascript': ['prettier'], + \ 'json': ['prettier'], + \ 'php': ['prettier'], + \ 'yaml': ['prettier'], + \} + +" ale completion is really annoying +let g:ale_completion_enabled = 0 +let g:ale_completion_tsserver_autoimport = 0 +let g:ale_set_highlights = 0 +let g:ale_disable_lsp = 1 + +" ALE +nmap (ale_previous_wrap) +nmap (ale_next_wrap) diff --git a/.zshrc b/.zshrc new file mode 100755 index 0000000..4b44397 --- /dev/null +++ b/.zshrc @@ -0,0 +1,265 @@ +# DOMAN zshrc +# it requires two plugins and .cache/zsh folder. +# syntax-highlighting and sutosuggestions. +# To install them exec following: +# +# ZSH_SYNTAX_REPO="https://github.com/zsh-users/zsh-syntax-highlighting.git" +# ZSH_SUGGEST_REPO="https://github.com/zsh-users/zsh-autosuggestions" +# mkdir -p ~/.cache/zsh +# git clone ${ZSH_SUGGEST_REPO} ~/.zsh/zsh-autosuggestions +# git clone ${ZSH_SYNTAX_REPO} ~/.zsh/zsh-syntax-highlighting + + + +# Enable colors and change prompt. It also adds this little cute +# line with hg/git version if you cd into repository. +# Prompt changes if line is not wide enought! +autoload -U colors && colors +autoload -Uz vcs_info +precmd_vcs_info() { vcs_info } +precmd_functions+=( precmd_vcs_info ) +setopt prompt_subst +RPROMPT=\$vcs_info_msg_0_ + +NEWLINE=$'\n' +PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[magenta]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%(6~|...%3~|%~)%{$fg[red]%}]%{$fg[magenta]%}%-50(l:$ :$NEWLINE -> )%{$reset_color%}%b" + + +zstyle ':vcs_info:*' enable git hg svn +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:git*' formats "%{${fg[cyan]}%}[%{${fg[green]}%}%s%{${fg[cyan]}%}][%{${fg[blue]}%}%b%{${fg[yellow]}%}%m%u%c%{${fg[cyan]}%}]%{$reset_color%}" +zstyle ':vcs_info:hg*' formats "%{${fg[cyan]}%}[%{${fg[green]}%}%s%{${fg[cyan]}%}][%{${fg[blue]}%}%b%{${fg[yellow]}%}%m%u%c%{${fg[cyan]}%}]%{$reset_color%}" +zstyle ':vcs_info:svn*' formats "%{${fg[cyan]}%}[%{${fg[green]}%}%s%{${fg[cyan]}%}][%{${fg[blue]}%}%b%{${fg[yellow]}%}%m%u%c%{${fg[cyan]}%}]%{$reset_color%}" + +# Title +case $TERM in + termite|*xterm*|rxvt|rxvt-unicode|rxvt-256color|rxvt-unicode-256color|(dt|k|E)term|xterm-256color) + precmd () { + vcs_info + print -Pn "\e]0;[%n@%M][%~]%#\a" + } + preexec () { print -Pn "\e]0;[%n@%M][%~]%# ($1)\a" } + ;; + screen|screen-256color) + precmd () { + vcs_info + print -Pn "\e]83;title \"$1\"\a" + print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~]\a" + } + preexec () { + print -Pn "\e]83;title \"$1\"\a" + print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~] ($1)\a" + } + ;; +esac + +# History in cache directory: +HISTSIZE=100000 +SAVEHIST=100000 +HISTFILE=~/.cache/zsh/history +setopt HIST_IGNORE_ALL_DUPS +setopt INC_APPEND_HISTORY +setopt SHARE_HISTORY + +# Basic auto/tab complete: +autoload -U compinit +zstyle ':completion:*' menu select +zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + +zmodload zsh/complist +compinit +_comp_options+=(globdots) # Include hidden files. + +# create a zkbd compatible hash; +# to add other keys to this hash, see: man 5 terminfo +typeset -g -A key + +key[Home]="${terminfo[khome]}" +key[End]="${terminfo[kend]}" +key[Insert]="${terminfo[kich1]}" +key[Backspace]="${terminfo[kbs]}" +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]}" +key[Shift-Tab]="${terminfo[kcbt]}" + +# 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[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char +[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char +[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history +[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history +[[ -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 +[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete + +# Use vim keys in tab complete menu: +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'k' vi-up-line-or-history +bindkey -M menuselect 'l' vi-forward-char +bindkey -M menuselect 'j' vi-down-line-or-history + +# control k and j for moving in history as well +bindkey -v "^K" up-line-or-history +bindkey -v "^J" down-line-or-history + +# edit command line in VIM! +autoload -z edit-command-line +zle -N edit-command-line +bindkey -M vicmd v edit-command-line + +bindkey -v '^?' backward-delete-char +# Fix backspace bug when switching modes +bindkey "^?" backward-delete-char +bindkey "^[[3~" delete-char + +export KEYTIMEOUT=1 + +# Change cursor shape for different vi modes. +function zle-keymap-select { + if [[ ${KEYMAP} == vicmd ]] || + [[ $1 = 'block' ]]; then + echo -ne '\e[1 q' + + elif [[ ${KEYMAP} == main ]] || + [[ ${KEYMAP} == viins ]] || + [[ ${KEYMAP} = '' ]] || + [[ $1 = 'beam' ]]; then + echo -ne '\e[5 q' + fi +} +zle -N zle-keymap-select + +zle-line-init() { + zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) + echo -ne "\e[5 q" +} +zle -N zle-line-init + +# Use beam shape cursor on startup. +echo -ne '\e[5 q' +# Use beam shape cursor for each new prompt. +preexec() { echo -ne '\e[5 q' ;} + +# 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 + autoload -Uz add-zle-hook-widget + function zle_application_mode_start { echoti smkx } + function zle_application_mode_stop { echoti rmkx } + add-zle-hook-widget -Uz zle-line-init zle_application_mode_start + add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop +fi + +# Hisotry search +autoload -Uz up-line-or-beginning-search down-line-or-beginning-search +zle -N up-line-or-beginning-search +zle -N down-line-or-beginning-search + +[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-beginning-search +[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search + +# crtl + arrow +key[Control-Left]="${terminfo[kLFT5]}" +key[Control-Right]="${terminfo[kRIT5]}" + +[[ -n "${key[Control-Left]}" ]] && bindkey -- "${key[Control-Left]}" backward-word +[[ -n "${key[Control-Right]}" ]] && bindkey -- "${key[Control-Right]}" forward-word + +bindkey -v +bindkey '^R' history-incremental-search-backward +bindkey '\eOH' beginning-of-line +bindkey '\eOF' end-of-line + +# Load aliases and shortcuts if existent. +if [ -d "$HOME/.config/aliasrc" ]; then + for ALIASFILE in $(ls $HOME/.config/aliasrc); do + source "$HOME/.config/aliasrc/$ALIASFILE" + done +fi + +# IMPORTA +if [ ! -z "$(which nvim 2>/dev/null)" ]; then + export EDITOR=nvim +else + export EDITOR=vim +fi + +# must have function! +ex () +{ + if [ -f $1 ] ; then + case $1 in + *.tar.bz2) tar xjf $1 ;; + *.tar.gz) tar xzf $1 ;; + *.bz2) bunzip2 $1 ;; + *.rar) unrar x $1 ;; + *.gz) gunzip $1 ;; + *.tar) tar xf $1 ;; + *.tbz2) tar xjf $1 ;; + *.tgz) tar xzf $1 ;; + *.zip) unzip $1 ;; + *.Z) uncompress $1;; + *.7z) 7z x $1 ;; + *) echo "'$1' cannot be extracted via ex()" ;; + esac + else + echo "'$1' is not a valid file" + fi +} + +# load plugins +source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null +source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null + +# bind autossugest +bindkey '^ ' autosuggest-accept +bindkey '^l' autosuggest-accept + +# fzf settings +export FZF_DEFAULT_OPTS="--reverse --bind change:first --bind ctrl-j:down,ctrl-k:up -i --cycle --header-first --border rounded" + +# exports - local bin, python, brew +export PATH="$HOME/.local/bin:$HOME/.bin:/Users/doman/Library/Python/3.9/bin:$HOME/Projects/Personal/scripts:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/opt/libpq/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH" + +# mysql client on macos +export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH" +export LDFLAGS="-L/opt/homebrew/opt/mysql-client/lib" +export CPPFLAGS="-I/opt/homebrew/opt/mysql-client/include" +export PKG_CONFIG_PATH="/opt/homebrew/opt/mysql-client/lib/pkgconfig" + +# Base16 Shell +if ! {[ -n "$TMUX" ] || [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]}; then + BASE16_SHELL="$HOME/.config/base16-shell/" + source "$BASE16_SHELL/profile_helper.sh" 2>/dev/null + BASE16_SHELL_SET_BACKGROUND=false +fi + +if ! {[ -n "$TMUX" ] || [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]}; then + base16_ocean +fi + +cached_neofetch () +{ + # [ ! -z $HOME/.neofetch_cache ] && [ ! -z "$(which neofetch 2>/dev/null)" ] && neofetch > $HOME/.neofetch_cache + # cat $HOME/.neofetch_cache 2>/dev/null +} + +# run neofetch or tmux if available +if [ ! -z "$(which tmux 2>/dev/null)" ]; then + if [ -n "$TMUX" ] || [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + cached_neofetch + else + exec tmux + fi +else + cached_neofetch +fi