diff options
| author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-06 15:29:58 +0200 | 
|---|---|---|
| committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-06 15:29:58 +0200 | 
| commit | ad05cb18f03f3a97a918e090c38ba760147a0bb6 (patch) | |
| tree | 233097b3ccbf1a4fef18a291d0d8fda3fba34c03 | |
| parent | 1a7e35285abb5db60d2e1544ce0100e82c5d3490 (diff) | |
| parent | 511b6c1bc9acd9e6029d08a6c448f6e0037755fb (diff) | |
Merge branch 'main' of db:dotfiles
89 files changed, 1574 insertions, 1776 deletions
diff --git a/bin/extra/aivpn b/bin/extra/aivpn deleted file mode 100755 index aab90a8..0000000 --- a/bin/extra/aivpn +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -logn() { printf "%s\n" "$@"; } - -if [ "$1" = "-k" ] -then -	pgrep -f -- "ssh.*-L.*vm" | xargs kill -	exit -fi - -keyadd ehb/ai - -export SSH_ASKPASS="sshpass" -export SSH_ASKPASS_REQUIRE="prefer" -export PASSWORD="zot/qemu" - -logn "I: Waiting for connectivity..." -while ! ssh -o ConnectTimeout=1 -o BatchMode=yes vm 2>&1 | grep "Permission denied" > /dev/null -do sleep 1 -done - -logn "I: Activating vpn" -ssh vm "rasdial \"vpn.student.ehb.be\"" -ssh -f -N \ -	-L 2222:10.2.160.41:22 \ -	vm diff --git a/bin/extra/curszip b/bin/extra/curszip index 22453ae..64abdb6 100755 --- a/bin/extra/curszip +++ b/bin/extra/curszip @@ -2,7 +2,7 @@  list1() { find "$1" -mindepth 1 -maxdepth 1 -type "${2:-d}" -printf '%f\n'; } -curs="$(list1 ~/docs/school/Vakken | fzf)" +curs="$(list1 ~/docs/school/Vakken | commander -c)"  [ "$curs" ] || exit 1  zip="$(list1 ~/dl f | fzf -f "$curs" | grep '\.zip$')"  >&2 printf "curs: %s\n" "$curs" diff --git a/bin/extra/ehbvmvpn b/bin/extra/ehbvmvpn new file mode 100755 index 0000000..0d85b57 --- /dev/null +++ b/bin/extra/ehbvmvpn @@ -0,0 +1,53 @@ +#!/bin/sh + +err() { printf "%s\n" "$@"; } + +if [ -z "$1" ] || [ "$1" = "-h" ] +then +    >&2 cat <<EOF +-k kill ssh +-v vpn +-s ssh bindings +-h help +EOF +    exit 1 +fi + +if [ "$1" = "-k" ] +then +    shift +	pgrep -f -- "ssh.*-L.*vm" | xargs kill +fi + +export SSH_ASKPASS="sshpass" +export SSH_ASKPASS_REQUIRE="prefer" +export PASSWORD="zot/qemu" + +if [ "$1" = "-v" ] +then +    shift +    err "I: Waiting for connectivity..." +    while ! ssh -o ConnectTimeout=1 -o BatchMode=yes vm 2>&1 | grep "Permission denied" > /dev/null +    do sleep 1 +    done + +    err "I: Activating vpn" +    ssh vm "rasdial \"vpn.student.ehb.be\"" +fi + + +if [ "$1" = "-s" ] +then +    shift +    keyadd ehb/ai +    ssh -f -N \ +        -L 2222:10.2.160.41:22 \ +        vm + +    keyadd ehb/vm_int +    >&2 printf 'ssh forwardings for vms\n' +    ssh -f -N -L 2223:10.2.160.9:22 vm +    ssh -f -N -L 2224:10.2.160.10:22 vm +    ssh -f -N -L 2225:10.2.160.11:22 vm +    ssh -f -N -L 2226:10.2.160.51:22 vm +fi diff --git a/bin/extra/keyboards.txt b/bin/extra/keyboards.txt index 62e77de..db004ce 100644 --- a/bin/extra/keyboards.txt +++ b/bin/extra/keyboards.txt @@ -1,2 +1,2 @@  us -us -option ctrl:swapcaps -variant colemak +us -option ctrl:swapcaps,altwin:menu_win -variant colemak diff --git a/bin/extra/trl b/bin/extra/trl index ee42040..bd4c2c5 100755 --- a/bin/extra/trl +++ b/bin/extra/trl @@ -1,20 +1,8 @@  #!/bin/sh -# prints on stderr -log () { >&2 echo "$@"; } +# Translate words using http://context.reverso.net and scraping the answers +# with 'pup' and 'curl'. -help ()  -{ -	 >&2 cat <<-EOF -	  h         help -	  l         clear output -	  q         quit - -	  i         invert languages -	  p         select primary -	  s         select secondary -	EOF -}  # returns available languages  languages () {  	cat <<-EOF @@ -46,70 +34,25 @@ languages () {  	EOF  } -# translates a word -# $1: primary language -# $2: secondary language -# $3: word to translate -translate () -{ -	curl -s "https://context.reverso.net/translation/$1-$2/$3" \ -	--compressed \ -	-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0' \ -	-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' \ -	-H 'Accept-Language: en-US,en;q=0.5' \ -	-H 'Accept-Encoding: gzip, deflate, br' | -	pup 'a.link_highlighted em text{}' | -	sed 's/.*/\L&/' | -	sort | uniq | sed 's/.*/  &/' -} - -# prints the current language -current_language () -{ -	log "  current: $primary-$secondary" -} - -select_language () -{ -	tmp="$(languages | fzf)" -	[ "$tmp" ] && [ "$tmp" != "$primary" ] && [ "$tmp" != "$secondary" ] && -		eval "$1=\"$tmp\"" -	current_language -} - -# set default languages -primary=french -secondary=dutch - - -main () -{ -	current_language -	while true -	do -		log -n '>' -		read -r prompt  -		test $? -eq 1 && exit 0 # quit on ctrl-d -		case "$prompt" in -			q) break ;; -			l) clear ;; -			i) tmp="$secondary"; secondary="$primary"; primary="$tmp" -				current_language ;; -			h) help ;; # TODO -			p) select_language primary ;; -			s) select_language secondary ;; -			'') ;; -			*) translate "$primary" "$secondary" "$prompt" ;; -		esac -	done -} - - -if  [ "$1" = "--help"  ] || [ "$1" = "-h" ] +if [ -z "${word:=$1}" ]  then -	log "usage: trl" -	help -	exit +    >&2 printf '>' +    word="$(head -n1)"  fi - -main +[ "$word" ] || exit 1 + +primary="$(languages | fzf)" +[ "$primary" ] || exit 1 + +secondary="$(languages | fzf)" +[ "$secondary" ] || exit 1 + +curl -s "https://context.reverso.net/translation/$primary-$secondary/$word" \ +    --compressed \ +    -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0' \ +    -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' \ +    -H 'Accept-Language: en-US,en;q=0.5' \ +    -H 'Accept-Encoding: gzip, deflate, br' | +    pup 'a.link_highlighted em text{}' | +    sed 's/.*/\L&/' | +    sort | uniq | sed 's/.*/  &/' diff --git a/bin/extra/ytplay b/bin/extra/ytplay index b5c1a8c..66204c4 100755 --- a/bin/extra/ytplay +++ b/bin/extra/ytplay @@ -1,2 +1,4 @@  #!/bin/sh -yt-dlp -o - "$(ytlink)" | mpv - +url="$(ytlink)" +notify-send "playing: $url" & +yt-dlp -o - "$url" | mpv - diff --git a/bin/guiscripts/fillpass b/bin/guiscripts/fillpass index 358afd1..ea2246a 100755 --- a/bin/guiscripts/fillpass +++ b/bin/guiscripts/fillpass @@ -1,5 +1,11 @@  #!/bin/sh +if [ "colemak" = "$(setxkbmap -query | awk '/^variant:/ {print $2}')" ] +then +    cycleKB +    cycle=1 +fi +# assume we are using colemak  pass="$(  	find "${PASSWORD_STORE_DIR:=~/src/password-store/}" -name "*.gpg" |  	sed -e "s@$PASSWORD_STORE_DIR/@@" -e 's/\.gpg$//' | @@ -13,3 +19,5 @@ if [ "$login" ]  then printf '%s\t%s\n' "$login" "$password" | ydotool type -f -  else printf '%s\n' "$password" | ydotool type -f -  fi + +[ "$cycle" ] && cycleKB diff --git a/bin/guiscripts/lh b/bin/guiscripts/lh index ed5af47..ba39ec0 100755 --- a/bin/guiscripts/lh +++ b/bin/guiscripts/lh @@ -8,7 +8,6 @@  [ "${url:=$1}" ] || url="$(clipo)"  notify-send "linkhandler" "$url" -echo "$url" > ~/file.txt  case "$url" in      file://*)  diff --git a/bin/menuscripts/aumount b/bin/menuscripts/aumount new file mode 100755 index 0000000..8a2b785 --- /dev/null +++ b/bin/menuscripts/aumount @@ -0,0 +1,97 @@ +#!/bin/sh + +tmp="$(mktemp)" +test "$(id -u)" != "0" && sudo="sudo" + +logn () { >&2 printf "%s\n" "$@"; } +log () { >&2 printf '%s' "$@"; } + +# Read one character +read_char () +{ +	log ">" +	old_stty_cfg=$(stty -g) +	stty raw +	dd ibs=1 count=1 2> /dev/null +	stty "$old_stty_cfg" +	logn "" +} + +get_dev () { grep "^$1\." "$tmp" | cut -f 2- -d ' '; } + +# mount the device with $1 as the choice +mount () +{ +	dev="$(get_dev "$1")" +	test -z "$dev" && exit 1 + +	logn "Mounting /dev/$dev on /media/$dev" +	mkdir -p /media/"$dev" +	$sudo mount /dev/"$dev" /media/"$dev" > /dev/null 2>&1 || +		return 1 +} + +# umount the device with $1 as the choice +umount () +{ +	mountpoint="$(sed -n "${1}p" "$tmp" | awk '{print $3}')" +	test -z "$mountpoint" && exit 1 + +	logn "Unmounting $mountpoint" +	$sudo umount "$mountpoint" || +		return 1 +} + +ejekt () +{ +	dev="$(get_dev "$1" | sed 's/.$//')" +	test -z "$dev" && exit 1 + +	logn "Ejecting /dev/$dev" +	$sudo eject /dev/"$dev" > /dev/null 2>&1 || +		return 1 +} + +# print lsblk, use $1 to print only devices with mountpoints or without +pr_lsblk () +{ +	clear +	lsblk -o name,size,type,mountpoint +	logn "───────────────────────────────────" +	lsblk --ascii -o name,mountpoint | +		grep '^.-' | +		while read -r line +	do +		words="$(printf "%s" "$line" | wc -w)" +		test "$words" -eq "${1:-1}" && continue  +		printf "%s\n" "$line" +	done | +		cut -f 2- -d "-" | +		awk '{print NR ". " $0}' | +		tee "$tmp" >&2 +} + +cleanup () { rm -f "$tmp"; } + +trap cleanup EXIT INT + +logn "m(ount) u(mount) (e)ject ?" +choice="$(read_char)" + +case $choice in +	"m") i=2; cmd=mount ;; +	"u") i=1; cmd=umount ;; +	"e") i=2; cmd=ejekt ;; +	*) exit 1 ;; +esac + +pr_lsblk "$i" +choice="$(read_char)" +printf "%s" "$choice" | grep -q "[0-9]" || exit 1 + +if $cmd "$choice" +then +	logn "Successful." +else +	logn "Failed." +fi diff --git a/bin/menuscripts/commander b/bin/menuscripts/commander new file mode 100755 index 0000000..3f26429 --- /dev/null +++ b/bin/menuscripts/commander @@ -0,0 +1,261 @@ +#!/bin/sh + +# An attempt to unify usage of multiple launchers. +# MENUCMD must be set to the name of the lancher +# +# look at the last line to understand how it works + +### TODO +# instead of dynamic, provide a command to set width and height manually + +tmp="$(mktemp -u)" +export menuopts="" +TOFIRC="$HOME/.config/tofi/config" + +options=' +horizontal +height +center +input +instant +long +prompt +numbered +prefix +width' + +cleanup() { rm -f "$tmp"; } + +logn() { >&2 printf '%s\n' "$@"; } +die() { logn "$@"; exit 1; } + +help() { +	>&2 cat <<-EOF +	Usage: commander OPTIONS... + +	An attempt to regroup multiple launchers into one, +	it detects the value of the MENUCMD variable + +	try: +	MENUCMD=tofi commander < /etc/passwd + +	Options: +	  -h              Display items horizontally +	  -c              Display centered +	  -i              Take an input and return it to stdout +	  -p ARG          Prompt user with the specified argument +	  -l              Display in long list format +	  -n              Output the number of matches +	  -r              Select an executable from PATH +	  -1              Invert instant select on single match +	  -y ARG          Use specified height +	  -w ARG          Use specified width +	  -x              Invert prefix matching +	EOF +} + +add_option() { menuopts="$menuopts $*"; } +get_prop() { awk -F '=' "/$1 *=*/ {print \$2}" "$TOFIRC"; } + + +trap cleanup EXIT + +# Helper functions +case "$MENUCMD" in +	tofi) +		### Get a height based on a number of items +		# $1: max items count +		get_height() +		{ +			font_size="$(get_prop "font-size")" +			padding_top="$(get_prop "padding-top")" +			padding_bottom="$(get_prop "padding-bottom")" + +			printf "%s" "$(( +			font_size*2 + padding_top + padding_bottom + 2 + +			($1)*(font_size*2 - 2) +			))" + +		} +		### Get a width based on a maximum character length +		# $1: max character length +		get_width() +		{ +			font_size="$(get_prop "font-size")" +			padding_left="$(get_prop "padding-left")" +			padding_right="$(get_prop "padding-right")" +			printf "%s" "$(($1*(font_size-2) + 3 + padding_left + padding_right))" +		} ;; +	*) ;; +esac + + +main() +{ +	# shellcheck disable=SC2317 +	case "$MENUCMD" in +		tofi) +			center() { add_option "--anchor=center --width=252"; } + +			horizontal() { +				add_option "--horizontal=true --height=32" +				add_option "--result-spacing=12" +				add_option "--selection-background=#88c0d0" +				add_option "--selection-background-padding=6,4" +				add_option "--padding-top=0 --padding-bottom=0" +				add_option "--margin-top=4" +			} + +			long() { add_option "--width=100% --height=$(get_height 20)"; } + +			input() { +				add_option "--height=$(get_height 0) --width=$(get_width 24)" +				pre_filter() { cat /dev/null; } +			} + +			prefix() { add_option '--matching-algorithm=normal'; } + +			instant() { add_option "--auto-accept-single=false"; } + +			prompt() { add_option '--prompt-text' "$prompt_arg"; } + +			numbered() {  +				pre_filter() { awk '{print NR, $0}'; } +				post_filter() { awk '{print $1}'; } +			} + +			height() { add_option "--height=$(get_height "$height_arg")"; } +			width() { add_option "--width=$(get_width "$width_arg")"; } + +			run() { tofi-run $*; } + +			menucmd() { tofi "$@"; } ;; + +		dmenu) +			horizontal() { add_option "-l 0"; } + +			center() { add_option "-c"; } + +			long() { add_option "-l 20 -g 1"; } + +			input() { +				pre_filter() { cat /dev/null; } +			} + +			instant() { add_option "-n"; } + +			prefix() { add_option '-x -i'; } + +			prompt() { add_option '-p' "$prompt_arg"; } + +			numbered() { add_option "-px"; } + + +			height() { add_option "-l $height_arg"; } +			width() { add_option "-g $width_arg"; } + +			run() { dmenu_path | dmenu $*; } + +			menucmd() { dmenu $*; } ;; + +		fzf) +			center() { :; } +			horizontal() { :; } +			long() { :; } +			height() { :; } +			width() { :; } +			instant() { :; } +			prefix() { :; } + +			input() { +				pre_filter() { cat /dev/null; } +				add_option '--print-query' +			} + +			prompt() { add_option "--prompt" "$prompt_arg"; } + +			numbered() {  +				pre_filter() { awk '{print NR, $0}'; } +				add_option '--with-nth' '2..' +				post_filter() { awk '{print $1}'; } +			} + +			run() { +				IFS=: +				set -f +				find -L $PATH -type f -printf "%f\n" 2> /dev/null | sort -u | fzf $* +			} + +			menucmd() { fzf -0 -1 "$@"; } ;; + +		*) ;; +	esac + +	for option in $options +	do eval "$option=0" +	done + +	while getopts ":cdhilop:nr1w:xy:v" opt +	do +		# shellcheck disable=SC2034 +		case $opt in +			 +			# display horizontal +			h) horizontal=1 ;; +			# display centered +			c) center=1 ;; +			# take an input and return it on stdout +			i) input=1 ;; +			# adjust size and style dynamically +			p) prompt=1; prompt_arg="$OPTARG";; +			# long list format +			l) long=1 ;; +			# output number of match +			n) numbered=1 ;; +			# select an executable from PATH +			r) run=1 ;; +			# invert instant select on single match +			1) instant=1 ;; +			w) width=1; width_arg="$OPTARG" ;; +			# invert prefix matching +			x) prefix=1 ;; +			y) height=1; height_arg="$OPTARG" ;; + +			:) die "Option '-$OPTARG' requires an argument" ;; +			?) die "Invalid option: -$OPTARG" ;; +		esac +	done + +	# quit if stdin is empty +	[ -t 0 ] && [ "${run:-0}" -eq 0 ] && [ "$input" -eq 0 ] && help && exit 1 + +	# call options +	for option in $options +	do eval "test \"\$$option\" -eq 1" && $option +	done + +	if [ "$run" ]  +	then +		run "$menuopts"  +		exit +	fi + +	command -v pre_filter > /dev/null || pre_filter() { cat; } +	command -v post_filter > /dev/null || post_filter() { cat; } + +	! which "${MENUCMD:-fzf}" > /dev/null && die "MENUCMD '$MENUCMD' was not found." + +	if command -v pre_cmd > /dev/null +	then +		pre_cmd > "$tmp" +		logn "menuopts: $menuopts" +		# shellcheck disable=SC2086 +		pre_filter < "$tmp" | menucmd $menuopts | post_filter +	else +		logn "menuopts: $menuopts" +		# shellcheck disable=SC2086 +		pre_filter | menucmd $menuopts | post_filter +	fi +} + +main "$@" diff --git a/bin/menuscripts/ddl b/bin/menuscripts/ddl new file mode 100755 index 0000000..dd10af5 --- /dev/null +++ b/bin/menuscripts/ddl @@ -0,0 +1,88 @@ +#!/bin/sh + +# colors +red="$(printf '\033[31m')" +blue="$(printf '\033[34m')" +cyan_light="$(printf '\033[36m')" +yellow="$(printf '\033[33m')" +green="$(printf '\033[32m')" +italic="$(printf '\033[3m')" +reset="$(printf '\033[0m')" + +deadlines="$HOME/docs/filios"/deadlines + +die() { >&2 printf '%s\n' "$*"; exit 1; } +usage() +{ +    cat <<EOF +usage: ddl [COMMAND] [ARGUMENT] +        ddl                 lists deadlines +COMMANDS +        new TEXT...         add a new deadline +        coming [NUM]        show the nearest coming deadline(s) +        delete NUM          delete deadline by number +        grep REGEX          show deadlines matching regex +        help                show usage +        edit                edit file in \$EDITOR +EOF +    exit 1 +} +wrong_usage() { >&2 printf 'Wrong usage!\n'; usage; } + +colorize() +{ +    sed \ +        -e "s/^#.*/${red}&${reset}/" \ +        -e "s/^\s*[-?!*].*/${cyan_light}&${reset}/" \ +        -e "s/([^()]\+)/${yellow}${italic}&${reset}/" \ +        -e "s/^\s*#.*/${blue}${italic}&${reset}/" +} +list_deadlines() { cat "$deadlines"; } +# list dates in chronological order +list_dates() +{ +    grep '^#' "$deadlines" | +        sort -t '/' -k 3 -k 2 -k 1 -n |  +        uniq | +        sed 's@/@.@g' +} + + +# shellcheck disable=SC2142 + +### MAIN + +# Arguments without an option +case "$1" in +    h*) usage ;; + +    e*) $EDITOR "$deadlines" ;; + +    c*)  +        i=1 +        list_dates | head -n "${2:-1}" | +            while read -r date +                do +                    sed -n "/$date/,/^#\|^$/p" "$deadlines" |  +                        colorize | +                        sed "1s/.*/& ($green$i$reset)/" +                    i=$((i+1)) +                done ;; + +    "") list_deadlines | colorize ;; + +    *) false ;; + +esac && exit + +arg="$1" +shift +[ "$1" ] || wrong_usage + +case "$arg" in + +    d*) sed -i "/$(list_dates | sed -n "${1}p")/,/^$/d" "$deadlines" ;; + +    *) wrong_usage ;; + +esac diff --git a/bin/menuscripts/keyadd b/bin/menuscripts/keyadd new file mode 100755 index 0000000..12519ec --- /dev/null +++ b/bin/menuscripts/keyadd @@ -0,0 +1,62 @@ +#!/bin/sh + +log() +{ +	notify-send -t 1000 "keyadd" "$1" +	>&2 printf '%s\n' "$1" +} + +SSHFOLDER="$HOME/.ssh" + +# Test if can connect to ssh-agent +ssh-add -l > /dev/null 2>&1 +if [ $? -gt 1 ] # ignore if there are no identities +then +	log "Could not connect to agent." +	exit 1 +fi + +delete=0 +if [ "$1" = "-d" ]  +then +    delete=1 +    shift +fi + +if [ "$1" ] +then +    key_pretty="$1" +else +	key_pretty="$(find "$SSHFOLDER" -iname "*.pub" | +        sed "s@$SSHFOLDER/\(.*\)\.pub\$@\1@" | +        commander -xc)" +fi +[ "$key_pretty" ] || exit 1 +key="$SSHFOLDER/$key_pretty" + +if [ ! -f "$key" ]  +then +    log "No key found at: $key" +    exit 1 +fi + +if [ "$delete" -eq 1 ] +then +	ssh-add -q -d - < "$key".pub 2> /dev/null && +		log "Deleted $key_pretty." || +		log "Could not delete." +    exit +fi + +# check if key is already added +if ssh-add -l | grep -q "$(ssh-keygen -lf "$key")" +then +	log "Key already added." +    exit 1 +fi + +HOST=$(hostnamectl hostname) +export PASSWORD="keys/$HOST/ssh/$key_pretty" +export SSH_ASKPASS="sshpass" +ssh-add -q - < "$key" && +    log "Added $key_pretty." diff --git a/bin/menuscripts/mmedia b/bin/menuscripts/mmedia new file mode 100755 index 0000000..63d3f7b --- /dev/null +++ b/bin/menuscripts/mmedia @@ -0,0 +1,59 @@ +#!/usr/bin/env sh + +tmp="/tmp/mmedia" + +dirs="$HOME/dl" + +concat_path() { sed "s#^$HOME#\~#;s#\([^/]\)[^/]*/#\1/#g"; } + +case "$1" in  +	"video")  +		regex='^.\+\.\(webm\|mp4\|mpeg\|mkv\)$'  +		dirs="$dirs $HOME/vids" +		viewer() { $PLAYER "$1"; } ;; +	"pdf")  +		regex='^.\+\.\(pdf\)$'  +		dirs="$dirs $HOME/docs" +		viewer() { $VIEWER "$1"; } ;; +	"image") +		regex='^.\+\.\(png\|avif\|jpg\)$'  +		dirs="$dirs $HOME/pics" +		viewer() { $IMAGE "$1"; } ;; +	"cursus") +		regex='^.*/[cC]ursus/index.html$' +		dirs="$HOME/docs/school/Vakken" +		concat_path() { sed "s#$dirs/##;s#/[cC]ursus/index.html##"; } +		viewer() { $BROWSER "$1"; } ;; +	"schoolpdf") +		regex='^.\+\.\(pdf\)$'  +		dirs="$HOME/docs/school/Vakken" +		concat_path() { sed "s#$dirs/##;s#/[cC]ursus/index.html##;s#/Cursus/viewer/files/#: #"; } +		viewer() { $VIEWER "$1"; } ;; +	*)  +		choice="$(cat <<-EOF | dmenu -g 5 -l 1 -c +		video +		pdf +		image +		cursus +		schoolpdf +		EOF +		)" +		[ "$choice" ] || exit 1 +		"$0" "$choice" +		exit ;; +esac + +shift +[ "$1" ] && dirs="$1" + +choice="$( +	find -L $dirs 2> /dev/null | +	grep "$regex" | +	sort | tee "$tmp" | +	concat_path | +	dmenu -px -c -n -x -l 10 -g 1 -F)" + +file="$(sed -n "${choice}p" "$tmp")" +[ -r "$file" ] || exit 1 + +viewer "$file" diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass new file mode 100755 index 0000000..7029ffe --- /dev/null +++ b/bin/menuscripts/mpass @@ -0,0 +1,27 @@ +#!/usr/bin/env sh +store="${PASSWORD_STORE_DIR:-$HOME/.password-store}" + +# list passwords, group directories first +list_pswds() +{ +	find "$1" \ +		-maxdepth 1 -mindepth 1 \ +		-not -name '.*' -type d -printf "%y\t%f\n" -o \ +		-not -name '.*' -not -type d -printf "%y\t%f\n" | +		sort -k1 -k2 | +		cut -f 2 | sed 's/\.gpg$//' +} + +while [ -d "$store/$file" ] +do +	choice="$(list_pswds "$store/$file" | commander -c)" +	[ "$choice" ] || exit 1 +	[ -z "$file" ] && file="$choice" || file="$file/$choice" +done +[ "$file" ] || exit 1 + +pass show -c "$file" || exit 1 +notify-send -t 1000 "mpass" "copied <b>$file</b>" + +[ "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null && # on wayland and cliphist is running +	cliphist list | head -n 1 | cliphist delete diff --git a/bin/menuscripts/mplay b/bin/menuscripts/mplay new file mode 100755 index 0000000..57af631 --- /dev/null +++ b/bin/menuscripts/mplay @@ -0,0 +1,76 @@ +#!/bin/sh + +MUSIC="$HOME/music" + + +list_dirs() +{ +	find -L "$1" \ +		-mindepth 1 -maxdepth 1 \ +		-not -name "*.cue" | +		sed "s@^$1/@@" | sort; +} + +find_song() +{ +	file="$MUSIC" +	while [ -d "$file" ] +	do  +		choice="$(list_dirs "$file" | commander -clx)" +		[ "$choice" ] || return +		file="$file/$choice" +	done +	printf '%s' "${file##"$MUSIC/"}" +} + +play_song() +{ +	printf '%s\n' "$1" | tr '\n' '\0' | +		xargs -0I{} mpc insert "{}" || return +	mpc next 2> /dev/null +	mpc play 2> /dev/null +} + +main() +{ +	choice="$(printf 'volume\nsearch\ncommand\nall_search\nquit' | commander -c -w 5 -y 1)" +	case "$choice" in +		volume)  +			# Change volume while no error +			while true  +			do +				volume="$(mpc volume | awk -F '[ %]' '{print $2}')" +				nb="$(printf 'p\nm' | commander -c -y 2 -p "$volume" | tr 'pm' '+-')" +				[ "$nb" ] || break +				change="$(commander -ci -p "$volume$nb")" +				mpc volume "$nb$change" || break +			done ;; + +		search)  +			song="$(find_song)" +			[ "$song" ] || return + +			choice="$(printf 'insert\nadd\nplay' | commander -c -w 3 -y 1)" +			case "$choice" in +				insert|add) mpc "$choice" "$song" ;; +				play) play_song "$song" ;; +			esac ;; + +		command)  +			mpc "$(printf 'next\nprevious\nclear\nstop\ntoggle' | +				commander -c -w 8 -y 5)" ;; + +		all_search)  +			song="$(mpc listall | commander -cxh)" +			[ "$song" ] || return +			play_song "$song";; +		quit) return 1 ;; + +		*) return 1 ;;  +	esac +	return 0 +} + +while main +do :; +done diff --git a/bin/menuscripts/muzrname b/bin/menuscripts/muzrname new file mode 100755 index 0000000..3f63aff --- /dev/null +++ b/bin/menuscripts/muzrname @@ -0,0 +1,22 @@ +#!/bin/sh + +rename() +{ +	## Expression 1: +	# For CDs or volumes 1-01 -> 1_01 +	## Expression 2: +	# * don't match the start (^) +	# match the first part with a number and replace following [ -.] by '. ' +	sed -e 's/^\s*\([0-9]\+\)[ -_.]\([0-9]\+\)/\1_\2. /' \ +		-e 's#\s*\([0-9]\+\)[ -.]\+#\1. #' +} + +if [ ! -t 0 ] +then  +	rename +elif [ "$1" ] +then  +	printf '%s' "$1" | rename +else +	exit 1 +fi diff --git a/bin/menuscripts/pomo b/bin/menuscripts/pomo new file mode 100755 index 0000000..e8795e7 --- /dev/null +++ b/bin/menuscripts/pomo @@ -0,0 +1,78 @@ +#!/bin/sh + +### FUNCTIONS +notif() {  +    herbe "pomo" "$1" & +    sleep 1 +    pkill -SIGUSR1 herbe +} +logn () { >&2 printf '%s\n' "$@"; } +log () { >&2 printf '%s' "$@"; } + +# Plays ringing sound +# Then wait for user input to start/end the break +player_command() +{ +	>&2 printf ' > ' +	[ -r "$ringSound" ] || PLAYER="" +	case "$PLAYER" in +	    mpv) mpv --loop --msg-level=all=no "$ringSound" ;; +	    "") head -n 1;; +	    *) $PLAYER "$ringSound" ;; +	esac +} + +# $1: time in minutes +# $2: msg for notification +ring_ring() +{ +	logn "$(date '+%R') B $round" +	player_command +    herbe "pomo" "$2" & +    sleep "${1}m" +	player_command +	>&2 printf '\n' +} + +### PROGRAM +main() +{ +	round="${1-0}" +	case "$round" in +		0|1|2|3) ;; +		ring) ;; +		*) logn "Invalid \$round value." && exit 1 ;; +	esac + +	ringSound="${XDG_DATA_HOME:-$HOME/.local/share}"/pomo/ring.aac +	[ -r "$ringSound" ] && logn "ring: $ringSound" + +	if [ "$1" = "ring" ] +	then +	    player_command +	    exit +	fi + +	# Countdown +	for msg in "three" "two" "one" +	do notif "$msg" +	done + +	while true +	do +		notif "START" +		logn "$(date '+%R') S $round" +		sleep 25m +		if [ "$round" -eq 3 ] +		then +			ring_ring 20 "GIGA BREAK TIME" +			round=0 +		else +			ring_ring 5 "BREAK TIME" +			round=$((round+1)) +		fi +	done +} + +trap 'exit 1' INT +main "$@" diff --git a/bin/menuscripts/shdul.sh b/bin/menuscripts/shdul.sh new file mode 100755 index 0000000..4e1d744 --- /dev/null +++ b/bin/menuscripts/shdul.sh @@ -0,0 +1,157 @@ +#!/bin/sh + +tmp="$(mktemp)" + +red="$(printf '\033[35m')" +blue="$(printf '\033[34m')" +reset="$(printf '\033[0m')" +underline="$(printf '\033[4m')" +bold="$(printf '\033[1m')" + +THISDIR="$(dirname "$(readlink -f "$0")")" +# schedule file +SCHEDULE="$THISDIR/schedule" +# blocks directory +BLOCKS="$THISDIR/blocks" + +die () { >&2 printf "%s" "$@"; exit 1; } +log () { >&2 printf '%s' "$@"; } +logn () { >&2 printf '%s\n' "$@"; } + +cleanup () { rm -f "$tmp"; } + +trap cleanup EXIT + +read_char () +{ +	old_stty_cfg=$(stty -g) +	stty raw -echo  +	dd ibs=1 count=1 2> /dev/null +	stty "$old_stty_cfg" +} + +edit_schedule () +{ +	while true +	do +		char="$(read_char)" +		case "$char" in +			q) exit ;; +			a) add_block ;; +			# new or from save +			d) delete_block ;; +			'') ;; +			*) printf "%s" "$char" +		esac +	done + +} + +# adds NOW to the schedule and gets its line number +# $1: schedule file +get_now () +{ +	fake="$(date +%R)\tZZZZZZZZZZZZZZZZ - NOW" +	sed "\$a $fake" "$1" | +		sort -g | +		awk "/^$fake/ {print NR}" +} + +# prints schedule in a nice format +# $1: schedule file +# $2: blocks dir +print_schedule () +{ +	now="$(get_now "$1")" + +	clear + +	i=1 +	while read -r line +	do +		[ "$i" -lt "$((now-1))" ] && i=$((i+1)) && continue +		i=$((i+1)) + +		# Colors +		if [ "$i" -lt "$now" ] +		then +			printf "%s" "${reset}${red}" +		elif [ "$i" -eq "$now" ] +		then +			printf "%s" "${reset}${bold}" +		else +			printf "%s" "${reset}${blue}" +		fi + +		block_file="$2/$(printf "%s" "$line" | cut -f2)" +		block_time="$(printf "%s" "$line" | cut -f1)" + +		# markup +		printf "%s\n" "$block_time" +		sed 's/.*/│&/' "$block_file" +		# printf '\n' +		 +	done < "$1" + +	printf '%s' "${reset}" +} + +# $1: schedule file +# $2: blocks dir +view_schedule() +{ +	trap "break" INT + +	prev_now="$(get_now "$1")" +	print_schedule "$1" "$2" +	while true +	do +		now="$(get_now "$1")" + +		# Refresh when new block +		if [ "$prev_now" -ne "$now" ] +		then +			print_schedule "$1" "$2" +			prev_now="$now" +			notify-send -u critical -t 5000 "shdul" "$(awk "NR==$((now-1)) {print \$2}" "$1")" + +			# Align with clock +			sleep "$((60-$(date +%-S)))s" +		else +			sleep 1m +		fi +	done + +	clear +} + +main () +{ +	echo $$ > "$THISDIR/.scheduler.pid" + +	view_schedule "$SCHEDULE" "$BLOCKS" +	while true +	do +		printf ':' +		char="$(read_char)" +		case "$char" in +			h) cat <<-EOF + +				 h	help +				 v	view schedule +				 s	edit schedule mode +				 q	exit + +				EOF +				;; +			l) clear ;; +			v) view_schedule "$SCHEDULE" "$BLOCKS" ;; +			s) edit_schedule ;; +			q) exit ;; +			'') ;; +			*) printf "%s" "$char" +		esac +	done +} + +main diff --git a/bin/menuscripts/td b/bin/menuscripts/td new file mode 100755 index 0000000..e905d9b --- /dev/null +++ b/bin/menuscripts/td @@ -0,0 +1,65 @@ +#!/bin/sh + +todo="$HOME/docs/filios"/todo + +die() { >&2 printf '%s\n' "$*"; exit 1; } +usage() +{ +    cat <<EOF +usage: td [COMMAND] [ARGUMENT] +        td                  lists to-do's +COMMANDS +        new TEXT...         add a new to-do +        clear               remove all to-do's +        delete NUMBER       delete a to-do by number +        grep REGEX          show to-do's matching regex +        help                show usage +        move NUMBER NUMBER  change priority of a to-do +        edit                edit file in \$EDITOR +EOF +    exit 1 +} +wrong_usage() { >&2 printf 'Wrong usage!\n'; usage; } + +list_todos() {  +    [ ! -r "$todo" ] && die "No to-do's." +    [ "$(wc -l < "$todo")"  -eq 0 ] && die "No to-do's." +    awk '{print NR ": " $0}' "$todo" +} + +# shellcheck disable=SC2142 + +### MAIN + +# Arguments without an option +case "$1" in +    c*) rm -f "$todo"; >&2 printf 'Cleared.\n' ;; +    h*) usage ;; +    e*) $EDITOR "$todo" ;; +    "") list_todos ;; +    *) false ;; +esac && exit + + +arg="$1" +shift +[ "$1" ] || wrong_usage + +case "$arg" in +    n*) +        printf '%s\n' "$*" >> "$todo" +        list_todos ;; + +    d*) +        sed -i -n "$1!p" "$todo" +        list_todos ;; +    g*) list_todos | grep "$*" ;; + +    m*) +        [ "$2" ] || wrong_usage +        line="$(list_todos | sed "/^$1:/!d;s/^$1: //")" +        sed -i "${1}d;${2}i${line}" "$todo" +        list_todos ;; + +    *) wrong_usage ;; +esac diff --git a/bin/menuscripts/treetag.sh b/bin/menuscripts/treetag.sh new file mode 100755 index 0000000..3ded637 --- /dev/null +++ b/bin/menuscripts/treetag.sh @@ -0,0 +1,128 @@ +#!/bin/sh + +VERSION="0.3" + +batch=0 +rename=0 + +help () +{ +	cat <<-EOF >&2 +	Usage: treetag.sh [options] +	Options: +	-b              Enable batch mode +	-d <directory>  Specify the music directory +	-h              Show this help message and exit +	-r              also rename file +	-v              Print version information and exit +	EOF +} + +log () { >&2 printf '%s\n' "$@"; } +die () { log "$@"; exit 1; } +require () { command -v "$1" > /dev/null || die "E: This script needs '$1' to be installed."; } +ls_dirs() { find . -mindepth 1 -maxdepth 1 -type d -printf "%f\n"; } + +### Tag files in the current directory +# $1: artist name +# $2: album name +treetag () +{ +	[ -z "$1" ] || [ -z "$2" ] && return 1 +	artist="$1" +	album="$2" + +	>&2 printf "artist: %s\n" "$artist" +	>&2 printf "album: %s\n" "$album" +	find . -maxdepth 1 -type f -printf '%f\n' | sort -g | +		while read -r file +		do +			>&2 printf "file: %s\n" "$file" +			! soxi "$file" > /dev/null 2>&1 && continue + +			# Remove number prefix and extension +			name="$(printf '%s' "${file%.*}" | sed 's/^[0-9]*\s*[. -]\s*//')" +			i=$((i+1)) + +			log "I: [$artist] ($album) #$i $name" + +			id3v2 \ +				-a "$artist" \ +				-A "$album" \ +				-t "$name" \ +				-T "$i" \ +				-- "$file" +			printf '%s\n' "$i" > .count + +			[ $rename -eq 1 ] && mv -- "$file" "$i. $name.${file##*.}" + +		done +		if [ -f .count ] +		then +			log "I: $(cat .count) file(s) tagged." +			rm .count +		else +			log "I: No files tagged." +		fi +} + +batch_tag () +{ +	artist="${PWD##*/}" # basename of current dir +	ls_dirs | +		while read -r album +		do (cd "$album" && treetag "$artist" "$album") +		done +} + +# Tag interactively with fzf +interactive () +{ +	require "fzf" + +	artist="$(ls_dirs | fzf)" +	[ "$artist" ] && cd "$artist" || exit 1 + +	choice="$artist" +	while true +	do +		choice="$(ls_dirs | fzf --prompt "$choice:")" +		if [ "$choice" ] +		then  +			album="$choice" +			cd "$album" || exit 1 + +			printf 'stop? ' +			head -n 1 | grep -q "[yY]" && break +		else  +			break +		fi +	done + +	treetag "$artist" "$album" +} + +while getopts ":d:bhrv" opt +do +	case $opt in +		b) batch=1 ;; +		d) musdir="$OPTARG" ;; +		h) help; exit ;; +		r) rename=1 ;; +		v) log "treetag.sh $VERSION"; exit ;; +		:) die "E: Option -$OPTARG requires an argument" ;; +		?) die "E: Invalid option: -$OPTARG" ;; +	esac +done + +require "id3v2" +require "sox" + +cd "${musdir:=.}" || exit 1 + +if [ $batch -eq 1 ]  +then +	batch_tag +else +	interactive +fi diff --git a/bin/menuscripts/tsh b/bin/menuscripts/tsh new file mode 100755 index 0000000..eac0c3e --- /dev/null +++ b/bin/menuscripts/tsh @@ -0,0 +1,204 @@ +#!/bin/sh + +PROG="$(basename "$0")" +## VARIABLES +# copy command and deps variable +deps="pup curl $MENUCMD" + +LIBPFX=/home/aluc/.local/share/tsh +module='1337x.sh' # default module + +# Files +export tmp="/tmp/$PROG" +files="seeds sizes names html tmp_types" +# Use export so that these variables can be used inside of modules +for file in $files +do eval "export $file=$tmp/$file" +done +# Files not in $files won't be deleted +export results="$tmp/results" +export links="$tmp/links" + +types="music anime movies shows other software games isos books" + +if [ "$WAYLAND_DISPLAY" ] +then +	clipp() { wl-copy -n; } +	deps="$deps wl-copy" +else +	clipp() { xclip -selection clipboard -r; } +	deps="$deps xclip" +fi +## FUNCTIONS + +help () +{ +	>&2 cat <<-EOF +	Usage: $PROG [options] query +	Options: +	    -h           Show this help message and exit +	    -r           Skip getting pages and use last results +	    -s OPTION    Sort results based on the specified OPTION +	                 Available options: seeds, size, name +	    -m MODULE    Select a module, if MODULE is 'list', +	                 lists out available modules +	EOF +} + +log () { >&2 printf '%s' "$*"; } +logn () { >&2 printf '%s\n' "$*"; } +die () { logn "$@"; exit 1; } + +confirm() +{ +	log "$1" +	head -n 1 | grep -q "[yY]" +} + +dependencies () +{ +	for p in $deps +	do +		if ! command -v "$p" > /dev/null +		then +			logn "E: Program '$p' not found." +			error=1 +		fi +	done +	[ "${error:-0}" -eq 1 ] && exit 1 +} + +# shellcheck disable=SC2046 +# (we use word splitting on purpose) +isOnline () { grep -q '1' $(echo /sys/class/net/*/carrier | sed 's#/sys/class/net/lo/carrier ##'); } + +# Remove temp files and quit +cleanup () +{ +	for file in $files +	do eval "rm -f \$$file" +	done +} + +list_modules () { find -L "$LIBPFX" -type f -printf "%f\n"; } + +# get a query from user based on MENUCMD +get_query () +{ +	isOnline || exit 1 +	if [ "${query:="$*"}" ] +	then +		printf "%s" "$query" +	else +		log ' > ' +		head -n 1 +	fi | tr ' ' '+' +} + +# Select a result from the result file sorterd with sort_results +# and select with fzf +select_result () +{ +	command -v sort_results > /dev/null || sort_results() { sort -k3 -n -r; } +	awk '{print NR, $0}' "$results" | +		sort_results | +		column -t -l 3 | +		fzf -m --with-nth 2.. | +		awk '{print $1}' +} + +show_files() +{ +	hash="${1##*btih:}" +	hash="${hash%%&*}" + +	# Download the torrent file from a torrent website +	curl -s "https://itorrents.org/torrent/${hash}.torrent" > "$tmp"/.torrent +	transmission-show "$tmp"/.torrent | sed -n '/^FILES/,$p' | head -n -1 | tail -n +3 >&2 +	rm -f "$tmp"/.torrent +} + +# Select a type after having displayed them with 'show_types' +select_type() +{ +	for type in $types +	do printf "%s\n" "$type" +	done | fzf +} + +trap "exit 1" INT +trap "cleanup" EXIT + +## OPTIONS +skip=0 +while getopts ":hm:rs:" opt +do +	case $opt in +		h) help && exit ;; +		m) +			[ "$OPTARG" = "list" ] && list_modules && exit +			module="$(list_modules | grep -m 1 "^$OPTARG")" +			[ -z "$module" ] && die "No valid module for '$OPTARG'" +			logn "module: $module" ;; +		r)  +			[ ! -r "$results" ] && die "No previous results found." +			skip=1 ;; +		s) +			case $OPTARG in +				"seeds")	sort_results() { sort -k3 -n -r; } ;; +				"size") 	sort_results() { sort -k2 -h -r; } ;; +				"name") 	sort_results() { sort -k4; } ;; +				*) die "argument '$OPTARG' not seeds,size,name" ;; +			esac ;; +		:) die "Option -$OPTARG requires an argument" ;; +		?) die "Invalid option: -$OPTARG" ;; +	esac +done +shift $((OPTIND - 1)) + +dependencies + +# Get the torrents with module +if [ $skip -ne 1 ] +then +	mkdir -p "$tmp" + +	query="$(get_query "$*")" +	[ "$query" ] || exit 1 + +	# Get results +	rm -f "$results" "$links" +	# shellcheck source=/usr/local/lib/$PROG/nyaa.sh disable=SC1091 +	. "$LIBPFX/$module" +	[ -f "$results" ] || die "No results." + +	# Save which module was used +	printf "%s\n" "$module" >> "$links" +else +	module="$(tail -n 1 "$links")" +fi + +# acquire get_magnet function +# shellcheck source=/usr/local/lib/$PROG/nyaa.sh disable=SC1091 +getfunctions=1 . "$LIBPFX/$module" + +# select result from "$results" +for choice in $(select_result | xargs) +do +    printf 'choice: %s\n' "$choice" +    magnet="$(get_magnet "$choice")" +    [ "$magnet" ] || exit 1 + +    confirm 'files?' && show_files "$magnet" + +    if confirm 'download?' +    then +	    type="$(select_type)" +	    [ "$type" ] || exit 1 +	    transmission-remote debuc.com -a "$magnet" -w "/downloads/$type" +    elif confirm "copy?" +    then +	    echo "$magnet" | clipp +    fi + +done diff --git a/checkpoint.sh b/checkpoint.sh new file mode 100755 index 0000000..62c138c --- /dev/null +++ b/checkpoint.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +git commit -m 'checkpoint' +keyadd db +git push diff --git a/config/common/mpd/mpd.conf b/config/common/mpd/mpd.conf index 889b458..095b345 100644 --- a/config/common/mpd/mpd.conf +++ b/config/common/mpd/mpd.conf @@ -1,4 +1,4 @@ -music_directory      "~/music" +music_directory      "/media/manthe/music"  playlist_directory   "~/.config/mpd/playlists"  db_file              "~/.config/mpd/database"  pid_file             "~/.config/mpd/pid" diff --git a/config/essentials/git/config b/config/essentials/git/config index 2e3033d..ba81b18 100644 --- a/config/essentials/git/config +++ b/config/essentials/git/config @@ -8,3 +8,7 @@  	autosetupremote = true  [pull]  	rebase = false +[merge] +	ff = false +[alias] +	change-commits = "!f() { VAR1=$1; VAR='$'$1; OLD=$2; NEW=$3; echo \"Are you sure for replace $VAR  $OLD => $NEW ?(Y/N)\";read OK;if [ \"$OK\" = 'Y' ] ; then shift 3; git filter-branch  --env-filter \"if [ \\\"${VAR}\\\" = '$OLD' ]; then export $VAR1='$NEW';echo 'to $NEW'; fi\" $@; fi;};  f " diff --git a/config/essentials/nvim/after/plugin/autoclose.lua b/config/essentials/nvim/after/plugin/autoclose.lua deleted file mode 100644 index 89078ef..0000000 --- a/config/essentials/nvim/after/plugin/autoclose.lua +++ /dev/null @@ -1,20 +0,0 @@ -require("autoclose").setup({ -   keys = { -      ["("] = { escape = false, close = true, pair = "()"}, -      ["["] = { escape = false, close = true, pair = "[]"}, -      ["{"] = { escape = false, close = true, pair = "{}"}, - -      [">"] = { escape = true, close = false, pair = "<>"}, -      [")"] = { escape = true, close = false, pair = "()"}, -      ["]"] = { escape = true, close = false, pair = "[]"}, -      ["}"] = { escape = true, close = false, pair = "{}"}, - -      ['"'] = { escape = true, close = true, pair = '""'}, -      ["'"] = { escape = true, close = true, pair = "''"}, -      ["`"] = { escape = true, close = true, pair = "``"}, -   }, -   options = { -      disabled_filetypes = { "text", "telekasten", "groff", "diff", "gitcommit", "fugitive" }, -      disable_when_touch = true, -   }, -}) diff --git a/config/essentials/nvim/after/plugin/colorizer.lua.disabled b/config/essentials/nvim/after/plugin/colorizer.lua.disabled deleted file mode 100644 index 6ca374f..0000000 --- a/config/essentials/nvim/after/plugin/colorizer.lua.disabled +++ /dev/null @@ -1,6 +0,0 @@ -require 'colorizer'.setup { -	'*'; -	html = { -		mode = 'foreground'; -	} -} diff --git a/config/essentials/nvim/after/plugin/colors.lua b/config/essentials/nvim/after/plugin/colors.lua deleted file mode 100644 index 048f60d..0000000 --- a/config/essentials/nvim/after/plugin/colors.lua +++ /dev/null @@ -1,21 +0,0 @@ - function ColorMyPencils(color) -	if color == "nord" then -		vim.cmd.colorscheme(color) -		vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) -		vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) -		vim.cmd.highlight("SignColumn guibg=none") -		vim.g.nord_uniform_diff_background = true -		vim.g.nord_contrast = true -		vim.g.nord_borders = true -		local highlights = require("nord").bufferline.highlights({ -			italic = true, -			bold = true, -		}) -	elseif color == "pywal" then -		local pywal16 = require('pywal16') -		pywal16.setup() -	else -		vim.cmd("colorscheme " .. color) -	end -end -ColorMyPencils("nord") diff --git a/config/essentials/nvim/after/plugin/dap.lua b/config/essentials/nvim/after/plugin/dap.lua deleted file mode 100644 index e32b5ee..0000000 --- a/config/essentials/nvim/after/plugin/dap.lua +++ /dev/null @@ -1,40 +0,0 @@ -local dap = require('dap') - -dap.adapters.coreclr = { -  type = 'executable', -  command = 'netcoredbg', -  args = {'--interpreter=vscode'} -} - -dap.configurations.cs = { -  { -    type = "coreclr", -    name = "launch - netcoredbg", -    request = "launch", -    program = function() -        return vim.fn.input('Path to dll', vim.fn.getcwd() .. '/bin/Debug/', 'file') -    end, -  }, -} - -local function nnoremap(rhs, lhs, bufopts, desc) -  bufopts.desc = desc -  vim.keymap.set("n", rhs, lhs, bufopts) -end -local bufopts = { noremap=true, silent=true } - - -nnoremap('<F5>' , dap.continue, bufopts, "Continue") -nnoremap('<F6>' , dap.disconnect, bufopts, "Continue") -nnoremap('<F10>' , dap.step_over, bufopts, "Step over") -nnoremap('<F11>' , dap.step_into, bufopts, "Step into") -nnoremap('<F12>' , dap.step_out, bufopts, "Step out") -nnoremap('<Leader>b' , dap.toggle_breakpoint, bufopts, "Toggle breakpoint") - -nnoremap('<Leader>B' , function() dap.set_breakpoint(vim.fn.input('Breakpoint condition: ')) -	end, bufopts, "Set breakpoint") -nnoremap('<Leader>lp' , function() dap.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) -	end, bufopts, "set breakpoint with log point message") - -nnoremap('<Leader>dr' , dap.repl.open, bufopts, "Reply open") -nnoremap('<Leader>dl' , dap.run_last, bufopts, "Run las") diff --git a/config/essentials/nvim/after/plugin/dapui.lua b/config/essentials/nvim/after/plugin/dapui.lua deleted file mode 100644 index faec590..0000000 --- a/config/essentials/nvim/after/plugin/dapui.lua +++ /dev/null @@ -1,94 +0,0 @@ -local dap, dapui = require("dap"), require("dapui") - -dapui.setup({ -  icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" }, -  mappings = { -    -- Use a table to apply multiple mappings -    expand = { "<CR>", "<2-LeftMouse>" }, -    open = "o", -    remove = "d", -    edit = "e", -    repl = "r", -    toggle = "t", -  }, -  -- Use this to override mappings for specific elements -  element_mappings = { -    -- Example: -    -- stacks = { -    --   open = "<CR>", -    --   expand = "o", -    -- } -  }, -  -- Expand lines larger than the window -  -- Requires >= 0.7 -  expand_lines = vim.fn.has("nvim-0.7") == 1, -  -- Layouts define sections of the screen to place windows. -  -- The position can be "left", "right", "top" or "bottom". -  -- The size specifies the height/width depending on position. It can be an Int -  -- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while -  -- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns) -  -- Elements are the elements shown in the layout (in order). -  -- Layouts are opened in order so that earlier layouts take priority in window sizing. -  layouts = { -    { -      elements = { -      -- Elements can be strings or table with id and size keys. -        { id = "scopes", size = 0.25 }, -        "breakpoints", -        "stacks", -        "watches", -      }, -      size = 40, -- 40 columns -      position = "left", -    }, -    { -      elements = { -        "repl", -        "console", -      }, -      size = 0.25, -- 25% of total lines -      position = "bottom", -    }, -  }, -  controls = { -    -- Requires Neovim nightly (or 0.8 when released) -    enabled = true, -    -- Display controls in this element -    element = "repl", -    icons = { -      pause = "", -      play = "", -      step_into = "", -      step_over = "", -      step_out = "", -      step_back = "", -      run_last = "↻", -      terminate = "□", -    }, -  }, -  floating = { -    max_height = nil, -- These can be integers or a float between 0 and 1. -    max_width = nil, -- Floats will be treated as percentage of your screen. -    border = "single", -- Border style. Can be "single", "double" or "rounded" -    mappings = { -      close = { "q", "<Esc>" }, -    }, -  }, -  windows = { indent = 1 }, -  render = { -    max_type_length = nil, -- Can be integer or nil. -    max_value_lines = 100, -- Can be integer or nil. -  } -}) - - -dap.listeners.after.event_initialized["dapui_config"] = function() -  dapui.open() -end -dap.listeners.before.event_terminated["dapui_config"] = function() -  dapui.close() -end -dap.listeners.before.event_exited["dapui_config"] = function() -  dapui.close() -end - diff --git a/config/essentials/nvim/after/plugin/fugitive.lua b/config/essentials/nvim/after/plugin/fugitive.lua deleted file mode 100644 index 80c9070..0000000 --- a/config/essentials/nvim/after/plugin/fugitive.lua +++ /dev/null @@ -1 +0,0 @@ -vim.keymap.set("n", "<leader>gs", vim.cmd.Git) diff --git a/config/essentials/nvim/after/plugin/gitsigns.lua b/config/essentials/nvim/after/plugin/gitsigns.lua deleted file mode 100644 index 025f70d..0000000 --- a/config/essentials/nvim/after/plugin/gitsigns.lua +++ /dev/null @@ -1,82 +0,0 @@ -require('gitsigns').setup { -  signs = { -    add          = { text = '│' }, -    change       = { text = '│' }, -    delete       = { text = '_' }, -    topdelete    = { text = '‾' }, -    changedelete = { text = '~' }, -    untracked    = { text = '┆' }, -  }, -  signcolumn = true,  -- Toggle with `:Gitsigns toggle_signs` -  numhl      = false, -- Toggle with `:Gitsigns toggle_numhl` -  linehl     = false, -- Toggle with `:Gitsigns toggle_linehl` -  word_diff  = false, -- Toggle with `:Gitsigns toggle_word_diff` -  watch_gitdir = { -    follow_files = true -  }, -  attach_to_untracked = true, -  current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` -  current_line_blame_opts = { -    virt_text = true, -    virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' -    delay = 1000, -    ignore_whitespace = false, -  }, -  current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>', -  sign_priority = 6, -  update_debounce = 100, -  status_formatter = nil, -- Use default -  max_file_length = 40000, -- Disable if file is longer than this (in lines) -  preview_config = { -    -- Options passed to nvim_open_win -    border = 'single', -    style = 'minimal', -    relative = 'cursor', -    row = 0, -    col = 1 -  }, -  yadm = { -    enable = false -  }, -    on_attach = function(bufnr) -    local gs = package.loaded.gitsigns - -    local function map(mode, l, r, opts) -      opts = opts or {} -      opts.buffer = bufnr -      vim.keymap.set(mode, l, r, opts) -    end - -    -- Navigation -    map('n', ']c', function() -      if vim.wo.diff then return ']c' end -      vim.schedule(function() gs.next_hunk() end) -      return '<Ignore>' -    end, {expr=true}) - -    map('n', '[c', function() -      if vim.wo.diff then return '[c' end -      vim.schedule(function() gs.prev_hunk() end) -      return '<Ignore>' -    end, {expr=true}) - -  -- Actions -    map('n', '<leader>hs', gs.stage_hunk) -    map('n', '<leader>hr', gs.reset_hunk) -    map('v', '<leader>hs', function() gs.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end) -    map('v', '<leader>hr', function() gs.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end) -    map('n', '<leader>hS', gs.stage_buffer) -    map('n', '<leader>hu', gs.undo_stage_hunk) -    map('n', '<leader>hR', gs.reset_buffer) -    map('n', '<leader>hp', gs.preview_hunk) -    map('n', '<leader>hb', function() gs.blame_line{full=true} end) -    map('n', '<leader>tb', gs.toggle_current_line_blame) -    map('n', '<leader>hd', gs.diffthis) -    map('n', '<leader>hD', function() gs.diffthis('~') end) -    map('n', '<leader>td', gs.toggle_deleted) - -    -- Text object -    map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>') -  end - -} diff --git a/config/essentials/nvim/after/plugin/harpoon.lua b/config/essentials/nvim/after/plugin/harpoon.lua deleted file mode 100644 index 6f9c8ba..0000000 --- a/config/essentials/nvim/after/plugin/harpoon.lua +++ /dev/null @@ -1,10 +0,0 @@ -local mark = require("harpoon.mark") -local ui = require("harpoon.ui") - -vim.keymap.set("n", "<leader>ha", mark.add_file) -vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu) - -vim.keymap.set("n", "<leader>h1", function() ui.nav_file(1) end) -vim.keymap.set("n", "<leader>h2", function() ui.nav_file(2) end) -vim.keymap.set("n", "<leader>h3", function() ui.nav_file(3) end) -vim.keymap.set("n", "<leader>h4", function() ui.nav_file(4) end) diff --git a/config/essentials/nvim/after/plugin/luasnip.lua b/config/essentials/nvim/after/plugin/luasnip.lua deleted file mode 100644 index 9119264..0000000 --- a/config/essentials/nvim/after/plugin/luasnip.lua +++ /dev/null @@ -1,229 +0,0 @@ -local ls = require("luasnip") -local s = ls.snippet -local sn = ls.snippet_node -local isn = ls.indent_snippet_node -local t = ls.text_node -local i = ls.insert_node -local f = ls.function_node -local c = ls.choice_node -local d = ls.dynamic_node -local r = ls.restore_node -local events = require("luasnip.util.events") -local ai = require("luasnip.nodes.absolute_indexer") -local extras = require("luasnip.extras") -local l = extras.lambda -local rep = extras.rep -local p = extras.partial -local m = extras.match -local n = extras.nonempty -local dl = extras.dynamic_lambda -local fmt = require("luasnip.extras.fmt").fmt -local fmta = require("luasnip.extras.fmt").fmta -local conds = require("luasnip.extras.expand_conditions") -local postfix = require("luasnip.extras.postfix").postfix -local types = require("luasnip.util.types") -local parse = require("luasnip.util.parser").parse_snippet - --- keymaps -vim.keymap.set({"i", "s"}, "<C-k>", "<Plug>luasnip-expand-or-jump", { noremap = true }) -vim.keymap.set({"i", "s"}, "<C-j>", "<Plug>luasnip-jump-prev", { noremap = true }) -vim.keymap.set({"i", "s"}, "<C-l>", "<Plug>luasnip-next-choice", { noremap = true }) -vim.keymap.set("n", "<leader><leader>s", function() -    ls.cleanup() -    vim.cmd("source ~/.config/nvim/after/plugin/luasnip.lua") -    print("snippets reloaded.") -end, { noremap = true }) - -ls.add_snippets("lua", { -    -- print -    s("pt", fmt("print({}){}", { i(1, "\"Hello World!\"") , i(0) })), -    -- local function -    parse("lf", "local $1 = function($2)\n\t$3\nend$0", {}), -        -- require -        s("lrq", fmt("local {} = require('{}')", { i(1), rep(1) })), -        parse("rq", "require('$1')$0", {}), -        parse("rqs", "require('$1').setup {\n\t$2\n}$0", {}), -        parse("use", "use('$1')$0", {}), -        -- function -        parse("fn", -        [[ -        function $1($2) -    end$0 -    ]], {}), -    parse("sn", "s(\"$1\", fmt(\n[[\n$2\n]],\n{ $3 })),$0", {}), -}) - -local languages = {'php', 'html'} -for language = 1,#languages do -ls.add_snippets(languages[language], { -	s("<!DOCTYPE>", fmt( -	[[ -	<!DOCTYPE html> -	<html lang="en"> -		<head> -			<meta charset="UTF-8"> -			<meta name="viewport" content="width-device-width, initial-scale=1.0"> -			<meta http-equiv="X-UA-Compatible" content="ie=edge"> -			<title>{}</title> -		</head> -		<body> -			<h1>{}</h1>{} -		</body> -	</html> -	]], -	{i(1, "title"), rep(1), i(0)})), -	parse("sty", -	[[ -	<link rel="stylesheet" type="text/css" href="$1">$0 -	]], {}), -}) -end - -ls.add_snippets("java", { -    -- function -    s("fn", fmt( -    [[ -    {}{} {}({}) -    {{ -        {} -    }} -    ]], -    { -        c(1, {t "public ", t "private ", t ""}), -        i(2, "type"), -        i(3, "f"), -        i(4), i(0) -    })), -    -- setter function -    s("psv", fmt( -    [[ -    public class Main -    {{ -        public static void main (String[] args) -        {{ -            {} -        }} -    }} -    ]], -    { i(0) })), -    -- constructor -    s("class", fmt( -    [[ -    {}class {} -    {{ -        {} -    }}{} -    ]], -    { c(1, {t "public ", t "private ", t ""}), i(2), i(3), i(0)})), -    -- StringBuilder -    s("sb", fmt( -    [[ -    public void print() -    {{ -        StringBuilder sb = new StringBuilder(30); -        sb.append({}); -        sb.append(", ").append({});{} -        System.out.print(sb.toString()); -    }}{} -    ]], -    { i(1), i(2), i(3), i(0)})), -    -- print -    parse("pt", "System.out.println($1);$0", {}), -    parse("pti", "System.out.println(\"$1: \" + $1);$0", {}), -    -- quickies  -    s("pr", t "private "), -    s("ob", fmt( -    [[ -    {} {} = new {}({}); -    {} -    ]], -    { i(1), i(2), rep(1), i(3), i(0) })), -    parse("abs", "Math.abs($1);$0", {}), -}) - -ls.add_snippets("sh", { -    s("TD", t "THISDIR=\"$(dirname \"$(readlink -f \"$0\")\")\""), -    parse("pf", ">&2 printf '$1\\n'$0", {}), -    parse("fn", "$1 ()\n{\n\t$2\n}$0", {}), -    -- Functions -    parse("rchar", -    [[ -    read_char () -    { -        old_stty_cfg=$(stty -g) -        stty raw -echo  -        dd ibs=1 count=1 2> /dev/null -        stty \$old_stty_cfg -    } -    ]], {}), -    parse("fdie", -    [[ -    die () { >&2 printf '%s\n' "\$@"; exit 1; } -    ]], {}), -    parse("flogn", -    [[ -    logn () { >&2 printf '%s\n' "\$@"; } -    ]], {}), -    parse("flog", -    [[ -    log () { >&2 printf '%s' "\$@"; } -    ]], {}), -    s("inp", fmt( -    [[ -    test -z "${{{}:=$1}}" &&  -        {}="$(cat /dev/stdin)" -    echo "{}: ${}" 1>&2{} -    ]], -    { i(1), rep(1), rep(1), rep(1), i(0) })), -}) - -ls.add_snippets("javascript", { -    -- print -    s("pt", fmt("console.log({});{}", { i(1, "\"Hello World!\"") , i(0) })), -    s("rq", fmt("const {} = require('{}');", { i(1), rep(1) })), -    s("dbconn", fmt( -    [[ -        let conn = null; -        try {{ -            conn = await dbConnect();{} -            conn.end() -        }} catch(err) {{ -            console.error('Error:', err); -        }} -    ]], -    { i(0) })), -    s("apr", fmt( -    [[ -    app.get('{}', (req, res) => {{ -        {} -    }});{} -    ]], -    { i(1), i(2, "res.send(\"Hello world!\")"), i(0) })), -    s("cerr", t "console.error('Error:', err);"), -    s("gel", fmt( -    [[ -    let {} = document.getElementById('{}');{} -    ]], -    { i(1), rep(1), i(0) })), -}) - -ls.add_snippets("cs", { -    parse("cw", "Console.WriteLine($1);$0"), -}) - -ls.add_snippets("telekasten", { -    --link -    parse("ln", "[[$0]]", {}), -    s("cln", fmt( -    [[ -    [{}]({}){} -    ]], -    { -        i(1), -        f(function () -            return vim.fn.getreg('+') -        end), -        i(0) -    } -    )), -}) diff --git a/config/essentials/nvim/after/plugin/oscyank.lua b/config/essentials/nvim/after/plugin/oscyank.lua deleted file mode 100644 index 17e9583..0000000 --- a/config/essentials/nvim/after/plugin/oscyank.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.keymap.set('n', '<leader>o', '<Plug>OSCYankOperator') -vim.keymap.set('n', '<leader>oo', '<Plug>OSCYankOperator_') -vim.keymap.set('v', '<leader>o', '<Plug>OSCYankVisual') diff --git a/config/essentials/nvim/after/plugin/pantran.lua b/config/essentials/nvim/after/plugin/pantran.lua deleted file mode 100644 index a7aab19..0000000 --- a/config/essentials/nvim/after/plugin/pantran.lua +++ /dev/null @@ -1,18 +0,0 @@ -require("pantran").setup{ -	controls = { -		mappings = { -			edit = { -				n = { -					["j"] = "gj", -					["k"] = "gk", -				} -			} -		} -	} -} -local pantran = require('pantran') -local opts = {noremap = true, silent = true, expr = true} -vim.keymap.set("n", "<leader>tr", pantran.motion_translate, opts) - -vim.keymap.set("n", "<leader>trr", function() return pantran.motion_translate() .. "_" end, opts) -vim.keymap.set("x", "<leader>tr", pantran.motion_translate, opts) diff --git a/config/essentials/nvim/after/plugin/plantuml.lua b/config/essentials/nvim/after/plugin/plantuml.lua deleted file mode 100644 index da14862..0000000 --- a/config/essentials/nvim/after/plugin/plantuml.lua +++ /dev/null @@ -1,10 +0,0 @@ -require('plantuml').setup -{ -  renderer = { -    type = 'text', -    options = { -      split_cmd = 'split', -- Allowed values: `split`, `vsplit`. -    } -  }, -  render_on_write = true, -- Set to false to disable auto-rendering. -} diff --git a/config/essentials/nvim/after/plugin/telescope.lua b/config/essentials/nvim/after/plugin/telescope.lua deleted file mode 100644 index 32a7fbf..0000000 --- a/config/essentials/nvim/after/plugin/telescope.lua +++ /dev/null @@ -1,48 +0,0 @@ --- require('telescope').load_extension('fzf') -require('telescope').load_extension('media_files') - -require('telescope').setup({ -	defaults = { -		path_display = { -			shorten = { -				len = 3, exclude = {1, -1} -			}, -			truncate = true -		}, -		dynamic_preview_title = true, -	}, -	extensions = { -		-- fzf = { -		-- 	fuzzy = true, -		-- 	override_generic_sorter = true, -		-- 	override_file_sorter = true, -		-- 	case_mode = "smart_case", -		-- }, -		media_files = { -			filetypes = {"png", "webp", "jpg", "jpeg"}, -			find_cmd = "rg" -		} -	} -}) - -local builtin = require('telescope.builtin') -vim.keymap.set('n', '<leader>ff', builtin.find_files) -vim.keymap.set('n', '<leader>fb', builtin.buffers) -vim.keymap.set('n', '<leader>fg', builtin.git_files) -vim.keymap.set('n', '<leader>fw', builtin.live_grep) --- symbols -vim.keymap.set("n", "<leader>tse", "<cmd>lua require'telescope.builtin'.symbols{ sources = {'emoji', 'gitmoji'} }<CR>") -vim.keymap.set("n", "<leader>tsn", "<cmd>lua require'telescope.builtin'.symbols{ sources = {'nerd'} }<CR>") -vim.keymap.set("n", "<leader>tsj", "<cmd>lua require'telescope.builtin'.symbols{ sources = {'julia'} }<CR>") - --- This is your opts table -require("telescope").setup { -  extensions = { -    ["ui-select"] = { -      require("telescope.themes").get_dropdown { -        -- even more opts -      } -    } -  } -} -require("telescope").load_extension("ui-select") diff --git a/config/essentials/nvim/after/plugin/undotree.lua b/config/essentials/nvim/after/plugin/undotree.lua deleted file mode 100644 index b6b9276..0000000 --- a/config/essentials/nvim/after/plugin/undotree.lua +++ /dev/null @@ -1 +0,0 @@ -vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle) diff --git a/config/essentials/nvim/after/plugin/vim-tmux-navigator.lua b/config/essentials/nvim/after/plugin/vim-tmux-navigator.lua deleted file mode 100644 index c7042fd..0000000 --- a/config/essentials/nvim/after/plugin/vim-tmux-navigator.lua +++ /dev/null @@ -1,6 +0,0 @@ -vim.cmd("let g:tmux_navigator_no_mappings = 1") -vim.keymap.set("n", "<M-h>", ":<C-U>TmuxNavigateLeft<cr>", {silent = true}) -vim.keymap.set("n", "<M-j>", ":<C-U>TmuxNavigateDown<cr>", {silent = true}) -vim.keymap.set("n", "<M-k>", ":<C-U>TmuxNavigateUp<cr>", {silent = true}) -vim.keymap.set("n", "<M-l>", ":<C-U>TmuxNavigateRight<cr>", {silent = true}) -vim.keymap.set("n", "<M-/>", ":<C-U>TmuxNavigatePrevious<cr>", {silent = true}) diff --git a/config/essentials/nvim/ftplugin/all.lua b/config/essentials/nvim/ftplugin/all.lua deleted file mode 100644 index 1608f4e..0000000 --- a/config/essentials/nvim/ftplugin/all.lua +++ /dev/null @@ -1 +0,0 @@ -vim.cmd("set formatoptions=cqrnj") diff --git a/config/essentials/nvim/ftplugin/java.lua b/config/essentials/nvim/ftplugin/java.lua deleted file mode 100644 index ce0a202..0000000 --- a/config/essentials/nvim/ftplugin/java.lua +++ /dev/null @@ -1,43 +0,0 @@ -local home = os.getenv('HOME') -local root_markers = {'gradlew', 'mvnw', '.git'} -local root_dir = require('jdtls.setup').find_root(root_markers) -local workspace_folder = home .. "/.local/share/eclipse/" .. vim.fn.fnamemodify(root_dir, ":p:h:t") -local jdtls = require('jdtls') - -local function nnoremap(rhs, lhs, bufopts, desc) -  bufopts.desc = desc -  vim.keymap.set("n", rhs, lhs, bufopts) -end - -local on_attach = function(_, bufnr) -  -- Regular Neovim LSP client keymappings -  local bufopts = { noremap=true, silent=true, buffer=bufnr } - -  -- Java extensions provided by jdtls -  nnoremap("<leader><leader>i", jdtls.organize_imports, bufopts, "Organize imports") -  nnoremap("<leader>ev", jdtls.extract_variable, bufopts, "Extract variable") -  nnoremap("<leader>ec", jdtls.extract_constant, bufopts, "Extract constant") -  vim.keymap.set('v', "<leader>em", [[<ESC><CMD>lua require('jdtls').extract_method(true)<CR>]], -    { noremap=true, silent=true, buffer=bufnr, desc = "Extract method" }) -end - -local config = { -	flags = { -		debounce_text_changes = 80, -	}, -	cmd = { -		'jdtls', -		'-Dlog.protocol=true', -		'-Dlog.level=ALL', -		'-Xms4g', -		'-data', workspace_folder, -	}, -	on_attach = on_attach, -	root_dir = root_dir, -} -require('jdtls').start_or_attach(config) - -vim.keymap.set("n", "<LocalLeader>t", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1System.out.println(\\2);<cr>") -vim.keymap.set("i", "<LocalLeader>t", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1System.out.println(\\2);<cr><esc>A") -vim.keymap.set("n", "<LocalLeader>i", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1System.out.println(\"\\2: \" + \\2);<cr>") -vim.keymap.set("i", "<LocalLeader>i", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1System.out.println(\"\\2: \" + \\2);<cr><esc>A") diff --git a/config/essentials/nvim/ftplugin/javascript.lua b/config/essentials/nvim/ftplugin/javascript.lua deleted file mode 100644 index 3a52ffb..0000000 --- a/config/essentials/nvim/ftplugin/javascript.lua +++ /dev/null @@ -1,4 +0,0 @@ -vim.keymap.set("n", "<LocalLeader>t", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1console.log(\\2);<cr><cmd>setlocal nohls<cr>") -vim.keymap.set("n", "<LocalLeader>i", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1console.log('\\2:', \\2);<cr><cmd>setlocal nohls<cr><esc>") -vim.keymap.set("i", "<LocalLeader>t", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1console.log(\\2);<cr><cmd>setlocal nohls<cr><esc>A") -vim.keymap.set("i", "<LocalLeader>i", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1console.log('\\2:', \\2);<cr><cmd>setlocal nohls<cr><esc>A") diff --git a/config/essentials/nvim/ftplugin/lua.lua b/config/essentials/nvim/ftplugin/lua.lua deleted file mode 100644 index 07538ed..0000000 --- a/config/essentials/nvim/ftplugin/lua.lua +++ /dev/null @@ -1 +0,0 @@ -vim.keymap.set("i", "{(<cr>", "{<cr>})<C-o>O", { noremap = true }) diff --git a/config/essentials/nvim/ftplugin/sh.lua b/config/essentials/nvim/ftplugin/sh.lua deleted file mode 100644 index e18170a..0000000 --- a/config/essentials/nvim/ftplugin/sh.lua +++ /dev/null @@ -1,6 +0,0 @@ -vim.keymap.set("n", "<LocalLeader>t", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1>\\&2 printf \"\\2\"<cr>") -vim.keymap.set("n", "<LocalLeader>i", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1>\\&2 printf \"\\2: %s\\\\n\" \"$\\2\"<cr>") -vim.keymap.set("i", "<LocalLeader>t", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1>\\&2 printf \"\\2\"<cr><esc>A") -vim.keymap.set("i", "<LocalLeader>i", "<cmd>s/\\(\\s*\\)\\(.*\\)/\\1>\\&2 printf \"\\2: %s\\\\n\" \"$\\2\"<cr><esc>A") -vim.keymap.set({"i", "n"}, "<LocalLeader>v", "<esc>A)\"<esc>I\"$(<esc>I") -vim.opt.formatoptions = "cqrnj" diff --git a/config/essentials/nvim/ftplugin/telekasten.lua b/config/essentials/nvim/ftplugin/telekasten.lua deleted file mode 100644 index c180777..0000000 --- a/config/essentials/nvim/ftplugin/telekasten.lua +++ /dev/null @@ -1,27 +0,0 @@ --- vim.opt.spell = true -vim.opt.textwidth = 65 -vim.opt.signcolumn = "no" - --- syntax highlighting -vim.cmd("hi tklink ctermfg=72 guifg=#81a1c1 cterm=bold,underline gui=bold,underline") -vim.cmd("hi tkBrackets ctermfg=gray guifg=gray") -vim.cmd("hi tkHighlight ctermbg=yellow ctermfg=red cterm=bold guibg=#ebcb8b guifg=black gui=bold") -vim.cmd("hi link CalNavi CalRuler") -vim.cmd("hi tkTagSep ctermfg=gray guifg=gray") -vim.cmd("hi tkTag ctermfg=175 guifg=#d3869B") - -vim.keymap.set("n", "<LocalLeader>a", require("telekasten").show_tags) -vim.keymap.set("n", "<LocalLeader>b", require("telekasten").show_backlinks) -vim.keymap.set("n", "<LocalLeader>c", require("telekasten").show_calendar) -vim.keymap.set("n", "<LocalLeader>C", "<cmd>CalendarT<cr>") -vim.keymap.set({"n", "i"}, "<LocalLeader>i", "<Esc><cmd>Telekasten insert_link<cr>") -vim.keymap.set({"n", "i"}, "<LocalLeader>I", require("telekasten").insert_img_link) -vim.keymap.set("n", "<LocalLeader>F", require("telekasten").find_friends) -vim.keymap.set("n", "<LocalLeader>r", require("telekasten").rename_note) -vim.keymap.set("n", "<LocalLeader>t", require("telekasten").toggle_todo) -vim.keymap.set("i", "<LocalLeader>t", "<cmd>Telekasten toggle_todo<cr><Esc>A") -vim.keymap.set("n", "<LocalLeader>y", require("telekasten").yank_notelink) -vim.keymap.set("n", "<Return>", require("telekasten").follow_link) - -vim.keymap.set("i", "<LocalLeader>l", "<esc>I[<esc>A]()<left><C-r>+<esc>A") -vim.keymap.set("n", "<LocalLeader>l", "I[[<esc>A]]<esc>") diff --git a/config/essentials/nvim/ftplugin/txt.lua b/config/essentials/nvim/ftplugin/txt.lua deleted file mode 100644 index 5a4fb82..0000000 --- a/config/essentials/nvim/ftplugin/txt.lua +++ /dev/null @@ -1 +0,0 @@ -vim.opt.signcolumn = "no" diff --git a/config/essentials/nvim/init.lua b/config/essentials/nvim/init.lua deleted file mode 100644 index ea49ffa..0000000 --- a/config/essentials/nvim/init.lua +++ /dev/null @@ -1 +0,0 @@ -require("user") diff --git a/config/essentials/nvim/lua/user/aucommands.vim b/config/essentials/nvim/lua/user/aucommands.vim deleted file mode 100644 index cdd0ae7..0000000 --- a/config/essentials/nvim/lua/user/aucommands.vim +++ /dev/null @@ -1,34 +0,0 @@ -" Absolute numbers if window isn't focused -augroup numbertoggle -  autocmd! -  autocmd BufEnter,FocusGained,WinEnter * if &nu | set rnu   | endif -  autocmd BufLeave,FocusLost,WinLeave   * if &nu | set nornu | endif -augroup END - -" terminal specific layout -augroup neovim_terminal autocmd!  -	autocmd TermOpen * startinsert  -	autocmd TermOpen * :set nonumber norelativenumber signcolumn=no -	autocmd TermOpen * nnoremap <buffer> <C-c> i<C-c>  -augroup END - -" Return to last edit position -autocmd BufReadPost * -  \ if line("'\"") > 1 && line("'\"") <= line("$") | -  \   exe "normal! g`\"" | -  \ endif - -" Makes vim-commentary work -autocmd FileType dosini setlocal commentstring=#\ %s - -funct! Filter(command) -    redir =>output -    silent exec a:command -    redir END -    let @o = output -    execute "put o" -	redraw! -    return '' -endfunct! - -nnoremap <Leader>F :silent call Filter('g/')<left><Left> diff --git a/config/essentials/nvim/lua/user/cmp/arduino.lua b/config/essentials/nvim/lua/user/cmp/arduino.lua deleted file mode 100644 index 777df8d..0000000 --- a/config/essentials/nvim/lua/user/cmp/arduino.lua +++ /dev/null @@ -1,3 +0,0 @@ -require'lspconfig'.arduino_language_server.setup{ -	cmd = {"arduino-language-server", "-cli-config", "~/.arduinoIDE/arduino-cli.yaml"} -} diff --git a/config/essentials/nvim/lua/user/cmp/bash.lua b/config/essentials/nvim/lua/user/cmp/bash.lua deleted file mode 100644 index 91b6fba..0000000 --- a/config/essentials/nvim/lua/user/cmp/bash.lua +++ /dev/null @@ -1 +0,0 @@ -require'lspconfig'.bashls.setup{} diff --git a/config/essentials/nvim/lua/user/cmp/clangd.lua b/config/essentials/nvim/lua/user/cmp/clangd.lua deleted file mode 100644 index 810aa42..0000000 --- a/config/essentials/nvim/lua/user/cmp/clangd.lua +++ /dev/null @@ -1,2 +0,0 @@ --- c cpp -require'lspconfig'.clangd.setup{} diff --git a/config/essentials/nvim/lua/user/cmp/cs.lua b/config/essentials/nvim/lua/user/cmp/cs.lua deleted file mode 100644 index 533b4b3..0000000 --- a/config/essentials/nvim/lua/user/cmp/cs.lua +++ /dev/null @@ -1,40 +0,0 @@ -local pid = vim.fn.getpid() - -require'lspconfig'.omnisharp.setup { -    cmd = { "omnisharp", "--languageserver", "--hostPID", tostring(pid) }, - -    -- Enables support for reading code style, naming convention and analyzer -    -- settings from .editorconfig. -    enable_editorconfig_support = true, - -    -- If true, MSBuild project system will only load projects for files that -    -- were opened in the editor. This setting is useful for big C# codebases -    -- and allows for faster initialization of code navigation features only -    -- for projects that are relevant to code that is being edited. With this -    -- setting enabled OmniSharp may load fewer projects and may thus display -    -- incomplete reference lists for symbols. -    enable_ms_build_load_projects_on_demand = false, - -    -- Enables support for roslyn analyzers, code fixes and rulesets. -    enable_roslyn_analyzers = false, - -    -- Specifies whether 'using' directives should be grouped and sorted during -    -- document formatting. -    organize_imports_on_format = false, - -    -- Enables support for showing unimported types and unimported extension -    -- methods in completion lists. When committed, the appropriate using -    -- directive will be added at the top of the current file. This option can -    -- have a negative impact on initial completion responsiveness, -    -- particularly for the first few completion sessions after opening a -    -- solution. -    enable_import_completion = false, - -    -- Specifies whether to include preview versions of the .NET SDK when -    -- determining which version to use for project loading. -    sdk_include_prereleases = true, - -    -- Only run analyzers against open files when 'enableRoslynAnalyzers' is -    -- true -    analyze_open_documents_only = false, -} diff --git a/config/essentials/nvim/lua/user/cmp/css.lua b/config/essentials/nvim/lua/user/cmp/css.lua deleted file mode 100644 index 2216419..0000000 --- a/config/essentials/nvim/lua/user/cmp/css.lua +++ /dev/null @@ -1,7 +0,0 @@ ---Enable (broadcasting) snippet capability for completion -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true - -require'lspconfig'.cssls.setup { -  capabilities = capabilities, -} diff --git a/config/essentials/nvim/lua/user/cmp/emmet.lua b/config/essentials/nvim/lua/user/cmp/emmet.lua deleted file mode 100644 index 3193727..0000000 --- a/config/essentials/nvim/lua/user/cmp/emmet.lua +++ /dev/null @@ -1 +0,0 @@ -require'lspconfig'.emmet_ls.setup{} diff --git a/config/essentials/nvim/lua/user/cmp/html.lua b/config/essentials/nvim/lua/user/cmp/html.lua deleted file mode 100644 index d3c99df..0000000 --- a/config/essentials/nvim/lua/user/cmp/html.lua +++ /dev/null @@ -1,8 +0,0 @@ --- html -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true - -require 'lspconfig'.html.setup { -	capabilities = capabilities, -	filetypes = { "html", "php" }, -} diff --git a/config/essentials/nvim/lua/user/cmp/init.lua b/config/essentials/nvim/lua/user/cmp/init.lua deleted file mode 100644 index 1ca0a10..0000000 --- a/config/essentials/nvim/lua/user/cmp/init.lua +++ /dev/null @@ -1,15 +0,0 @@ -require("user.cmp.setup") - -require("user.cmp.arduino") -require("user.cmp.bash") -require("user.cmp.clangd") -require("user.cmp.cs") -require("user.cmp.css") -require("user.cmp.emmet") -require("user.cmp.html") -require("user.cmp.java") -require("user.cmp.js") -require("user.cmp.lua") -require("user.cmp.php") -require("user.cmp.python") -require("user.cmp.rust") diff --git a/config/essentials/nvim/lua/user/cmp/java.lua b/config/essentials/nvim/lua/user/cmp/java.lua deleted file mode 100644 index 1027588..0000000 --- a/config/essentials/nvim/lua/user/cmp/java.lua +++ /dev/null @@ -1 +0,0 @@ --- require'lspconfig'.jdtls.setup{} diff --git a/config/essentials/nvim/lua/user/cmp/js.lua b/config/essentials/nvim/lua/user/cmp/js.lua deleted file mode 100644 index 7188a22..0000000 --- a/config/essentials/nvim/lua/user/cmp/js.lua +++ /dev/null @@ -1 +0,0 @@ -require'lspconfig'.tsserver.setup{} diff --git a/config/essentials/nvim/lua/user/cmp/lua.lua b/config/essentials/nvim/lua/user/cmp/lua.lua deleted file mode 100644 index e594870..0000000 --- a/config/essentials/nvim/lua/user/cmp/lua.lua +++ /dev/null @@ -1,20 +0,0 @@ --- lua -require'lspconfig'.lua_ls.setup { -  settings = { -    Lua = { -      runtime = { -        version = 'LuaJIT', -      }, -      diagnostics = { -        globals = {'vim'}, -      }, -      workspace = { -        library = vim.api.nvim_get_runtime_file("", true), -		checkThirdParty = false, -- no prompt for luassert :) -      }, -      telemetry = { -        enable = false, -      }, -    }, -  }, -} diff --git a/config/essentials/nvim/lua/user/cmp/php.lua b/config/essentials/nvim/lua/user/cmp/php.lua deleted file mode 100644 index 9b2fa18..0000000 --- a/config/essentials/nvim/lua/user/cmp/php.lua +++ /dev/null @@ -1 +0,0 @@ -require'lspconfig'.phpactor.setup{} diff --git a/config/essentials/nvim/lua/user/cmp/python.lua b/config/essentials/nvim/lua/user/cmp/python.lua deleted file mode 100644 index aec86bd..0000000 --- a/config/essentials/nvim/lua/user/cmp/python.lua +++ /dev/null @@ -1 +0,0 @@ -require'lspconfig'.jedi_language_server.setup{} diff --git a/config/essentials/nvim/lua/user/cmp/rust.lua b/config/essentials/nvim/lua/user/cmp/rust.lua deleted file mode 100644 index 46a97eb..0000000 --- a/config/essentials/nvim/lua/user/cmp/rust.lua +++ /dev/null @@ -1,173 +0,0 @@ -require'lspconfig'.rust_analyzer.setup{ -	settings = { -		['rust-analyzer'] = { -			diagnostics = { -				enable = false; -			} -		} -	}, -	capabilities = -	{ -		experimental = { -			serverStatusNotification = true -		}, -		general = { -			positionEncodings = { "utf-16" } -		}, -		textDocument = { -			callHierarchy = { -				dynamicRegistration = false -			}, -			codeAction = { -				codeActionLiteralSupport = { -					codeActionKind = { -						valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" } -					} -				}, -				dataSupport = true, -				dynamicRegistration = true, -				isPreferredSupport = true, -				resolveSupport = { -					properties = { "edit" } -				} -			}, -			completion = { -				completionItem = { -					commitCharactersSupport = false, -					deprecatedSupport = false, -					documentationFormat = { "markdown", "plaintext" }, -					preselectSupport = false, -					snippetSupport = false -				}, -				completionItemKind = { -					valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 } -				}, -				contextSupport = false, -				dynamicRegistration = false -			}, -			declaration = { -				linkSupport = true -			}, -			definition = { -				dynamicRegistration = true, -				linkSupport = true -			}, -			diagnostic = { -				dynamicRegistration = false -			}, -			documentHighlight = { -				dynamicRegistration = false -			}, -			documentSymbol = { -				dynamicRegistration = false, -				hierarchicalDocumentSymbolSupport = true, -				symbolKind = { -					valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } -				} -			}, -			formatting = { -				dynamicRegistration = true -			}, -			hover = { -				contentFormat = { "markdown", "plaintext" }, -				dynamicRegistration = true -			}, -			implementation = { -				linkSupport = true -			}, -			inlayHint = { -				dynamicRegistration = true, -				resolveSupport = { -					properties = {} -				} -			}, -			publishDiagnostics = { -				dataSupport = true, -				relatedInformation = true, -				tagSupport = { -					valueSet = { 1, 2 } -				} -			}, -			rangeFormatting = { -				dynamicRegistration = true -			}, -			references = { -				dynamicRegistration = false -			}, -			rename = { -				dynamicRegistration = true, -				prepareSupport = true -			}, -			semanticTokens = { -				augmentsSyntaxTokens = true, -				dynamicRegistration = false, -				formats = { "relative" }, -				multilineTokenSupport = false, -				overlappingTokenSupport = true, -				requests = { -					full = { -						delta = true -					}, -					range = false -				}, -				serverCancelSupport = false, -				tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" }, -				tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" } -			}, -			signatureHelp = { -				dynamicRegistration = false, -				signatureInformation = { -					activeParameterSupport = true, -					documentationFormat = { "markdown", "plaintext" }, -					parameterInformation = { -						labelOffsetSupport = true -					} -				} -			}, -			synchronization = { -				didSave = true, -				dynamicRegistration = false, -				willSave = true, -				willSaveWaitUntil = true -			}, -			typeDefinition = { -				linkSupport = true -			} -		}, -		window = { -			showDocument = { -				support = true -			}, -			showMessage = { -				messageActionItem = { -					additionalPropertiesSupport = false -				} -			}, -			workDoneProgress = true -		}, -		workspace = { -			applyEdit = true, -			configuration = true, -			didChangeWatchedFiles = { -				dynamicRegistration = true, -				relativePatternSupport = true -			}, -			inlayHint = { -				refreshSupport = true -			}, -			semanticTokens = { -				refreshSupport = true -			}, -			symbol = { -				dynamicRegistration = false, -				symbolKind = { -					valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } -				} -			}, -			workspaceEdit = { -				resourceOperations = { "rename", "create", "delete" } -			}, -			workspaceFolders = true -		} -	} -} diff --git a/config/essentials/nvim/lua/user/cmp/setup.lua b/config/essentials/nvim/lua/user/cmp/setup.lua deleted file mode 100644 index 1f4db95..0000000 --- a/config/essentials/nvim/lua/user/cmp/setup.lua +++ /dev/null @@ -1,69 +0,0 @@ -local cmp = require 'cmp' -cmp.setup({ -	snippet = { -		expand = function(args) -			require('luasnip').lsp_expand(args.body) -		end, -	}, -	window = { -		completion = cmp.config.window.bordered(), -		documentation = cmp.config.window.bordered(), -	}, -	mapping = cmp.mapping.preset.insert({ -		['<C-b>'] = cmp.mapping.scroll_docs(-4), -		['<C-f>'] = cmp.mapping.scroll_docs(4), -		['<C-Space>'] = cmp.mapping.complete(), -		['<C-c>'] = cmp.mapping.abort(), -		['<C-y>'] = cmp.mapping.confirm({ select = true }), -	}), -	sources = cmp.config.sources({ -		{ name = 'nvim_lua' }, -		{ name = 'nvim_lsp' }, -		{ name = 'path' }, -		{ name = 'luasnip' }, -		{ name = 'nvim_lsp_signature_help' }, -	}), -	preselect = cmp.PreselectMode.None, -}) - -cmp.setup.filetype('gitcommit', { -	sources = cmp.config.sources({ -		{ name = 'cmp_git' }, -	}) -}) - -cmp.setup.cmdline({ '/', '?' }, { -	mapping = cmp.mapping.preset.cmdline(), -}) -cmp.setup.cmdline(':', { -	mapping = cmp.mapping.preset.cmdline(), -	sources = cmp.config.sources({ -		{ name = 'path' }, -		{ name = 'cmdline', keyword_length = 4 } -	}), -}) - -local function nnoremap(rhs, lhs, bufopts, desc) -	bufopts.desc = desc -	vim.keymap.set("n", rhs, lhs, bufopts) -end - -vim.keymap.set('c', '<tab>', '<C-z>', { silent = false }) -- to fix cmp --- Regular Neovim LSP client keymappings -local bufopts = { noremap = true, silent = true } -nnoremap('gD', vim.lsp.buf.declaration, bufopts, "Go to declaration") -nnoremap('gd', vim.lsp.buf.definition, bufopts, "Go to definition") -nnoremap('gi', vim.lsp.buf.implementation, bufopts, "Go to implementation") -nnoremap('K', vim.lsp.buf.hover, bufopts, "Hover text") -nnoremap('<leader>lk', vim.lsp.buf.signature_help, bufopts, "Show signature") -nnoremap('<leader>la', vim.lsp.buf.add_workspace_folder, bufopts, "Add workspace folder") -nnoremap('<leader>lr', vim.lsp.buf.remove_workspace_folder, bufopts, "Remove workspace folder") -nnoremap('<leader>ll', function() -	print(vim.inspect(vim.lsp.buf.list_workspace_folders())) -end, bufopts, "List workspace folders") -nnoremap('<leader>D', vim.lsp.buf.type_definition, bufopts, "Go to type definition") -nnoremap('<leader>rn', vim.lsp.buf.rename, bufopts, "Rename") -nnoremap('<leader><Return>', vim.lsp.buf.code_action, bufopts, "Code actions") -vim.keymap.set('v', "<leader><Return>", "<ESC><CMD>lua vim.lsp.buf.range_code_action()<CR>", -{ noremap=true, silent=true, desc = "Code actions" }) -nnoremap('<leader>f', function() vim.lsp.buf.format { async = true } end, bufopts, "Format file") diff --git a/config/essentials/nvim/lua/user/cmp/sql.lua b/config/essentials/nvim/lua/user/cmp/sql.lua deleted file mode 100644 index 71f6bdf..0000000 --- a/config/essentials/nvim/lua/user/cmp/sql.lua +++ /dev/null @@ -1 +0,0 @@ -require'lspconfig'.sqlls.setup{} diff --git a/config/essentials/nvim/lua/user/init.lua b/config/essentials/nvim/lua/user/init.lua deleted file mode 100644 index de96b5c..0000000 --- a/config/essentials/nvim/lua/user/init.lua +++ /dev/null @@ -1,8 +0,0 @@ -require("user.packer") -require("user.remap") -require("user.treesitter") -require("user.set") --- require("user.cmp") -require("user.zk") -require("user.live-server") -vim.cmd.source(vim.fn.stdpath("config") .. "/lua/user/aucommands.vim") diff --git a/config/essentials/nvim/lua/user/lazy.lua b/config/essentials/nvim/lua/user/lazy.lua deleted file mode 100644 index 5c3148c..0000000 --- a/config/essentials/nvim/lua/user/lazy.lua +++ /dev/null @@ -1,98 +0,0 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then -    vim.fn.system({ -        "git", -        "clone", -        "--filter=blob:none", -        "https://github.com/folke/lazy.nvim.git", -        "--branch=stable", -- latest stable release -        lazypath, -    }) -end -vim.opt.rtp:prepend(lazypath) - -require("lazy").setup({ -    -- Example using a list of specs with the default options -    "folke/which-key.nvim", - -    -- telescope -    { -        'nvim-telescope/telescope.nvim', -        tag = '0.1.4', -        dependencies = { 'nvim-lua/plenary.nvim' } -    }, -    "nvim-telescope/telescope-ui-select.nvim", -    "nvim-telescope/telescope-media-files.nvim", - -    "nvim-telescope/telescope-symbols.nvim", -    "theprimeagen/harpoon", - -    -- colors -    "shaunsingh/nord.nvim", -    { 'uZer/pywal16.nvim',                        name = 'pywal16' }, -    "norcalli/nvim-colorizer.lua", - -    { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' }, -    "nvim-treesitter/playground", - -    -- syntax -    "sheerun/vim-polyglot", -    "theRealCarneiro/hyprland-vim-syntax", - -    "mbbill/undotree", - -    "tpope/vim-capslock", -    "tpope/vim-commentary", -    -- "tpope/vim-endwise", -    "tpope/vim-fugitive", -    "lewis6991/gitsigns.nvim", -    "tpope/vim-repeat", -    "tpope/vim-surround", -    "tpope/vim-vinegar", -    "m4xshen/autoclose.nvim", - -    "christoomey/vim-tmux-navigator", - -    -- utils -    "godlygeek/tabular", -    "renerocksai/calendar-vim", -    "ojroques/vim-oscyank", -    "potamides/pantran.nvim", -    "alx741/vinfo", - -    -- "github/copilot.vim", -    -- -    { -        'https://gitlab.com/itaranto/plantuml.nvim', -        config = function() require('plantuml').setup() end -    }, - -    -- objects -    "michaeljsmith/vim-indent-object", - -    -- completion -    "neovim/nvim-lspconfig", -    "hrsh7th/nvim-cmp", -    "hrsh7th/cmp-nvim-lua", -    "hrsh7th/cmp-nvim-lsp", -    "hrsh7th/cmp-buffer", -    "hrsh7th/cmp-path", -    "hrsh7th/cmp-cmdline", -    "hrsh7th/cmp-nvim-lsp-signature-help", -    "alvan/vim-closetag", - -    -- debugging -    "mfussenegger/nvim-dap", -    { "rcarriga/nvim-dap-ui",            dependencies = { "mfussenegger/nvim-dap" } }, - -    -- java -    "mfussenegger/nvim-jdtls", - -    -- snippets -    "L3MON4D3/LuaSnip", -    "saadparwaiz1/cmp_luasnip", - -    -- notes -    "renerocksai/telekasten.nvim", - -}) diff --git a/config/essentials/nvim/lua/user/live-server.lua b/config/essentials/nvim/lua/user/live-server.lua deleted file mode 100644 index 197809d..0000000 --- a/config/essentials/nvim/lua/user/live-server.lua +++ /dev/null @@ -1,60 +0,0 @@ -local M = {} --- keep track of jobs -local live_servers = {} - -function M.start_live_server() -	if vim.fn.executable('lsof') == 0 then -		print("Error: 'lsof' command not found") -	elseif vim.fn.executable('live-server') == 0 then -		print("Error: 'live-server' command not found") -		return -	end - -	-- Search for available port and use it -    local port = 5500 -    local running = true -    while running do -        local output = vim.fn.systemlist('lsof -i :' .. port) -        if #output == 0 then -            running = false -        else -            port = port + 1 -        end -    end - -    local command = "live-server --no-browser --port=" .. port .. " \"" .. vim.fn.expand("%:p:h") .. "\"" -	-- run -    local job_id = vim.fn.jobstart(command, { -        on_exit = function(_, _, _) end -    }) -	-- save -    live_servers[port] = job_id - -    print("Started live-server on :" .. port .. ".") -end - -function M.stop_live_servers() -    for port, job_id in pairs(live_servers) do -        local output = vim.fn.systemlist('lsof -i :' .. port) -        if #output > 0 then -            vim.fn.jobstop(job_id) -            print("Killed live-server on :" .. port .. ".") -        end -        live_servers[port] = nil -    end -end - -vim.api.nvim_create_user_command("LiveServer", function(opts) -	local opt = string.format(opts.args) -	if #opts.args == 0 then -		M.start_live_server() -	elseif opt == "start" then -		M.start_live_server() -	elseif opt == "stop" then -		M.stop_live_servers() -	else -		print("Invalid argument. Usage: LiveServer [start|stop]") -	end -end, { nargs = '*' }) - -return M diff --git a/config/essentials/nvim/lua/user/packer.lua b/config/essentials/nvim/lua/user/packer.lua deleted file mode 100644 index edb763d..0000000 --- a/config/essentials/nvim/lua/user/packer.lua +++ /dev/null @@ -1,81 +0,0 @@ -return require('packer').startup(function(use) -	use('wbthomason/packer.nvim') - -	-- files -	use { -		'nvim-telescope/telescope.nvim', tag = '0.1.2', -		requires = { { 'nvim-lua/plenary.nvim' } } -	} -	use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } -	use { 'nvim-telescope/telescope-ui-select.nvim' } -	use { 'nvim-telescope/telescope-media-files.nvim' } - -	use('nvim-telescope/telescope-symbols.nvim') -	use('theprimeagen/harpoon') - -	-- colors -	use('shaunsingh/nord.nvim') -	use { 'uZer/pywal16.nvim', as = 'pywal16' } -	use('norcalli/nvim-colorizer.lua') - -	use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' }) -	use('nvim-treesitter/playground') -	use('theRealCarneiro/hyprland-vim-syntax') - -	use('mbbill/undotree') - -	use('tpope/vim-capslock') -	use('tpope/vim-commentary') -	-- use('tpope/vim-endwise') -	use('tpope/vim-fugitive') -	use('lewis6991/gitsigns.nvim') -	use('tpope/vim-repeat') -	use('tpope/vim-surround') -	use('tpope/vim-vinegar') -	use('m4xshen/autoclose.nvim') - -	use('christoomey/vim-tmux-navigator') - -	-- utils -	use('godlygeek/tabular') -	use('renerocksai/calendar-vim') -	use('ojroques/vim-oscyank', { branch = "main" }) -	use("potamides/pantran.nvim") -	use('alx741/vinfo') -	-- use('sheerun/vim-polyglot') TODO: fix error conflicting with telekasten -	-- use('github/copilot.vim') -	-- -	use { -		'https://gitlab.com/itaranto/plantuml.nvim', -		tag = '*', -		config = function() require('plantuml').setup() end -	} - -	-- objects -	use('michaeljsmith/vim-indent-object') - -	-- completion -	use('neovim/nvim-lspconfig') -	use('hrsh7th/nvim-cmp') -	use('hrsh7th/cmp-nvim-lua') -	use('hrsh7th/cmp-nvim-lsp') -	use('hrsh7th/cmp-buffer') -	use('hrsh7th/cmp-path') -	use('hrsh7th/cmp-cmdline') -	use('hrsh7th/cmp-nvim-lsp-signature-help') -	use('alvan/vim-closetag') - -	-- debugging -	use('mfussenegger/nvim-dap') -	use { "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } } - -	-- java -	use('mfussenegger/nvim-jdtls') - -	-- snippets -	use('L3MON4D3/LuaSnip') -	use('saadparwaiz1/cmp_luasnip') - -	-- notes -	use('renerocksai/telekasten.nvim') -end) diff --git a/config/essentials/nvim/lua/user/remap.lua b/config/essentials/nvim/lua/user/remap.lua deleted file mode 100644 index 505ab01..0000000 --- a/config/essentials/nvim/lua/user/remap.lua +++ /dev/null @@ -1,107 +0,0 @@ -vim.g.mapleader = " " -vim.g.maplocalleader = "\\" - --- -- vinegar is already doing this --- vim.keymap.set("n", "-", vim.cmd.Ex) - --- moving -vim.keymap.set("i", "<C-a>", "<C-o>I", { noremap = true }) -vim.keymap.set("i", "<C-e>", "<C-o>A", { noremap = true }) -vim.keymap.set("i", "<C-k>", "<C-o>D", { noremap = true }) - -vim.keymap.set("i", "\\\\", "\\", { noremap = true }) - --- buffers -vim.keymap.set("n", "gb", "<cmd>buffers<cr>:buffer<Space>", { noremap = true }) -vim.keymap.set("n", "<Leader>q", "<cmd>q!<cr>", { noremap = true }) -vim.keymap.set("n", "<Leader>Q", "<cmd>qa!<cr>", { noremap = true }) --- close all except focused buffer -vim.keymap.set("n", "<leader>1", "<cmd>%bd|e#<cr>", { noremap = true }) - --- command line -vim.keymap.set("c", "<M-b>", "<C-Left>", { noremap = true }) -vim.keymap.set("c", "<M-f>", "<C-Right>", { noremap = true }) -vim.keymap.set("c", "<M-d>", "<C-Right><C-w>", { noremap = true }) -vim.keymap.set("c", "<C-f>", "<Right>", { noremap = true }) -vim.keymap.set("c", "<C-b>", "<Left>", { noremap = true }) -vim.keymap.set("c", "<C-a>", "<Home>", { noremap = true }) - --- move visual selection up/down wards -vim.keymap.set("v", "J",  "<cmd>m '>+1<cr>gv=gv<cr>", { noremap = true }) -vim.keymap.set("v", "K", "<cmd>m '<-2<cr>gv=gv<cr>", { noremap = true }) - -vim.keymap.set("n", "+", "<cmd>tabe .<cr>", { noremap = true }) - --- clipboard -vim.keymap.set("n", "<Leader>y", "\"+y", { noremap = true }) - --- templates -vim.keymap.set("n", "<LocalLeader>rt", ":-1r " .. vim.fn.stdpath("config") .. "/templates", { noremap = true }) - --- hide all -local s = {hidden_all = 0} -vim.keymap.set("n", "<C-h>", function () -	s.hidden_all = 1 - s.hidden_all -	local opt = s.hidden_all == 0 -	vim.opt.showmode = opt -	vim.opt.ruler = opt -	vim.opt.nu = opt -	vim.opt.rnu = opt -	vim.opt.showcmd = opt -	vim.opt.laststatus = opt and 2 or 0 -	vim.opt.signcolumn = opt and "yes" or "no" -end, { noremap = true }) - --- utils -vim.keymap.set("i", "<LocalLeader>r", "<cmd>r!echo -n $RANDOM<cr><esc>kJA", { noremap = true }) - --- FORMATTING --- ordered list -vim.keymap.set("n", "<LocalLeader>n", "<C-v>I0. <esc>gvg<C-a>", { noremap = true }) -vim.keymap.set("v", "<Leader>u", "<cmd>'<,'>s/^[0-9]\\+\\. //<cr><esc>", { noremap = true }) --- table -vim.keymap.set("v", "<LocalLeader>t", "!column -t -s '|' -o '|'<cr>", { noremap = true }) - --- scripts -vim.keymap.set("n", "<Leader>x", "<cmd>!chmod +x %<cr>", { noremap = true, silent = true}) --- replace -vim.keymap.set("n", "<Leader>sf", [[:%s/\<<C-r><C-w>\>/<C-r><C-w><C-w>/gI<Left><Left><Left>]]) -vim.keymap.set("n", "<Leader>sl", [[:s/\<<C-r><C-w>\>/<C-r><C-w><C-w>/gI<Left><Left><Left>]]) -vim.keymap.set("n", "<LocalLeader>f", "<cmd>.!fold -w 80 -s<cr>") - --- write -vim.keymap.set("n", "<Leader>w", "<cmd>write<cr>", { noremap = true }) -vim.keymap.set("n", "<Leader>W", "<cmd>write!<cr>", { noremap = true }) -vim.keymap.set("n", "<Leader>e", "<cmd>edit<cr>", { noremap = true }) -vim.keymap.set("n", "<LocalLeader>s", function () -	vim.cmd.source() -	print("sourced.") -end, { noremap = true }) - --- Lazy -vim.keymap.set("n", "<Leader>P", "<cmd>Lazy<cr>", { noremap = true }) - --- spelling -vim.keymap.set("n", "<C-s>s", "<cmd>setlocal spell!<cr>", { noremap = true }) -vim.keymap.set("n", "<C-s>g", "z=1<cr><cr>", { noremap = true }) - --- -- open terminal in file's parent director --- -- this needs to be asynchrous --- vim.keymap.set("n", "<Return>", function () ---     local cmd = "cd " .. vim.fn.expand("%:p:h") .. "; setsid $TERMINAL" --- 	-- asynchrous go brr ---     vim.fn.jobstart(cmd, { on_exit = function(job_id, exit_code, event_type) end }) --- end, { noremap = true }) - - --- clear registers -vim.keymap.set("n", "<Leader>rc", function () -	local regs = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', -				  'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', -				  'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', -				  'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', -				  '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '/', '-', '"'} -	for _, r in ipairs(regs) do -	  vim.fn.setreg(r, {}) -	end -end, { noremap = true }) diff --git a/config/essentials/nvim/lua/user/set.lua b/config/essentials/nvim/lua/user/set.lua deleted file mode 100644 index e236a1d..0000000 --- a/config/essentials/nvim/lua/user/set.lua +++ /dev/null @@ -1,57 +0,0 @@ -local opt = vim.opt - -opt.clipboard = "unnamed" - -opt.termguicolors = true - -opt.number = true -opt.relativenumber = true -opt.showmatch = true -opt.matchtime = 0 -opt.showcmd = true -opt.cursorline = true -opt.ruler = true - -opt.path:append("**") - -opt.wildmenu = true -opt.incsearch = true -opt.hlsearch = false - -opt.mouse = "" - -opt.tabstop = 4 -opt.shiftwidth = 4 -opt.expandtab = true -opt.backspace = "indent,eol,start" - -opt.signcolumn = "yes" -opt.updatetime = 100 -opt.laststatus = 2 -opt.history = 200 -opt.encoding = "utf-8" -opt.fileencoding = "utf-8" - -opt.smartindent = true -opt.scrolloff = 8 - -opt.ignorecase = true -opt.smartcase = true - -opt.swapfile = false -opt.backup = false - -opt.spelllang = "en_us,nl" -opt.formatoptions = "cqrnj" - --- Get the current working directory, replace the $HOME portion of the path with ~, --- and extract the last three directories -local cwd = vim.fn.getcwd():gsub(os.getenv('HOME'), '~') -local last_dirs = string.match(cwd, "[^/]+/[^/]+/[^/]+/?$") -if last_dirs then -	opt.titlestring = last_dirs .. " -> %t" -else -	opt.titlestring = cwd .. " -> %t" -end - -opt.title = true diff --git a/config/essentials/nvim/lua/user/treesitter.lua b/config/essentials/nvim/lua/user/treesitter.lua deleted file mode 100644 index 2355215..0000000 --- a/config/essentials/nvim/lua/user/treesitter.lua +++ /dev/null @@ -1,17 +0,0 @@ -require'nvim-treesitter.configs'.setup { -  -- A list of parser names, or "all" (the five listed parsers should always be installed) -  ensure_installed = { "c", "lua", "vim", "vimdoc", "query" }, - -  -- Install parsers synchronously (only applied to `ensure_installed`) -  sync_install = false, - -  -- Automatically install missing parsers when entering buffer -  -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally -  auto_install = true, - -  indent = { enable = on }, - -  highlight = { enable = true, }, - -    additional_vim_regex_highlighting = false, -} diff --git a/config/essentials/nvim/lua/user/zk.lua b/config/essentials/nvim/lua/user/zk.lua deleted file mode 100644 index 3641025..0000000 --- a/config/essentials/nvim/lua/user/zk.lua +++ /dev/null @@ -1,129 +0,0 @@ -local home = vim.fn.expand("~/docs/zk") - -require("telekasten").setup({ -	home         = home, -	take_over_my_home = true, -	auto_set_filetype = true, -	auto_set_syntax = true, -	dailies      = home .. '/' .. 'daily', -	weeklies     = home .. '/' .. 'weekly', -	templates    = home .. '/' .. 'templates', -	image_subdir = "img", -	extension    = ".md", -	new_note_filename = "title", -	uuid_type = "%Y%m%d%H%M", -	uuid_sep = "-", -	filename_space_subst = nil, -	follow_creates_nonexisting = true, -	dailies_create_nonexisting = true, -	weeklies_create_nonexisting = true, -	journal_auto_open = false, -	template_new_note = home .. '/' .. 'templates/new_note.md', -	template_new_daily = home .. '/' .. 'templates/daily.md', -	template_new_weekly= home .. '/' .. 'templates/weekly.md', -	image_link_style = "markdown", -	sort = "filename", -	plug_into_calendar = true, -	calendar_opts = { -		weeknm = 4, -		calendar_monday = 1, -		calendar_mark = 'left-fit', -	}, -	close_after_yanking = false, -	insert_after_inserting = true, -	tag_notation = "#tag", -	command_palette_theme = "dropdown", -	show_tags_theme = "ivy", -	subdirs_in_links = true, -	template_handling = "smart", -	new_note_location = "smart", -	rename_update_links = true, -	media_previewer = "telescope-media-files", -	follow_url_fallback = nil, -	vaults = { -		Ideas = { -			home = home .. "/" .. "Ideas", -			template_new_note = home .. "/" .. "templates/new_note.md", -			new_note_filename = "title", -		}, -		Driving = { -			home = home .. "/" .. "Driving", -			template_new_note = home .. "/" .. "templates/new_note.md", -			new_note_filename = "title", -		}, -		BusinessEnglish = { -			home = home .. "/" .. "BusinessEnglish", -			template_new_note = home .. "/" .. "templates/school.md", -			new_note_filename = "title", -		}, -		DataEssentials = { -			home = home .. "/" .. "DataEssentials", -			template_new_note = home .. "/" .. "templates/school.md", -			new_note_filename = "title", -		}, -		SoftwareDesign = { -			home = home .. "/" .. "SoftwareDesign", -			template_new_note = home .. "/" .. "templates/school.md", -			new_note_filename = "title", -		}, -		BusinessCommunication = { -			home = home .. "/" .. "BusinessCommunication", -			template_new_note = home .. "/" .. "templates/school.md", -			new_note_filename = "title", -		}, -		AIEssentials = { -			home = home .. "/" .. "AIEssentials", -			template_new_note = home .. "/" .. "templates/school.md", -			new_note_filename = "title", -		}, -		NETEssentials = { -			home = home .. "/" .. "NETEssentials", -			template_new_note = home .. "/" .. "templates/school.md", -			new_note_filename = "title", -		}, -		iTalent = { -			home = home .. "/" .. "iTalent", -			template_new_note = home .. "/" .. "templates/school.md", -			new_note_filename = "title", -		}, -		ScalingNetworks = { -			home = home .. "/" .. "ScalingNetworks", -			template_new_note = home .. "/" .. "templates/school.md", -			new_note_filename = "title", -		}, -		RoutingSwitchingEssentials = { -			home = home .. "/" .. "RoutingSwitchingEssentials", -			template_new_note = home .. "/" .. "templates/school.md", -			new_note_filename = "title", -		}, -		SoftwareDesignAndQualityAssurance = { -			home = home .. "/" .. "SoftwareDesignAndQualityAssurance", -			template_new_note = home .. "/" .. "templates/school.md", -			new_note_filename = "title", -		}, -		C = { -			home = home .. "/" .. "C", -			template_new_note = home .. "/" .. "templates/new_note.md", -			new_note_filename = "title", -		}, -	} -}) - -vim.keymap.set("n", "<leader>z", require("telekasten").panel) -vim.keymap.set("n", "<leader>zb", require("telekasten").show_backlinks) -vim.keymap.set("n", "<leader>zz", require("telekasten").follow_link) -vim.keymap.set("n", "<leader>zN", require("telekasten").new_templated_note) -vim.keymap.set("n", "<leader>zT", require("telekasten").goto_today) -vim.keymap.set("n", "<leader>zW", require("telekasten").goto_thisweek) -vim.keymap.set("n", "<leader>zd", require("telekasten").find_daily_notes) -vim.keymap.set("n", "<leader>zf", require("telekasten").find_notes) -vim.keymap.set("n", "<leader>zg", require("telekasten").search_notes) -vim.keymap.set("n", "<leader>zm", require("telekasten").browse_media) -vim.keymap.set("n", "<leader>zn", require("telekasten").new_note) -vim.keymap.set("n", "<leader>zp", require("telekasten").preview_img) -vim.keymap.set("n", "<leader>zr", require("telekasten").rename_note) -vim.keymap.set("n", "<leader>zs", require("telekasten").switch_vault) -vim.keymap.set("n", "<leader>zS", require("telekasten").search_notes) -vim.keymap.set("n", "<leader>zt", require("telekasten").panel) -vim.keymap.set("n", "<leader>zw", require("telekasten").find_weekly_notes) -vim.keymap.set("n", "<leader>z#", require("telekasten").show_backlinks) diff --git a/config/essentials/nvim/templates/cpp.make b/config/essentials/nvim/templates/cpp.make deleted file mode 100644 index 474cd78..0000000 --- a/config/essentials/nvim/templates/cpp.make +++ /dev/null @@ -1,4 +0,0 @@ -FILE =  - -$(FILE): $(FILE).cpp -	c++ -Wall -Werror -ggdb $(FILE).cpp -o $(FILE) diff --git a/config/essentials/nvim/templates/inp.sh b/config/essentials/nvim/templates/inp.sh deleted file mode 100644 index 3507cd5..0000000 --- a/config/essentials/nvim/templates/inp.sh +++ /dev/null @@ -1,3 +0,0 @@ -test -z "${inp:=$1}" &&  -	inp="$(cat /dev/stdin)" -echo "inp: ${inp}" 1>&2 diff --git a/config/essentials/nvim/templates/main.cpp b/config/essentials/nvim/templates/main.cpp deleted file mode 100644 index 3d4f0fb..0000000 --- a/config/essentials/nvim/templates/main.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include <iostream> -using namespace std; - -int main() { -	return 0; -} diff --git a/config/essentials/nvim/templates/main.java b/config/essentials/nvim/templates/main.java deleted file mode 100644 index 04d1154..0000000 --- a/config/essentials/nvim/templates/main.java +++ /dev/null @@ -1,5 +0,0 @@ -public class Main { -	public static void main (String[] args) { -		// some code -	} -} diff --git a/config/essentials/nvim/templates/minp.sh b/config/essentials/nvim/templates/minp.sh deleted file mode 100644 index d91d249..0000000 --- a/config/essentials/nvim/templates/minp.sh +++ /dev/null @@ -1,9 +0,0 @@ -if [ "$MENUCMD" ] && [ -z "${inp:=$1}" ] -then -	inp="$($MENUCMD < /dev/null)" -else -	echo "input:" >&2 -	read inp -fi -test -z "$inp" && -	exit 1 diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index 68b66f2..77c7684 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -3,6 +3,7 @@  # The most important one  alias vi='nvim' +alias cd='z'  # Zsh specific aliases  if [ $SHELL = "/bin/zsh" ] @@ -149,6 +150,7 @@ alias wd='dict'  # ssh  alias sha='ssh-add'  alias sshs='eval "$(ssh-agent)" && ssh-add' +alias sshids='ssh-add -L | xargs -I{} grep "{}" -l $(find "$HOME/.ssh" -type f -iname '\''*.pub'\'') | sed "s;$HOME/.ssh/;;;s;\.pub$;;"'  alias whatsmyip='curl -s "ifconfig.co"'  alias icognito='unset HISTFILE'  alias webcam='v4l2-ctl --set-fmt-video=width=1280,height=720; mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0 --profile=low-latency --untimed --no-resume-playback' @@ -167,7 +169,14 @@ alias wgdown='doas wg-quick down wg0'  alias npi="npm init --yes"  # Python -alias penv='python3 -m venv env' + +if which uv > /dev/null 2>&1 +then +    alias penv='uv venv env' +    alias pip='uv pip' +else +    alias penv='python3 -m venv env' +fi  alias phttp='python3 -m http.server'  alias pipreq='pip install -r requirements.txt' @@ -331,3 +340,10 @@ alias update-mirrors='reflector -p https | rankmirrors -n 10 -p -w - | doas tee  alias tmpd='cd $(mktemp -d)'  alias brs='$BROWSER' +which bat > /dev/null 2>&1 && +    alias cat="bat -p" + +alias glf='git pull --ff' +alias glnf='git pull --no-ff' +alias quickvms='/media/cricket/vms/quickemu/"$(find '\''/media/cricket/vms/quickemu/'\'' -type f -iname '\''*.conf'\'' -printf '\''%f +'\'' | sed '\''s/\.conf$//'\'' | fzf)".conf 2> /dev/null' diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 299b5e8..9f7f4ce 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -50,7 +50,7 @@ og()  	_googoo_fzf_opt "$1"  	cd "$(goo d "$dest" | fzf $opt)"  } -ogo() +oog()  {  	_googoo_fzf_opt "$1"  	cd "$(dirname "$(goo f "$dest" | fzf $opt)")" @@ -68,7 +68,10 @@ sms() { ssh -t phone sendmsg "$1" "'$2'"; }  trcp() { scp "$1" db:/media/basilisk/downloads/transmission/torrents/; }  rln() { ln -s "$(readlink -f "$1")" "$2"; }  getgit() { git clone git@db:"$1"; } +  esc() { eval "$EDITOR '$(which $1)'"; } +compdef esc="which" +  delfile() { curl -s "${2:-https://upfast.cronyakatsuki.xyz/delete/$1}"; }  upfile() { curl -s -F "file=@\"$1\"" "${2:-https://0x0.st}"; }  to_webm() { ffmpeg -y -i "$1" -vcodec libvpx -cpu-used -12 -deadline realtime "${1%.*}".webm; } @@ -292,3 +295,72 @@ edit_in_dir() {  	[ -f "$file" ] || return 1  	$EDITOR "$file"  } + +# Download a file from google drive +# link like this: https://drive.usercontent.google.com/download?id=1TiJDEftTtF1KTMBI950Bj487ndYqkwpQ&export=download +gdown () { +        agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12$(head /dev/urandom | tr -dc '0-1' | cut -c1).0.0.0 Safari/537.36" +        uuid=$(curl -sL "$1" -A "$agent" | sed -nE 's|.*(uuid=[^"]*)".*|\1|p') +        aria2c -x16 -s16 "$1&confirm=t&$uuid" -U "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36" --summary-interval=0 -d "${2:-.}" +} + +# toggle wireguard vpn on $1 -> interface +wgtoggle() {  +	d="${1:-wg0}" +	ip -br a | awk '{print $1}' | grep "$d" > /dev/null && +        doas wg-quick down "$d" || +        doas wg-quick up "$d" +} + +# serve a file through dufs +serve() { +    if [ "$1" ] +    then +        logn "Serving $1" +        docker container run \ +            --rm \ +            --volume "$(readlink -f "$1")":/data \ +            --publish 80:5000 sigoden/dufs /data +    else + +        logn "Receiving files.." +        docker container run \ +            --rm \ +            --volume /tmp/data:/data \ +            --publish 80:5000 sigoden/dufs /data --allow-upload +    fi +} + +ssh_keyadd() { ssh-keygen -f "$HOME"/.ssh/"$1" -P "$(pass generate -f keys/"$HOST"/ssh/"$1" | tail -n 1)" -t ed25519; } + + +fchange() +{ +    [ "$1" ] || return 1 +    inotifywait -m -e create,modify,delete --format "%f" "${2:-.}"  | +        while read -r EVENT +        do +            eval "$1" +        done +} + +unhappy.exe() { +    [ "$1" ] && +        smiles=("[: " ".-." " :]" "._.") || +        smiles=("]: " ".-." " :[" "._.") + +	while true +	do +		for s in $smiles +		do +			printf '\r%s' "$s" +			sleep 1 +		done +	done +} + +ssh_port() +{ +    ssh -f -N -L 0.0.0.0:"$3":localhost:"$1" "$2" +    >&2 printf "Forwarded port '%s' on '%s' to '%s'.\n" "$1" "$2" "$3" +} diff --git a/config/essentials/starship.toml b/config/essentials/starship.toml index cd5832f..efcaf48 100644 --- a/config/essentials/starship.toml +++ b/config/essentials/starship.toml @@ -3,7 +3,7 @@  # Inserts a blank line between shell prompts  add_newline = false  # format = ' ${custom.upds}' -format = ' [\[$username@$hostname\]](bg:#000000) ${custom.upds}$all' +format = ' [\[$username@$hostname\]](bg:#000000) $all'  right_format = """$status"""  [character] @@ -32,10 +32,8 @@ min_time = 500  format = '($status)'  disabled = false -[custom.upds] -command = 'cat ~/.cache/updates' # shows output of command -# detect_files = ['foo'] # can specify filters but wildcards are not supported -when = ''' test "$(cat ~/.cache/updates)" -gt 0''' -symbol = '📦' -format = '$output$symbol ' - +# [custom.upds] +# command = 'cat ~/.cache/updates' # shows output of command +# when = '[ "$(cat ~/.cache/updates)" -gt 0 ]' +# symbol = '📦' +# format = '$output$symbol ' diff --git a/config/essentials/zsh/.gitignore b/config/essentials/zsh/.gitignore index b717a37..a13c79f 100644 --- a/config/essentials/zsh/.gitignore +++ b/config/essentials/zsh/.gitignore @@ -1,2 +1,3 @@  histfile -zcompcache
\ No newline at end of file +zcompcache +.zcompdump diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index ccec6d5..91a1618 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -18,9 +18,9 @@ autoload -z edit-command-line  zle -N edit-command-line  ### Source files +. $XDG_CONFIG_HOME/zsh/comp.zsh  . $XDG_CONFIG_HOME/shell/functions.sh  . $XDG_CONFIG_HOME/shell/aliases.sh -. $XDG_CONFIG_HOME/zsh/comp.zsh  . $XDG_CONFIG_HOME/zsh/widgets.zsh  # . $XDG_CONFIG_HOME/zsh/prompt.zsh  # . $XDG_CONFIG_HOME/zsh/plugins.zsh @@ -115,7 +115,7 @@ add-zsh-hook -Uz preexec () { print -n "\e]0;$1\a\033[0m"; }  add-zsh-hook -Uz precmd set_wt (){ print -Pn "\e]0;%n@%m on %~\a"; }  ## automatic ls after cd -add-zsh-hook -Uz chpwd (){ [ "$PWD" = "$HOME" ] || ls -a; } +add-zsh-hook -Uz chpwd (){ [ "$PWD" = "$HOME" ] || ls -A; }  ### Variables  ## Run menuscripts with fzf diff --git a/config/extra/tridactyl/tridactylrc b/config/extra/tridactyl/tridactylrc index 1a96af5..5b8bd54 100644 --- a/config/extra/tridactyl/tridactylrc +++ b/config/extra/tridactyl/tridactylrc @@ -35,6 +35,7 @@ set searchurls.y https://www.youtube.com/results?search_query=%s  bind J tabnext  bind K tabprev +bind i filldmcdline bmarks  bind goc open https://chat.openai.com/chat  bind gnc winopen https://chat.openai.com/chat  bind gpc tabopen https://chat.openai.com/chat diff --git a/config/home/.zshenv b/config/home/.zshenv index 7d23dd7..46cc3e3 100644 --- a/config/home/.zshenv +++ b/config/home/.zshenv @@ -2,7 +2,7 @@  export EDITOR="vis"  export VISUAL="vis" -export BROWSER="librewolf" +export BROWSER="osurf"  export VIEWER="zathura"  export PLAYER="mpv" @@ -11,23 +11,37 @@ export XDG_CACHE_HOME="$HOME"/.cache  export XDG_DATA_HOME="$HOME"/.local/share  export XDG_STATE_HOME="$HOME"/.local/state +export ANDROID_USER_HOME="$XDG_DATA_HOME"/android +export BUNDLE_USER_CACHE="$XDG_CACHE_HOME"/bundle +export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME"/bundle +export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME"/bundle  export CARGO_HOME="$XDG_CONFIG_HOME"/cargo -export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc +export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker +export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet  export GNUPGHOME="$XDG_CONFIG_HOME"/gnupg +export GOMODCACHE="$XDG_CACHE_HOME"/go/mod +export GOPATH="$XDG_DATA_HOME"/go +export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc  export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc-2.0 +export MYSQL_HISTFILE="$XDG_DATA_HOME"/mysql_history +export NODE_REPL_HISTORY="$XDG_DATA_HOME"/node_repl_history  export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc -export NVM_DIR="$XDG_DATA_HOME"/nvm -export W3M_DIR="$XDG_STATE_HOME"/w3m -export GOPATH="$XDG_DATA_HOME"/go -export GOMODCACHE="$XDG_CACHE_HOME"/go/mod -export TNS_ADMIN=/opt/oracle/instantclient_21_9/network/admin -export WGETRC="$XDG_CONFIG_HOME"/wgetrc  export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages +export NVM_DIR="$XDG_DATA_HOME"/nvm +export OMNISHARPHOME="$XDG_CONFIG_HOME"/omnisharp  export PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel -export MYSQL_HISTFILE="$XDG_DATA_HOME"/mysql_history  export RANDFILE="$XDG_CACHE_HOME"/rnd -export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages -export PARALLEL_HOME="$XDG_CACHE_HOME"/parallel +export RUSTUP_HOME="$XDG_DATA_HOME"/rustup +export TERMINFO="$XDG_DATA_HOME"/terminfo +export TERMINFO_DIRS="$XDG_DATA_HOME"/terminfo:/usr/share/terminfo +export TNS_ADMIN=/opt/oracle/instantclient_21_9/network/admin +export W3M_DIR="$XDG_STATE_HOME"/w3m +export WGETRC="$XDG_CONFIG_HOME"/wgetrc +export WINEPREFIX="$XDG_DATA_HOME"/wine +export XCURSOR_PATH=/usr/share/icons:"$XDG_DATA_HOME"/icons +alias adb='HOME="$XDG_DATA_HOME"/android adb' +alias irssi='irssi --config="$XDG_CONFIG_HOME"/irssi/config --home="$XDG_DATA_HOME"/irssi' +alias mbsync='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc'  export XINITRC="$XDG_CONFIG_HOME"/x11/xinitrc  export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority @@ -64,13 +78,18 @@ export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS'      --color=info:#b48ead,prompt:#bf6069,pointer:#b48dac      --color=marker:#a3be8b,spinner:#ebcb8b,header:#a3be8b' +export LESS="-i -r" +  # Colored manpages  export MANPAGER="less -R --use-color -Dd+r -Du+b"  export MANROFFOPT="-P -c" +export CM_LAUNCHER="commander -c" +  export PATH="$HOME/.local/bin:$PATH"  export PATH="$HOME/bin:$PATH"  export PATH="$HOME/go/bin:$PATH"  export PATH="$XDG_CONFIG_HOME/cargo/bin:$PATH"  export PATH="$PATH:./node_modules/.bin"  export PATH="$PATH:$HOME/.dotnet/tools" +export PATH="$PATH:$GOPATH/bin" diff --git a/config/theme/gtk-2.0/gtkfilechooser.ini b/config/theme/gtk-2.0/gtkfilechooser.ini index f477cff..bfbffb9 100644 --- a/config/theme/gtk-2.0/gtkfilechooser.ini +++ b/config/theme/gtk-2.0/gtkfilechooser.ini @@ -2,8 +2,8 @@  LocationMode=path-bar  ShowHidden=false  ShowSizeColumn=true -GeometryX=0 -GeometryY=0 +GeometryX=567 +GeometryY=160  GeometryWidth=836  GeometryHeight=626  SortColumn=name diff --git a/config/wayland/foot/foot.ini b/config/wayland/foot/foot.ini index 00e7a37..a1fc1e8 100644 --- a/config/wayland/foot/foot.ini +++ b/config/wayland/foot/foot.ini @@ -9,7 +9,7 @@ term=xterm-256color  title=""  # locked-title=no -font=monospace:size=11 +font=monospace:size=10.5  # font-bold=<bold variant of regular font>  # font-italic=<italic variant of regular font>  # font-bold-italic=<bold+italic variant of regular font> diff --git a/config/wayland/hypr/hyprland.conf b/config/wayland/hypr/hyprland.conf index eb232c9..0a00b31 100644 --- a/config/wayland/hypr/hyprland.conf +++ b/config/wayland/hypr/hyprland.conf @@ -8,9 +8,9 @@ exec-once = $HOME/.config/hypr/startup.sh  input {      kb_layout = us -    kb_variant = +    kb_variant = colemak      kb_model = -    kb_options = ctrl:swapcaps +    kb_options = ctrl:swapcaps,altwin:menu_win      kb_rules =      follow_mouse = 2 diff --git a/config/wayland/waybar/colors.css b/config/wayland/waybar/colors.css deleted file mode 120000 index 38b29a4..0000000 --- a/config/wayland/waybar/colors.css +++ /dev/null @@ -1 +0,0 @@ -/home/aluc/.config/waybar/colors/colors-nord
\ No newline at end of file diff --git a/config/wayland/waybar/config.jsonc b/config/wayland/waybar/config.jsonc index 24065d3..aa93297 120000..100644 --- a/config/wayland/waybar/config.jsonc +++ b/config/wayland/waybar/config.jsonc @@ -1 +1,16 @@ -hyprland.jsonc
\ No newline at end of file +{ +	"modules-left": ["hyprland/workspaces", "custom/layout", "hyprland/window"], +	"modules-right": ["custom/status"], +	"hyprland/window": { +		"format": " {} " +	}, +	"custom/layout": {  +		"format": " []= ", +		"interval": "once", +	}, +	"custom/status": {  +		"exec": "~/.config/waybar/status.sh", +		"format": " {} ", +		"interval": 1 +	} +}  | 
