diff --git a/.config/yadm/bootstrap b/.config/yadm/bootstrap index c876486..9589a8a 100755 --- a/.config/yadm/bootstrap +++ b/.config/yadm/bootstrap @@ -3,9 +3,9 @@ ############# Packages to install ######################################## -macos_homebrew_essentials="python3 vim-nox tmux nano zsh git autossh mosh sshuttle lynx npm tidy mcfly ack ncdu" +macos_homebrew_essentials="python3 vim-nox tmux nano zsh git autossh mosh sshuttle lynx npm tidy mcfly ack ncdu shfmt" macos_homebrew_other_apps="calibre" -raspberrypi_essentials="python3 python3-pip vim-nox python3-venv tmux nano zsh git htop ncdu autossh mosh sshuttle fail2ban avahi-daemon ufw lynx npm ssmtp apticron tidy nmon software-properties-common ack restic unrar" +raspberrypi_essentials="python3 python3-pip vim-nox python3-venv tmux nano zsh git htop ncdu autossh mosh sshuttle fail2ban avahi-daemon ufw lynx npm ssmtp apticron tidy nmon software-properties-common ack restic unrar cmake" raspberrypi_printer="cups printer-driver-gutenprint" raspberrypi_camera="python3-opencv" @@ -18,8 +18,8 @@ install_python_linters() { } install_npm_linters() { - npm install -g jsonlint - npm install -g fixjson + sudo npm install -g jsonlint + sudo npm install -g fixjson } ############# MacOS exclusive commands ################################### @@ -69,7 +69,12 @@ if [ "$system_type" = "Linux" ]; then if [ -n "$install_this_now" ]; then echo "Packages will be installed now!" - sudo apt update && sudo apt install $install_this_now + sudo apt update + for i in $install_this_now; do + sudo apt-get install -y $i + done + + fi fi diff --git a/.tmux.conf b/.tmux.conf##template similarity index 85% rename from .tmux.conf rename to .tmux.conf##template index 15ad70c..607037b 100644 --- a/.tmux.conf +++ b/.tmux.conf##template @@ -1,4 +1,3 @@ -# run: git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm # Auto install if not present if "test ! -d ~/.tmux/plugins/tpm" \ @@ -10,14 +9,20 @@ set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-net-speed' set -g @plugin 'tmux-plugins/tmux-resurrect' -set -g @plugin 'tmux-plugins/tmux-battery' set -g @plugin 'tmux-plugins/tmux-continuum' set -g @resurrect-capture-pane-contents 'on' - +{% if yadm.os == "Darwin" %} +set -g @plugin 'tmux-plugins/tmux-battery' +{% endif %} # Settings -set -g status-right "#{battery_status_bg} Batt: #{battery_percentage} | %H:%M" +{% if yadm.os == "Darwin" %} +set -g status-right "#{battery_status_bg} Batt: #{battery_percentage} #{battery_remain}" +{% else %} +set -g status-right "#{net_speed} | %H:%M" +{% endif %} + set-option -g default-shell /bin/zsh # default shell set -g default-terminal "screen-256color" setw -g mode-keys vi diff --git a/.vimrc b/.vimrc##template similarity index 99% rename from .vimrc rename to .vimrc##template index 4043eed..6bec229 100644 --- a/.vimrc +++ b/.vimrc##template @@ -479,6 +479,10 @@ nmap g (coc-definition) " Don't hide stuff in tex files like \textbf{} let g:tex_conceal="" + + + + " Load local config if there is one if filereadable($HOME . "/.vimrc.local") source ~/.vimrc.local diff --git a/.zshrc b/.zshrc index e55a5d0..21d0978 100644 --- a/.zshrc +++ b/.zshrc @@ -1,5 +1,6 @@ -if [ -f ~/.bash_profile ]; then - source ~/.bash_profile; +# Import from bash +if [ -f $HOME/.bash_profile ]; then + source $HOME/.bash_profile; fi @@ -34,12 +35,6 @@ _load_settings() { } _load_settings "$HOME/.zsh/configs" -# Local config -[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local - -# aliases -[[ -f ~/.aliases ]] && source ~/.aliases - # Save history SAVEHIST=3000 @@ -77,3 +72,14 @@ zstyle ':completion:*' rehash true # Find new executables for autcompletion stty -ixon # Ignore and pass through ctrl-s and ctrl-q as normal input (quicksave bin for vim) +# Aliases +[[ -f ~/.aliases ]] && source ~/.aliases + +alias venv-source="source ./venv/bin/activate" +alias tex-to-pdf="latexmk -pdf " + + +PATH="$HOME/bin:$PATH" + +# Local config +[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local diff --git a/.zshrc.local##os.Darwin b/.zshrc.local##os.Darwin new file mode 100644 index 0000000..102aa84 --- /dev/null +++ b/.zshrc.local##os.Darwin @@ -0,0 +1,10 @@ + +# mcfly settings +eval "$(mcfly init zsh)" +export MCFLY_LIGHT=TRUE +# export MCFLY_KEY_SCHEME=vim +export MCFLY_FUZZY=2 +export MCFLY_RESULTS=50 +export MCFLY_RESULTS_SORT=LAST_RUN +export PATH="/usr/local/opt/openjdk/bin:$PATH" +export PATH="/usr/local/sbin:$PATH" diff --git a/.zshrc.local##os.Linux b/.zshrc.local##os.Linux new file mode 100644 index 0000000..234d2cd --- /dev/null +++ b/.zshrc.local##os.Linux @@ -0,0 +1,3 @@ +# Aliases +alias wifi-setup="sudo nmtui" + diff --git a/bin/venv-new b/bin/venv-new new file mode 100755 index 0000000..7a80377 --- /dev/null +++ b/bin/venv-new @@ -0,0 +1,91 @@ +#!/bin/sh + + +# Warn if still in a venv + +if [ -n "$VIRTUAL_ENV" ]; then + echo "The current venv is still active! Run deactivate first!" + exit 1 +fi + + +python_versions="" +for dir in $(echo "$PATH" | tr ':' ' '); do + for version in "$dir"/python3.[0-9]*; do + # Überprüfe, ob die Datei tatsächlich existiert (falls kein Treffer, wird $version auf "$dir/python3.[0-9]*" gesetzt) + if [ -e "$version" ]; then + # Überprüfe, ob die Datei existiert und ausführbar ist + if [ -x "$version" ] && "$version" --version >/dev/null 2>&1; then + python_versions="$python_versions $version" + fi + fi + done +done + +if [ -z "$python_versions" ]; then + echo "No Python3 versions found." + exit 1 +fi + +# Entferne Duplikate und sortiere die Python-Versionen +python_versions=$(echo "$python_versions" | tr ' ' '\n' | sort -u -r | tr '\n' ' ') + +# Nummerierte Liste der Python-Versionen anzeigen +echo "Installed Python3 versions:" +i=1 +for version in $python_versions; do + echo "$i) $(basename "$version")" + i=$((i + 1)) +done + +# Benutzer nach der Auswahl fragen +echo "Select the number of the Python version you want to use:" +read user_choice + +if [ -z "$user_choice" ]; then + user_choice=1 +fi + + +# Überprüfen, ob die Eingabe eine Zahl ist +if echo "$user_choice" | grep -qE '^[0-9]+$'; then + i=1 + for version in $python_versions; do + if [ "$i" -eq "$user_choice" ]; then + python_version=$(basename "$version") + break + fi + i=$((i + 1)) + done + + # Überprüfen, ob eine gültige Auswahl getroffen wurde + if [ -n "$python_version" ]; then + echo "You selected: $version" + else + echo "Invalid selection." + exit 1 + fi +else + echo "Please enter a valid number." + exit 1 +fi + +# Additional parameter +additional_parameters="--upgrade-deps --clear" + +echo "Should the venv have access to the system packages? (y/n)" +read -r add_system_packages +if [ "$add_system_packages" = "y" ]; then + additional_parameters="$additional_parameters --system-site-packages" +fi + +# Create venv +$version -m venv venv $additional_parameters +source ./venv/bin/activate + +# Install requirements.txt +echo "Install packages from requirements.txt? (y/n)" +read -r install_requirements_txt +if [ "$install_requirements_txt" = "y" ]; then + python3 -m pip install -r requirements.txt +fi