diff --git a/install.sh b/install.sh index ff0cd9f..d790020 100755 --- a/install.sh +++ b/install.sh @@ -37,7 +37,7 @@ fi ################################################# if $NVIM; then - dependencies="neovim git unzip fzf cmake gcc make curl wget ripgrep npm" + dependencies="neovim git unzip fzf cmake gcc make curl wget ripgrep" if [[ $OS == "NAME=\"Arch Linux\"" ]]; then $SUDO pacman -Sy --needed --noconfirm $dependencies npm go fd dotnet-sdk elif [[ $OS == "NAME=\"Ubuntu\"" ]]; then @@ -45,14 +45,18 @@ if $NVIM; then $SUDO apt install -y software-properties-common $SUDO add-apt-repository ppa:neovim-ppa/unstable -y $SUDO curl -sL https://deb.nodesource.com/setup_21.x | $SUDO bash - + declare repo_version=$(if command -v lsb_release &> /dev/null; then lsb_release -r -s; else grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"'; fi) + wget https://packages.microsoft.com/config/ubuntu/$repo_version/packages-microsoft-prod.deb -O packages-microsoft-prod.deb + $SUDO dpkg -i packages-microsoft-prod.deb + rm packages-microsoft-prod.deb $SUDO apt update - $SUDO apt install -y $dependencies python3-venv nodejs golang fd-find + $SUDO apt install -y $dependencies python3-venv python3-pip nodejs golang fd-find cargo dotnet-sdk-8.0 fi ln -s "$PWD"/nvim "$XDG_CONFIG_HOME"/nvim ln -s "$PWD"/clang/.clang-tidy "$HOME"/.clang-tidy nvim --headless "+Lazy! sync" +qa - nvim --headless "+MasonInstall bash-language-server pyright typescript-language-server rust-analyzer clangd cmake-language-server css-lsp dockerfile-language-server emmet-ls gopls html-lsp jdtls json-lsp ltex-ls lua-language-server ruff-lsp rustfmt rustywind texlab vetur-vls vim-language-server yaml-language-server" +qa + nvim --headless "+MasonInstall bash-language-server pyright typescript-language-server rust-analyzer clangd cmake-language-server css-lsp dockerfile-language-server emmet-ls gopls html-lsp jdtls json-lsp ltex-ls lua-language-server ruff-lsp rustfmt rustywind texlab vetur-vls vim-language-server yaml-language-server csharp-language-server typst-lsp" +qa fi diff --git a/nvim/lua/plugins/nvim-cmp.lua b/nvim/lua/plugins/nvim-cmp.lua index b78d389..82479b4 100644 --- a/nvim/lua/plugins/nvim-cmp.lua +++ b/nvim/lua/plugins/nvim-cmp.lua @@ -250,6 +250,7 @@ return { }, } + local filetypes = { "bibtex", "gitcommit", "markdown", "org", "tex", "restructuredtext", "rsweave", "latex", "quarto", "rmd", "context", "html", "xhtml", "typst", "mail" } require('lspconfig').ltex.setup { capabilities = capabilities, on_attach = function(_, _) @@ -260,11 +261,11 @@ return { end, settings = { ltex = { - enabled = { "bibtex", "gitcommit", "markdown", "org", "tex", "restructuredtext", "rsweave", "latex", "quarto", "rmd", "context", "html", "xhtml", "typst" }, + enabled = filetypes, language = "en-GB" }, }, - filetypes = { "bib", "gitcommit", "markdown", "org", "plaintex", "rst", "rnoweb", "tex", "pandoc", "quarto", "rmd", "context", "html", "xhtml" , "typst"} + filetypes = filetypes } vim.diagnostic.config({ diff --git a/nvim/lua/plugins/obsidian.lua b/nvim/lua/plugins/obsidian.lua index 350596e..428f866 100644 --- a/nvim/lua/plugins/obsidian.lua +++ b/nvim/lua/plugins/obsidian.lua @@ -19,6 +19,9 @@ return { dependencies = { "nvim-lua/plenary.nvim" }, config = function(_, opts) local notes_path = (os.getenv "HOME") .. "/Workspace/Notes" + if vim.fn.isdirectory(notes_path) == 0 then + return + end local scan = require("plenary.scandir").scan_dir(notes_path, {add_dirs = true, depth = 1 }) local found = false for _, v in ipairs(scan) do diff --git a/scripts/cronic b/scripts/cronic new file mode 100755 index 0000000..3467641 --- /dev/null +++ b/scripts/cronic @@ -0,0 +1,47 @@ +#!/bin/bash + +# Cronic v3 - cron job report wrapper +# Copyright 2007-2016 Chuck Houpt. No rights reserved, whatsoever. +# Public Domain CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +set -eu + +TMP=$(mktemp -d) +OUT=$TMP/cronic.out +ERR=$TMP/cronic.err +TRACE=$TMP/cronic.trace + +set +e +"$@" >$OUT 2>$TRACE +RESULT=$? +set -e + +PATTERN="^${PS4:0:1}\\+${PS4:1}" +if grep -aq "$PATTERN" $TRACE +then + ! grep -av "$PATTERN" $TRACE > $ERR +else + ERR=$TRACE +fi + +if [ $RESULT -ne 0 ] + then + echo "Cronic detected failure or error output for the command:" + echo "$@" + echo + echo "RESULT CODE: $RESULT" + echo + echo "ERROR OUTPUT:" + cat "$ERR" + echo + echo "STANDARD OUTPUT:" + cat "$OUT" + if [ $TRACE != $ERR ] + then + echo + echo "TRACE-ERROR OUTPUT:" + cat "$TRACE" + fi +fi + +rm -rf "$TMP" diff --git a/scripts/disk_check.sh b/scripts/disk_check.sh new file mode 100755 index 0000000..c2ca6d7 --- /dev/null +++ b/scripts/disk_check.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +REPORT_EMAIL=email@thomasave.be + +ZPOOL_STATUS=`zpool status -x` +if [ "$ZPOOL_STATUS" = "all pools are healthy" -o "$ZPOOL_STATUS" = "no pools available" ] +then + echo -n 0 > /var/db/zpool.status +else + if [ `cat /var/db/zpool.status` -eq 0 ] + then + zpool status | mail -s "ZPOOL NOT HEALTHY" $REPORT_EMAIL + echo -n 1 > /var/db/zpool.status + fi +fi diff --git a/zsh/.zshrc b/zsh/.zshrc index 07b5d12..e4364b5 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -90,12 +90,19 @@ function zvm_after_init() { # Use FZY instead of FZF for ctrl-t function find_files() { zle -I - # Check if ~/Containers exists + PATHS=$(fd -H . /home/server/Workspace -t d -d 5) if [ -d ~/Containers ]; then - BUFFER=cd "$(fd -H . ~/Workspace ~/Containers -t d | fzy -l 20)" - else - BUFFER=cd "$(fd -H . ~/Workspace -t d | fzy -l 20)" + PATHS="$PATHS\n$(fd -H . ~/Containers -t d -d 2)" fi + if [ -d /RAID/10/Shared\ Storage/ ]; then + PATHS="$PATHS\n/RAID/10/Shared Storage/Thomas" + PATHS="$PATHS\n$(fd -H . /RAID/10/Shared\ Storage -t d -d 2)" + fi + if [ -d /RAID/10/Private\ Storage/Thomas ]; then + PATHS="$PATHS\n/RAID/10/Private Storage/Thomas" + PATHS="$PATHS\n$(fd -H . /RAID/10/Private\ Storage/Thomas -t d -d 1)" + fi + BUFFER=cd "$(echo $PATHS | fzy -l 20)" zle accept-line clear } @@ -169,6 +176,10 @@ function o () { xdg-open "$1" &! } +function s() { + ssh server@mallorea -t "cd \"$(pwd)\" ; zsh --login" +} + if [ "$SSH_CLIENT" ] then source_port=$(echo $SSH_CLIENT | awk '{ print $2 }') @@ -181,6 +192,9 @@ if [[ "$TERM" == (Eterm*|alacritty*|aterm*|gnome*|konsole*|kterm*|putty*|rxvt*|s fi # Aliases +if command -v fdfind &> /dev/null; then + alias fd="fdfind" +fi alias ls="ls --color=auto" alias gdb='gdb -q' alias ll='ls -lhat' @@ -192,8 +206,8 @@ alias wget=wget --hsts-file="$XDG_DATA_HOME/wget-hsts" alias xbindkeys="xbindkeys -f $XDG_CONFIG_HOME/xbindkeys/config" alias python=python3 alias r=". ranger" -alias cpr=rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 -alias mvr=rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 --remove-source-files +alias cpr="rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1" +alias mvr="rsync --archive -hh --partial --info=stats1,progress2 --modify-window=1 --remove-source-files" alias rg="rg -i --colors 'match:bg:yellow' --colors 'match:fg:black' --colors 'match:style:nobold' --colors 'path:fg:green' --colors 'path:style:bold' --colors 'line:fg:yellow' --colors 'line:style:bold'" alias ag="rg -i --colors 'match:bg:yellow' --colors 'match:fg:black' --colors 'match:style:nobold' --colors 'path:fg:green' --colors 'path:style:bold' --colors 'line:fg:yellow' --colors 'line:style:bold'" alias push="git add -A && git commit -m '`date`' && git push"