Cleanup

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2025-06-30 21:14:14 +0200
Committer Mitja Felicijan <mitja.felicijan@gmail.com> 2025-06-30 21:14:14 +0200
Commit 3a206881b8e16fc9eddf0f31a908b531f56e2e5c (patch)
-rwxr-xr-x .shenanigans.sh 113
-rw-r--r-- .vimrc 2
2 files changed, 8 insertions, 107 deletions
diff --git a/.shenanigans.sh b/.shenanigans.sh
1
# Software list:
1
# Software list (Void Linux):
2
#   git gcc make cmake busybox cifs-utils tree hstr curl
2
#   void-repo-nonfree void-repo-multilib void-repo-multilib-nonfree
3
#   s3cmd xmlstarlet htop nvtop tmux xclip jq pipx newsboat
3
#   file-roller xfce4-screenshooter xsetroot
4
#   stow rsync entr vim vifm xxd sbcl rlwrap tig ack
4
#   clang clang-tools-extra vim stow git curl tmux hstr tree make cmake
5
#   clang clang-tidy clang-tools-extra clangd clang-analyzer
5
#   entr ack lazygit newsboat htop
6
# Linters & Additonal stuff:
  
7
#   pipx install pyright
  
8
#   go install golang.org/x/tools/gopls@latest
  
9
#   sudo npm i -g dockerfile_lint
  
10
#   sudo npm i -g @biomejs/biome
  
11
  
6
  
12
# Only run if the script is being sourced (bashrc).
7
# Only run if the script is being sourced (bashrc).
13
if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
8
if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
14
	# Magical environment variables.
9
	# Magical environment variables.
15
	export NIX_SHELL_PRESERVE_PROMPT=1
  
16
	export COLORTERM=truecolor
10
	export COLORTERM=truecolor
17
	export TERM=xterm-256color
11
	export TERM=xterm-256color
18
	export VISUAL=vim
12
	export VISUAL=vim
19
	export EDITOR=vim
13
	export EDITOR=vim
20
  
14
  
21
	parse_git_branch() {
  
22
		git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
  
23
	}
  
24
  
  
25
	is_inside_nix_shell() {
  
26
		nix_shell_name="$(basename "$IN_NIX_SHELL" 2>/dev/null)"
  
27
		if [[ -n "$nix_shell_name" ]]; then
  
28
			echo " \e[0;36m(nix-shell)\e[0m"
  
29
		fi
  
30
	}
  
31
  
  
32
	# Better prompt.
15
	# Better prompt.
33
	export PS1="\n[\033[38;5;166m\]\u@\h\[$(tput sgr0)\]] \033[90m\T\033[0m$(is_inside_nix_shell)\[\033[33m\]\$(parse_git_branch)\[\033[00m\] \w\[$(tput sgr0)\] \n$ "
16
	export PS1="\n# \u@\h \T \w\n# "
34
  
17
  
35
	# General aliases.
18
	# General aliases.
36
	alias l='ls -lh'
19
	alias l='ls -lh'
37
	alias ll='ls -lha'
20
	alias ll='ls -lha'
38
	alias t='tree -L 2'
21
	alias t='tree -L 2'
39
	alias ..='cd ..'
22
	alias ..='cd ..'
40
	alias grep='grep --color=always'
23
	alias grep='grep -irn --color=always'
41
	alias less='less -R'
24
	alias less='less -R'
42
	alias tmux='tmux -u'
25
	alias tmux='tmux -u'
43
	alias server='python3 -m http.server 6969'
26
	alias server='python3 -m http.server 6969'
44
	alias newsboat='newsboat -r -u ~/.feeds.txt'
27
	alias newsboat='newsboat -r -u ~/.feeds.txt'
45
	alias ack='ack -S'
28
	alias ack='ack -S'
46
	alias gg='lazygit'
29
	alias gg='lazygit'
47
	alias gd='lazydocker'
  
48
	alias tf='terraform'
  
49
	alias tg='terragrunt'
  
50
	alias tgl='TERRAGRUNT_USE_LOCAL_SOURCES=1 terragrunt'
  
51
  
30
  
52
	# Custom folder jump commands.
31
	# Custom folder jump commands.
53
	alias j='cd ~/Junk'
32
	alias j='cd ~/Junk'
54
	alias p='cd ~/Vault/projects'
33
	alias p='cd ~/Projects'
55
	alias s='cd ~/Vault/sandbox'
  
56
	alias d='cd ~/Downloads'
34
	alias d='cd ~/Downloads'
57
  
35
  
58
	# Additional path settings.
  
59
	export PATH=$HOME/Applications:$PATH
  
60
	export PATH=$HOME/go/bin:$PATH
  
61
	export PATH=$HOME/.local/bin:$PATH
  
62
	export PATH=/usr/local/go/bin:$PATH
  
63
	export PATH=$HOME/Applications/google-cloud-sdk/bin:$PATH
  
64
	export PATH=$HOME/.local/bin/luals/bin:$PATH
  
65
  
  
66
	# History and search. Stolen from J.
36
	# History and search. Stolen from J.
67
	HISTCONTROL=ignoreboth
37
	HISTCONTROL=ignoreboth
68
	shopt -s histappend
38
	shopt -s histappend
...
75
	export HSTR_CONFIG=hicolor
45
	export HSTR_CONFIG=hicolor
76
	if [[ $- =~ .i. ]]; then bind '"\C-h": "\C-a hstr -- \C-j"'; fi
46
	if [[ $- =~ .i. ]]; then bind '"\C-h": "\C-a hstr -- \C-j"'; fi
77
fi
47
fi
78
  
  
79
# Backup to NAS function. Much wow!
  
80
backup() {
  
81
	CWD=$(pwd)
  
82
	VHOME=/home/$USER/Vault
  
83
	ME=$(whoami)@$(hostname)
  
84
  
  
85
	# Create folders etc.
  
86
	cd $VHOME && mkdir -p $VHOME/dotfiles
  
87
  
  
88
	# Everything dotfiles.
  
89
	cd $VHOME/dotfiles
  
90
	rsync -azhv /home/$USER/.bash_history_infinite bash_history_infinite
  
91
	rsync -azhv /home/$USER/.ssh/ ssh
  
92
	rsync -azhv /home/$USER/.aws/ aws
  
93
  
  
94
	# WoW settings and addons.
  
95
	cd $VHOME/dotfiles
  
96
	zip -r twow.zip \
  
97
		/home/$USER/Games/turtlewow/WTF \
  
98
		/home/$USER/Games/turtlewow/SuperWoWhook.dll \
  
99
		/home/$USER/Games/turtlewow/nampower.dll \
  
100
		/home/$USER/Games/turtlewow/dlls.txt \
  
101
		/home/$USER/Games/turtlewow/wow.desktop
  
102
  
  
103
	# Sync with NAS.
  
104
	rsync -azhvpog \
  
105
		--exclude '.venv/' \
  
106
		--exclude '.git/' \
  
107
		--exclude '.import/' \
  
108
		--exclude '.godot/' \
  
109
		--exclude '.zig-cache/' \
  
110
		--exclude 'node_modules/' \
  
111
		--delete \
  
112
		$VHOME/ /media/Void/Backup/$ME/
  
113
  
  
114
	# Add to log file.
  
115
	echo `date +"%D %T"` >> ~/.vault.log
  
116
	notify-send "Backup finished successfully."
  
117
  
  
118
	# Return back to original directory
  
119
	cd $CWD
  
120
}
  
121
  
  
122
# Toggles between pulseaudio sinks in round-robin.
  
123
# Gnome shortcut: ptyxis -- bash -c 'source ~/.shenanigans.sh && togglesink'
  
124
togglesink() {
  
125
	sinks=($(pactl list short sinks | awk '{print $2}'))
  
126
	current_sink=$(pactl get-default-sink)
  
127
	current_index=-1
  
128
  
  
129
	for i in "${!sinks[@]}"; do
  
130
		if [[ "${sinks[$i]}" == "$current_sink" ]]; then
  
131
			current_index=$i
  
132
			break
  
133
		fi
  
134
	done
  
135
  
  
136
	if [[ $current_index -eq -1 ]]; then
  
137
		next_index=0
  
138
	else
  
139
		next_index=$(( (current_index + 1) % ${#sinks[@]} ))
  
140
	fi
  
141
  
  
142
	pactl set-default-sink "${sinks[$next_index]}"
  
143
	notify-send "Switched to sink: ${sinks[$next_index]}"
  
144
}
  
diff --git a/.vimrc b/.vimrc
...
31
let g:ale_detail_to_floating_preview = 1
31
let g:ale_detail_to_floating_preview = 1
32
let g:ale_virtualtext_cursor = 0
32
let g:ale_virtualtext_cursor = 0
33
let g:ale_set_quickfix = 1
33
let g:ale_set_quickfix = 1
34
let g:ale_linters = { 'c': ['clangd'], 'cpp': ['clangd'] }
  
35
let g:ale_fixers = { 'c': ['clangd'], 'cpp': ['clangd'] }