first commit

This commit is contained in:
2026-02-13 04:20:30 +01:00
commit 2bd6b181f4
159 changed files with 194785 additions and 0 deletions

148
profiles/base/.bashrc Normal file
View File

@@ -0,0 +1,148 @@
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# scripts from gentoo
# shellcheck source=.bashrc.d/10-gentoo-color-r2.bash
source "${HOME}/.bashrc.d/10-gentoo-color-r2.bash" # prompt
# shellcheck source=.bashrc.d/10-gentoo-title-r3.bash
source "${HOME}/.bashrc.d/10-gentoo-title-r3.bash"
# custom variables
if command -v nvim &> /dev/null; then
export EDITOR="nvim"
else
export EDITOR="vim"
fi
# export EDITOR="ec"
export VISUAL="${EDITOR}"
export SUDO_EDITOR="${EDITOR}"
export VIRSH_DEFAULT_CONNECT_URI="qemu:///system"
export BROWSER="chromium"
export PAGER="less -R -F"
export BAT_PAGER="${PAGER}"
export MANPAGER="less -R --use-color -Dd+r -Du+b"
[ -f "/usr/share/cowsay/cows" ] && export COWPATH="/usr/share/cowsay/cows"
export CHROOT="${HOME}/arch_chroot"
export AUR_REPO="whiteman808"
export AURDEST="${HOME}/.cache/paru/clone"
export AUR_PAGER="ranger"
export GPGKEY="4A45503BBE575E3D4DAF28E27264AFFDC98D52BB"
# color output
alias diff='diff --color=auto'
alias grep='grep --color=auto'
alias ip='ip -color=auto'
alias ls='ls --color=auto'
export MANROFFOPT="-P -c"
export LESS="-R --use-color -Dd+r\$Du+b\$"
# better ls
if type "eza" > /dev/null; then
alias ll='eza -bghHlS'
else
alias ll='exa -bghHlS'
fi
# bat (debian)
if type "batcat" >/dev/null 2>&1; then
alias bat='batcat'
fi
# HSTR configuration - add this to ~/.bashrc
alias hh=hstr # hh to be alias for hstr
export HSTR_CONFIG=hicolor # get more colors
shopt -s histappend # append new history items to .bash_history
export HISTCONTROL=ignorespace # leading space hides commands from history
export HISTFILESIZE=10000 # increase history file size (default is 500)
export HISTSIZE=${HISTFILESIZE} # increase history size (default is 500)
# ensure synchronization between bash memory and history file
export PROMPT_COMMAND=( "history -a; history -n;" "${PROMPT_COMMAND[@]}" )
function hstrnotiocsti {
{ READLINE_LINE="$( { </dev/tty hstr -- "${READLINE_LINE}"; } 2>&1 1>&3 3>&- )"; } 3>&1;
READLINE_POINT=${#READLINE_LINE}
}
# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)
if [[ $- =~ .*i.* ]]; then bind -x '"\C-r": "hstrnotiocsti"'; fi
export HSTR_TIOCSTI=n
# useful commands
alias ncmpcpp='ncmpcpp -b ~/.config/ncmpcpp/bindings'
alias tb='nc termbin.com 9999'
alias mux='tmuxinator'
alias tm='tmuxinator start misc'
alias tq='tmuxinator start quake'
alias sudo='sudo '
alias rsync_copy='rsync -aAXUHvh --partial-dir=.rsync-partial --progress'
alias rsync_copy_ssh='rsync_copy -e ssh'
alias rsync_backup='rsync_copy --numeric-ids --delete --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"}'
alias rsync_backup_ssh='rsync_backup -e ssh'
alias rsync_restore='rsync_copy --numeric-ids --delete --exclude="lost+found"'
alias rsync_restore_ssh='rsync_restore -e ssh'
alias glog='git log --oneline'
alias emerge_world='emerge --ask --verbose --deep --newuse --update @world'
alias sync_repo='rsync_copy_ssh --delete ~/arch_paczuchy/* vps.paraboletancza.org:/srv/http/arch.paraboletancza.org'
alias aur_sync='aur sync --sign --chroot'
alias aur_build='aur build --sign --chroot'
take() {
mkdir -p "$1"
cd "$1" || exit 1
}
# lf
lfwrapper() {
command lf "$@"
# cleanup
awk '$1 == "archivemount" { print $2 }' /etc/mtab | while read -r mntdir; do
sanitized_input="$(printf "${mntdir}")" # /etc/mtab uses octal representation of spaces (possible other symbols too), printf would convert octal representation, so that it can be used in the umount & rmdir commands.
umount "${sanitized_input}"
rmdir "${sanitized_input}"
done
}
lfcd() {
dir="$(lfwrapper -print-last-dir "$@")"
while ! cd "${dir}" 2>/dev/null; do
dir="$(dirname -- "${dir}")"
done
}
alias lf=lfcd
# ranger
ranger_cd() {
temp_file="$(mktemp -t "ranger_cd.XXXXXXXXXX")"
ranger --choosedir="${temp_file}" -- "${@:-${PWD}}"
if chosen_dir="$(cat -- "${temp_file}")" && [ -n "${chosen_dir}" ] && [ "${chosen_dir}" != "${PWD}" ]; then
cd -- "${chosen_dir}" || exit 1
fi
rm -f -- "${temp_file}"
}
alias ranger=ranger_cd
bind '"\C-o":"ranger\n"'
# mc
# shellcheck source=/dev/null
[[ -f "/usr/libexec/mc/mc.sh" ]] && source "/usr/libexec/mc/mc.sh"
[[ -f "/usr/lib/mc/mc.sh" ]] && source "/usr/lib/mc/mc.sh"
# gpg-agent
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket 2>/dev/null)"
export SSH_AUTH_SOCK
fi
# inside tmux, we don't know if Sway got restarted
if [[ -v TMUX ]]; then
swaymsg() {
SWAYSOCK=${XDG_RUNTIME_DIR}/sway-ipc.${UID}.$(pgrep -x sway).sock
export SWAYSOCK
command swaymsg "$@"
}
fi

View File

@@ -0,0 +1,78 @@
#!/usr/bin/env bash
# copied from https://gitweb.gentoo.org/repo/gentoo.git/tree/app-shells/bash
if [[ ${NO_COLOR} ]]; then
# Respect the user's wish not to use color. See https://no-color.org/.
gentoo_color=0
elif [[ ${COLORTERM@a} == *x* && ${COLORTERM} == @(24bit|truecolor) ]]; then
# The COLORTERM environment variable can reasonably be trusted here.
# See https://github.com/termstandard/colors for further information.
gentoo_color=1
else
# Check TERM against a whitelist covering a majority of popular
# terminal emulators and virtual console implementations known to
# support color. If no matching entry is found, try to use tput(1) to
# determine whether color is supported.
case ${TERM} in
*color* |\
*direct* |\
*ghostty |\
[Ekx]term* |\
alacritty |\
aterm |\
contour |\
dtterm |\
foot* |\
jfbterm |\
linux |\
mlterm |\
rxvt* |\
screen* |\
tmux* |\
wsvt25* ) gentoo_color=1 ;;
* ) gentoo_color=$(tput colors 2>/dev/null)
esac
fi
# For direxpand to be missing indicates that bash is lacking readline support.
prompt_exit_code() {
local -r exit_code=$?
if [[ ${exit_code} -ne 0 ]]; then
printf "%s " "${exit_code}"
fi
}
if (( gentoo_color <= 0 )) || ( ! shopt -u direxpand 2>/dev/null ); then
# Define a prompt without color.
PS1='\u@\h \w \$ '
elif (( EUID == 0 )); then
# If root, omit the username and print the hostname in red.
PS1='\[\e[01;31m\]\h\[\e[01;34m\] \w \$\[\e[00m\] '
else
# Otherwise, print the username and hostname in green.
PS1='\[\e[01;32m\]\u@\h\[\e[01;34m\] \[\e[01;31m\]$(prompt_exit_code)\[\e[01;34m\]\w \$\[\e[00m\] '
fi
if (( gentoo_color > 0 )); then
# Colorize the output of diff(1), grep(1) and a few coreutils utilities.
# However, do so only where no alias/function by the given name exists.
for _ in diff dir grep ls vdir; do
if [[ $(type -t "$_") == file ]]; then
alias "$_=$_ --color=auto"
fi
done
# Enable colors for ls(1) and some other utilities that respect the
# LS_COLORS variable. Prefer ~/.dir_colors, per bug #64489.
if hash dircolors 2>/dev/null; then
if [[ -f ~/.dir_colors ]]; then
eval "$(COLORTERM=1 dircolors -b -- ~/.dir_colors)"
elif [[ -f /etc/DIR_COLORS ]]; then
eval "$(COLORTERM=1 dircolors -b /etc/DIR_COLORS)"
else
eval "$(COLORTERM=1 dircolors -b)"
fi
fi
fi
unset -v gentoo_color

View File

@@ -0,0 +1,78 @@
#!/usr/bin/env bash
# copied from https://gitweb.gentoo.org/repo/gentoo.git/tree/app-shells/bash
# For information regarding the control sequences used, please refer to
# https://invisible-island.net/xterm/ctlseqs/ctlseqs.html.
genfun_set_win_title() {
# Advertise the fact that the presently running interactive shell will
# update the title. Doing so allows for its subprocesses to determine
# whether it is safe to set the title of their own accord. Note that 0
# refers to the value of Ps within the OSC Ps ; Pt BEL sequence.
export SHELL_SETS_TITLE=0
# Sets the window title with the Set Text Parameters control sequence.
# For screen, the sequence defines the hardstatus (%h) and for tmux, the
# pane_title (#T). For graphical terminal emulators, it is normal for
# the title bar to be affected.
genfun_set_win_title() {
local prompt
if [[ ${PROMPT_DIRTRIM} ]]; then
# Respect the value of PROMPT_DIRTRIM. If set as 0, the
# current working directory shall be shown in full.
prompt='\u@\h \w'
else
# Show the basename of the current working directory.
prompt='\u@\h \W'
fi
printf '\033]0;%s\007' "${prompt@P}"
}
genfun_set_win_title
}
unset -v SHELL_SETS_TITLE
# Determine whether the terminal can handle the Set Text Parameters sequence.
# The only terminals permitted here are those for which there is empirical
# evidence that the sequence is supported and that the UTF-8 character encoding
# is handled correctly. Quite rightly, this precludes many vintage terminals.
case ${TERM} in
alacritty*|contour|foot*|tmux*|xterm-ghostty)
# The terminal emulator also supports XTWINOPS. If the PTY was
# created by sshd(8) then push the current window title to the
# stack and arrange for it to be popped upon exiting. Xterm also
# supports this but there are far too many terminal emulators
# that falsely identify as being xterm-compatible.
if [[ ${SSH_TTY} && ${SSH_TTY} == "$(tty)" ]]; then
trap 'printf "\033[23;0t"' EXIT
printf '\033[22;0t'
fi
;;
rxvt-unicode*|st-256color|xterm*)
# If the PTY was created by sshd(8) then proceed no further.
# Alas, there exist many operating environments in which the
# title would otherwise not be restored upon ssh(1) exiting.
# Those wanting for the title to be set regardless may adjust
# ~/.bashrc or create a bashrc.d drop-in to set PROMPT_COMMAND.
# For example, PROMPT_COMMAND=(genfun_set_win_title).
if [[ ${SSH_TTY} && ${SSH_TTY} == "$(tty)" ]]; then
return
fi
;;
screen*)
# If the PTY was created by sshd(8) and screen(1) was launched
# prior to the SSH session beginning, as opposed to afterwards,
# proceed no further. It is another case in which there would be
# no guarantee of the title being restored upon ssh(1) exiting.
if [[ ! ${WINDOW} && ${SSH_TTY} && ${SSH_TTY} == "$(tty)" ]]; then
return
fi
;;
*)
return
esac
# Arrange for the title to be updated each time the primary prompt is displayed.
PROMPT_COMMAND+=('genfun_set_win_title')

20
profiles/base/.inputrc Normal file
View File

@@ -0,0 +1,20 @@
$include /etc/inputrc
set editing-mode vi
set keyseq-timeout 0.01
set show-mode-in-prompt on
$if mode=vi
set keymap vi-command
# these are for vi-command mode
"\e[A": history-search-backward
"\e[B": history-search-forward
j: history-search-forward
k: history-search-backward
"\C-l": clear-screen
set keymap vi-insert
# these are for vi-insert mode
"\e[A": history-search-backward
"\e[B": history-search-forward
"\C-l": clear-screen
$endif
set vi-ins-mode-string "\1\e[6 q\2(ins) "
set vi-cmd-mode-string "\1\e[4 q\2(cmd) "

View File

@@ -0,0 +1,85 @@
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
readonly SCRIPT_NAME="${0##*/}"
check_deps() {
command -v "curl" >/dev/null 2>&1 || die "curl: command not found"
}
usage() {
cat <<EOF
Usage: ${SCRIPT_NAME} [--family auto|4|6] [-h|--help]
Query an external service using curl and print:
1) public IP address
2) reverse DNS (PTR record)
3) curl version
Options:
--family auto|4|6 select IP protocol version (default: auto)
-h, --help show help and exit
EOF
}
shell_quote() {
local -r string="$1"
printf "'%s'" "${string//'/'\\''}"
}
die() {
local -r message="$1"
printf "%s: %b\n" "${SCRIPT_NAME}" "${message}" >&2
exit 1
}
invalid_option() {
local -r option="$1"
die "invalid option $(shell_quote "${option}")\nTry '${SCRIPT_NAME} --help' for usage."
}
parse_args() {
family="auto"
while (( $# > 0 )); do
case "$1" in
-h|--help) usage; exit 0 ;;
--family)
( (( $# < 2 )) || [[ -z "$2" ]] ) && die "--family requires an argument (auto, 4 or 6)"
family="$2"
shift 2
;;
--family=*)
family="${1#*=}"
[[ -z "${family}" ]] && die "--family requires an argument (auto, 4 or 6)"
shift
;;
*) invalid_option "$1" ;;
esac
done
validate_args
}
validate_args() {
case "${family}" in
auto|4|6) ;;
*) die "invalid value for family: '${family}' (expected auto, 4 or 6)"
esac
}
show_ip() {
local -a curl_args=()
[[ ${family} == "4" ]] && curl_args=( "-4" )
[[ ${family} == "6" ]] && curl_args=( "-6" )
curl "${curl_args[@]}" "zx2c4.com/ip"
}
main() {
check_deps
parse_args "$@"
show_ip
}
main "$@"

View File

@@ -0,0 +1,138 @@
#!/usr/bin/env bash
#usage: ./dnsleaktest.sh [-i interface_ip|interface_name]
#example: ./dnsleaktest.sh -i eth1
# ./dnsleaktest.sh -i 10.0.0.2
RED='\033[0;31m'
BOLD='\033[1m'
NC='\033[0m'
api_domain='bash.ws'
error_code=1
getopts "i:" opt
interface=$OPTARG
function echo_bold {
echo -e "${BOLD}${1}${NC}"
}
if [ -z "$interface" ]; then
curl_interface=""
ping_interface=""
else
curl_interface="--interface ${interface}"
ping_interface="-I ${interface}"
echo_bold "Interface: ${interface}"
echo ""
fi
function increment_error_code {
error_code=$((error_code + 1))
}
function echo_error {
(>&2 echo -e "${RED}${1}${NC}")
}
function require_command {
command -v $1 > /dev/null
if [ $? -ne 0 ]; then
echo_error "Please, install \"$1\""
exit $error_code
fi
increment_error_code
}
function check_internet_connection {
curl --silent --head ${curl_interface} --request GET "https://${api_domain}" | grep "200 OK" > /dev/null
if [ $? -ne 0 ]; then
echo_error "No internet connection."
exit $error_code
fi
increment_error_code
}
require_command curl
require_command ping
check_internet_connection
if command -v jq &> /dev/null; then
jq_exists=1
else
jq_exists=0
fi
id=$(curl ${curl_interface} --silent "https://${api_domain}/id")
for i in $(seq 1 10); do
ping -c 1 ${ping_interface} "${i}.${id}.${api_domain}" > /dev/null 2>&1
done
function print_servers {
if (( $jq_exists )); then
echo ${result_json} | \
jq --monochrome-output \
--raw-output \
".[] | select(.type == \"${1}\") | \"\(.ip)\(if .country_name != \"\" and .country_name != false then \" [\(.country_name)\(if .asn != \"\" and .asn != false then \" \(.asn)\" else \"\" end)]\" else \"\" end)\""
else
while IFS= read -r line; do
if [[ "$line" != *${1} ]]; then
continue
fi
ip=$(echo $line | cut -d'|' -f 1)
code=$(echo $line | cut -d'|' -f 2)
country=$(echo $line | cut -d'|' -f 3)
asn=$(echo $line | cut -d'|' -f 4)
if [ -z "${ip// }" ]; then
continue
fi
if [ -z "${country// }" ]; then
echo "$ip"
else
if [ -z "${asn// }" ]; then
echo "$ip [$country]"
else
echo "$ip [$country, $asn]"
fi
fi
done <<< "$result_txt"
fi
}
if (( $jq_exists )); then
result_json=$(curl ${curl_interface} --silent "https://${api_domain}/dnsleak/test/${id}?json")
else
result_txt=$(curl ${curl_interface} --silent "https://${api_domain}/dnsleak/test/${id}?txt")
fi
dns_count=$(print_servers "dns" | wc -l)
echo_bold "Your IP:"
print_servers "ip"
echo ""
if [ ${dns_count} -eq "0" ];then
echo_bold "No DNS servers found"
else
if [ ${dns_count} -eq "1" ];then
echo_bold "You use ${dns_count} DNS server:"
else
echo_bold "You use ${dns_count} DNS servers:"
fi
print_servers "dns"
fi
echo ""
echo_bold "Conclusion:"
print_servers "conclusion"
exit 0

View File

@@ -0,0 +1,8 @@
#!/bin/bash
shopt -s nullglob
for g in $(find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V); do
echo "IOMMU Group ${g##*/}:"
for d in ${g}/devices/*; do
echo -e "\t$(lspci -nns ${d##*/})"
done;
done;

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
transfer() (if [ $# -eq 0 ]; then printf "No arguments specified.\nUsage:\n transfer <file|directory>\n ... | transfer <file_name>\n">&2; return 1; fi; file_name=$(basename "$1"); if [ -t 0 ]; then file="$1"; if [ ! -e "$file" ]; then echo "$file: No such file or directory">&2; return 1; fi; if [ -d "$file" ]; then cd "$file" || return 1; file_name="$file_name.zip"; set -- zip -r -q - .; else set -- cat "$file"; fi; else set -- cat; fi; url=$("$@" | curl --silent --show-error --progress-bar --upload-file "-" "https://transfer.sh/$file_name"); echo "$url"; )
transfer

1712
profiles/base/.p10k.zsh Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
\.git
\.gitignore
\.gitmodules
.+~ # emacs backup files
\#.*\# # emacs autosave files
\.emacs.d/straight
\.emacs.d/eln-cache
^/hooks$
^/parent$
^/README.*
^/LICENSE.*
^/COPYING
^/install
^/pyproject.toml

106
profiles/base/.tmux.conf Normal file
View File

@@ -0,0 +1,106 @@
## user experience related stuff
# fix delay between switching modes in vim
set -sg escape-time 20
# remap prefix
unbind C-b
set -g prefix M-q
bind M-q send-prefix
# make colors display correctly
set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",*:RGB"
# set cursor style to underline
set -g cursor-style "underline"
# avoid setting cursor back to block after detaching tmux
set -ag terminal-overrides ",*:Se=\e[4 q"
# undercurl support
set -ag terminal-overrides ',*:Smulx=\E[4::%p1%dm'
# support colors for undercurl
set -ag terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
# set scrollback buffer to 10000
set -g history-limit 10000
# customize the status line
set -g status-fg colour2
set -g status-style bg=default
# disable mouse
set -g mouse off
# enable clipboard
set -g set-clipboard on
set -ag terminal-overrides ",*:clipboard"
# emacs keybindings
# set -g mode-keys emacs
# set -g status-keys emacs
# bind -Tcopy-mode C-w send -X copy-pipe-and-cancel 'xsel --clipboard --input'
# bind -Tcopy-mode M-w send -X copy-pipe-and-cancel 'xsel --clipboard --input'
# vi keybindings
set -g mode-keys vi
set -g status-keys vi
# copy & paste settings
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi V send -X select-line
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'wl-copy'
# status bar configuration
set -g status-right-length 100
set -g status-left-length 50
set -g status-right "#{pomodoro_status} #{@mode_indicator_suspend}#{?window_bigger,[#{window_offset_x}#,#{window_offset_y}] ,}\"#{=21:pane_title}\""
# urlscan
bind-key u run "tmux popup -E -b double -w 100% -h 40% -y 0 \
sh -c 'tmux capture-pane -Jp | urlscan -d -c' "
## tmux plugins related stuff
# list of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'MunifTanjim/tmux-suspend'
set -g @plugin 'rafi/tmux-pass'
set -g @plugin 'olimorris/tmux-pomodoro-plus'
# tmux-suspend
set -g @suspend_suspended_options " \
@mode_indicator_suspend::[*] "
set -g @suspend_key 'F12'
# tmux-pass
set -g @pass-copy-to-clipboard off
set -g @pass-hide-pw-from-preview on
set -g @pass-hide-preview on
# tmux-pomodoro-plus
set -g @pomodoro_on " 🍅 " # The formatted output when the Pomodoro is running
set -g @pomodoro_complete " ✔︎ " # The formatted output when the break is running
set -g @pomodoro_pause " ⏸︎ " # The formatted output when the Pomodoro/break is paused
set -g @pomodoro_prompt_break " ⏲︎ break?" # The formatted output when waiting to start a break
set -g @pomodoro_prompt_pomodoro " ⏱︎ start?" # The formatted output when waiting to start a Pomodoro
set -g @pomodoro_mins 25 # The duration of the Pomodoro
set -g @pomodoro_break_mins 5 # The duration of the break after the Pomodoro completes
set -g @pomodoro_intervals 4 # The number of intervals before a longer break is started
set -g @pomodoro_long_break_mins 25 # The duration of the long break
set -g @pomodoro_sound 'off' # Sound for desktop notifications (Run `ls /System/Library/Sounds` for a list of sounds to use on Mac)
set -g @pomodoro_notifications 'on' # Enable desktop notifications from your terminal
set -g @pomodoro_interval_display " [%s/%s]"
# automatically install tpm and tmux plugins when tmux is started
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# initialize tmux plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

View File

@@ -0,0 +1,4 @@
" set default tab width to 2 spaces
set tabstop=2 " number of spaces that a tab counts for
set shiftwidth=2 " size of an autoindented shift
set softtabstop=0 " indentation size

View File

@@ -0,0 +1 @@
set noexpandtab " use tabs instead of spaces

View File

@@ -0,0 +1,78 @@
let g:vim_tmux_clipboard#loadb_option = get(g:, 'vim_tmux_clipboard#loadb_option', '')
func! s:TmuxBufferName()
let l:list = systemlist('tmux list-buffers -F"#{buffer_name}"')
if len(l:list)==0
return ""
else
return l:list[0]
endif
endfunc
function! s:on_stdout(job_id, data, event)
let @" = join(a:data, "\n")
endfunction
func! s:AsyncTmuxBuffer()
call jobstart('tmux show-buffer', {'on_stdout': function('s:on_stdout'), 'stdout_buffered': 1})
endfunc
func! s:TmuxBuffer()
return system('tmux show-buffer')
endfunc
func! s:Enable()
if $TMUX==''
" not in tmux session
return
endif
let s:lastbname=""
" if support TextYankPost
if exists('##TextYankPost')==1
" @"
augroup vimtmuxclipboard
autocmd!
autocmd FocusLost * call s:update_from_tmux()
autocmd FocusGained * call s:update_from_tmux()
autocmd TextYankPost * silent! call system('tmux loadb ' . g:vim_tmux_clipboard#loadb_option . ' -',join(v:event["regcontents"],"\n"))
augroup END
if exists('*jobstart')==1 " Only supported on Neovim
call s:AsyncTmuxBuffer()
else
let @" = s:TmuxBuffer()
endif
else
" vim doesn't support TextYankPost event
" This is a workaround for vim
augroup vimtmuxclipboard
autocmd!
autocmd FocusLost * silent! call system('tmux loadb ' . g:vim_tmux_clipboard#loadb_option . ' -',@")
autocmd FocusGained * let @" = s:TmuxBuffer()
augroup END
let @" = s:TmuxBuffer()
endif
endfunc
func! s:update_from_tmux()
let buffer_name = s:TmuxBufferName()
if s:lastbname != buffer_name
let @" = s:TmuxBuffer()
endif
let s:lastbname=s:TmuxBufferName()
endfunc
call s:Enable()
" " workaround for this bug
" if shellescape("\n")=="'\\\n'"
" let l:s=substitute(l:s,'\\\n',"\n","g")
" let g:tmp_s=substitute(l:s,'\\\n',"\n","g")
" ");
" let g:tmp_cmd='tmux set-buffer ' . l:s
" endif
" silent! call system('tmux loadb -w -',l:s)

65
profiles/base/.vimrc Normal file
View File

@@ -0,0 +1,65 @@
" must have stuff
set nocompatible " use modern vim defaults
filetype plugin indent on
set autoindent
syntax on " highlight syntax
set number " display line numbers
" disable arrow keys
noremap <Up> <Nop>
noremap <Down> <Nop>
noremap <Left> <Nop>
noremap <Right> <Nop>
inoremap <Up> <Nop>
inoremap <Down> <Nop>
inoremap <Left> <Nop>
inoremap <Right> <Nop>
" set cursor shape to underline in the normal and command mode,
" in the insert mode change shape to vertical bar, and disable
" blinking in all modes
set guicursor=n-c:hor20
set guicursor+=i:ver20
set guicursor+=a:blinkon0
let &t_EI = "\e[4 q" " solid underscore
let &t_SI = "\e[6 q" " vertical bar
if has("autocmd") " reset cursor to underscore after I leave vim
augroup cursor
autocmd!
autocmd VimLeave * silent execute '!echo -ne "\e[4 q"' | redraw!
augroup END
endif
" fix delay when sending escape sequences from insert mode
set timeout
set timeoutlen=1000
set ttimeout
set ttimeoutlen=50
" set default tab width to 4 spaces
set tabstop=4 " number of spaces that a tab counts for
set shiftwidth=4 " number of spaces that are inserted during indent operations
set softtabstop=4 " number of spaces that are inserted after pressing tab
set expandtab " use spaces instead of tabs
" persistent undo
if has("persistent_undo")
let target_path = expand('~/.local/state/vim/undo')
" create the directory and any parent directories
" if the location does not exist.
call mkdir(target_path, "p", 0700)
let &undodir=target_path
set undofile
endif
" enable clipboard
if has("clipboard")
set clipboard=unnamedplus,unnamed
endif
" stuff related to editing html files
let g:html_indent_autotags = "html,thead,tbody,tfoot"
let g:html_indent_script1 = "auto"
let g:html_indent_style1 = "auto"

View File

@@ -0,0 +1,11 @@
# Set PATH environment variable
typeset -U path PATH
path=("${HOME}/.local/bin" "/usr/local/sbin" "/usr/local/bin" "/usr/sbin" "/sbin" "${path[@]}")
export PATH
# Configure shell history behavior
HISTFILE="${HOME}/.zsh_history"
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory
setopt HIST_IGNORE_SPACE

View File

@@ -0,0 +1,13 @@
# 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.
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
# plugins
source "${HOME}/.zsh/plugins/powerlevel10k/powerlevel10k.zsh-theme"
source "${HOME}/.zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"
# To customize prompt, run `p10k configure` or edit ~/.zsh/prompt/p10k.zsh.
[[ -f "${HOME}/.zsh/prompt/p10k.zsh" ]] && source "${HOME}/.zsh/prompt/p10k.zsh"

View File

@@ -0,0 +1,33 @@
# Enable vi keybindings
bindkey -v
export KEYTIMEOUT=1
autoload -z edit-command-line
zle -N edit-command-line
bindkey '^e' edit-command-line
# Fix backspace character behavior in vi mode
bindkey '^?' backward-delete-char
bindkey '^W' backward-kill-word
bindkey '^H' backward-delete-char # Control-h also deletes the previous char.
bindkey '^U' backward-kill-line
# Change cursor shape for different vi modes
zle-keymap-select() {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = "block" ]]; then
echo -ne '\e[4 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} == "" ]] ||
[[ $1 == "beam" ]]; then
echo -ne '\e[6 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[6 q'
}
zle -N zle-line-init
echo -ne '\e[6 q' # Use beam shape cursor on startup
preexec() { echo -ne '\e[6 q' } # Use beam shape cursor for each new prompt

View File

@@ -0,0 +1,14 @@
## Plugins configuration
# Completions
fpath=("${HOME}/.zsh/plugins/zsh-completions/src" "${fpath[@]}")
autoload -U compinit promptinit
compinit
promptinit
[[ -f "/etc/gentoo-release" ]] && prompt gentoo
# Enable cache for completions
zstyle ":completion::complete:*" use-cache 1
# Syntax highlighting in zsh prompt
source "${HOME}/.zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"

View File

@@ -0,0 +1,3 @@
# emacs specific stuff
[ -n "${EAT_SHELL_INTEGRATION_DIR}" ] && \
source "${EAT_SHELL_INTEGRATION_DIR}/zsh"

View File

@@ -0,0 +1,26 @@
# Set environment variables
if command -v nvim &> /dev/null; then
export EDITOR="nvim"
else
export EDITOR="vim"
fi
# export EDITOR="ec"
export VISUAL="${EDITOR}"
export SUDO_EDITOR="${EDITOR}"
export VIRSH_DEFAULT_CONNECT_URI="qemu:///system"
export BROWSER="chromium"
export PAGER="less -R -F"
export BAT_PAGER="${PAGER}"
export MANPAGER="less -R --use-color -Dd+r -Du+b"
[ -f "/usr/share/cowsay/cows" ] && export COWPATH="/usr/share/cowsay/cows"
export CHROOT="${HOME}/arch_chroot"
export AUR_REPO="whiteman808"
export AURDEST="${HOME}/.cache/paru/clone"
export AUR_PAGER="ranger"
export GPGKEY="4A45503BBE575E3D4DAF28E27264AFFDC98D52BB"
# gpg-agent
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket 2>/dev/null)"
fi

View File

@@ -0,0 +1,22 @@
alias diff="diff --color=auto"
alias grep="grep --color=auto"
alias ip="ip -color=auto"
alias ls="ls --color=auto"
export MANROFFOPT="-P -c"
export LESS='-R --use-color -Dd+r$Du+b$'
zmodload zsh/zpty
pty() {
zpty pty-${UID} ${1+$@}
if [[ ! -t 1 ]]; then
setopt local_traps
trap '' INT
fi
zpty -r pty-${UID}
zpty -d pty-${UID}
}
ptyless() {
pty $@ | less
}

View File

@@ -0,0 +1,101 @@
# HSTR configuration - add this to ~/.zshrc
if type "hstr" >/dev/null; then
alias hh=hstr # hh to be alias for hstr
setopt histignorespace # skip cmds w/ leading space from history
export HSTR_CONFIG=hicolor # get more colors
hstr_no_tiocsti() {
zle -I
{ HSTR_OUT="$( { </dev/tty hstr ${BUFFER}; } 2>&1 1>&3 3>&- )"; } 3>&1;
BUFFER="${HSTR_OUT}"
CURSOR=${#BUFFER}
zle redisplay
}
zle -N hstr_no_tiocsti
bindkey '\C-r' hstr_no_tiocsti
export HSTR_TIOCSTI=n
else
bindkey '\C-r' history-incremental-search-backward
fi
# better ls
if command -v "eza" >/dev/null 2>&1; then
alias ll="eza -bghHlS"
else
alias ll="exa -bghHlS"
fi
# bat (debian)
if command -v "batcat" >/dev/null 2>&1; then
alias bat="batcat"
fi
# lf
lfwrapper() {
command lf "$@"
# cleanup
awk '$1 == "archivemount" { print $2 }' /etc/mtab | while read -r mntdir; do
sanitized_input="$(printf "${mntdir}")" # /etc/mtab uses octal representation of spaces (possible other symbols too), printf would convert octal representation, so that it can be used in the umount & rmdir commands.
umount "${sanitized_input}"
rmdir "${sanitized_input}"
done
}
lfcd() {
dir="$(lfwrapper -print-last-dir "$@")"
while ! cd "${dir}" 2>/dev/null; do
dir="$(dirname -- "${dir}")"
done
}
alias lf=lfcd
# ranger
ranger_cd() {
temp_file="$(mktemp -t "ranger_cd.XXXXXXXXXX")"
ranger --choosedir="${temp_file}" -- "${@:-${PWD}}"
if chosen_dir="$(cat -- "${temp_file}")" && [ -n "${chosen_dir}" ] && [ "${chosen_dir}" != "${PWD}" ]; then
cd -- "${chosen_dir}"
fi
rm -f -- "${temp_file}"
}
alias ranger=ranger_cd
# mc
if [ -f "/usr/libexec/mc/mc.sh" ]; then
source "/usr/libexec/mc/mc.sh"
fi
# nix package manager
if [ -e "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]; then
source "${HOME}/.nix-profile/etc/profile.d/nix.sh"
fi # added by Nix installer
# nix shell
if command -v nix-your-shell >/dev/null 2>&1; then
nix-your-shell zsh | source /dev/stdin
fi
# node.js
export NVM_DIR="${HOME}/.nvm"
[ -s "${NVM_DIR}/nvm.sh" ] && source "${NVM_DIR}/nvm.sh" # This loads nvm
[ -s "${NVM_DIR}/bash_completion" ] && source "${NVM_DIR}/bash_completion" # This loads nvm bash_completion
# rvm
[ -s "${HOME}/.rvm/scripts/rvm" ] && source "${HOME}/.rvm/scripts/rvm"
# pyenv
export PYENV_ROOT="${HOME}/.pyenv"
if [[ -d "${PYENV_ROOT}/bin" ]]; then
path=("${PYENV_ROOT}/bin" "${path[@]}")
export PATH
eval "$(pyenv init - zsh)"
eval "$(pyenv virtualenv-init -)"
fi
# inside tmux, we don't know if Sway got restarted
if [[ -v TMUX ]]; then
swaymsg() {
export SWAYSOCK="${XDG_RUNTIME_DIR}/sway-ipc.${UID}.$(pgrep -x sway).sock"
command swaymsg "$@"
}
fi

View File

@@ -0,0 +1,17 @@
alias ncmpcpp="ncmpcpp -b ${HOME}/.config/ncmpcpp/bindings"
alias tb="nc termbin.com 9999"
alias mux="tmuxinator"
alias tm="tmuxinator start misc"
alias tq="tmuxinator start quake"
alias sudo="sudo "
alias rsync_copy="rsync -aAXUHvh --partial-dir=.rsync-partial --progress"
alias rsync_copy_ssh="rsync_copy -e ssh"
alias rsync_backup="rsync_copy --numeric-ids --delete --exclude={'/dev/*','/proc/*','/sys/*','/tmp/*','/run/*','/mnt/*','/media/*','/lost+found'}"
alias rsync_backup_ssh="rsync_backup -e ssh"
alias rsync_restore="rsync_copy --numeric-ids --delete --exclude='lost+found'"
alias rsync_restore_ssh="rsync_restore -e ssh"
alias glog="git log --oneline"
alias emerge_world="emerge --ask --verbose --deep --newuse --update @world"
alias sync_repo="rsync_copy_ssh --delete ~/arch_paczuchy/* vps.paraboletancza.org:/srv/http/arch.paraboletancza.org"
alias aur_sync="aur sync --sign --chroot"
alias aur_build="aur build --sign --chroot"

View File

@@ -0,0 +1,35 @@
take() {
local -r directory="$1"
mkdir -p "${directory}"
cd "${directory}"
}
# downloading from youtube
yt-dlp() {
local -a -r args=(
--cookies-from-browser "chromium:${HOME}/.local/share/qutebrowser"
--extractor-args "youtube:player_client=default,web_safari;player_js_version=actual"
--fragment-retries infinite
)
command yt-dlp "${args[@]}" "$@"
}
yt_dl_mp3() {
yt-dlp -t mp3 --embed-thumbnail "$@"
}
yt_dl_channel() {
local -a -r args=(
--download-archive "archive.txt"
--output "%(upload_date)s.%(title)s.%(id)s.%(ext)s"
--merge-output-format mkv
--ignore-errors
--write-sub
--sub-langs "en,pl"
--cookies-from-browser "chromium:${HOME}/.local/share/qutebrowser"
--write-description
--write-info-json
--write-thumbnail
)
yt-dlp "${args[@]}" "$@"
}

View File

@@ -0,0 +1 @@
bindkey -s '^o' 'ranger\n'

File diff suppressed because it is too large Load Diff

4
profiles/base/.zshrc Normal file
View File

@@ -0,0 +1,4 @@
# load zsh configuration
for file in "${HOME}/.zsh/conf.d/"*.zsh(N); do
source "${file}"
done