Compare commits

..

4 Commits

Author SHA1 Message Date
7525f1f71d feat(dfm): dfm apt helper commands 2025-01-16 16:19:45 +02:00
3b665bdba0 chore(nvim): tweaks to lsp, autocommands, sessions 2025-01-16 16:18:50 +02:00
99477364bd chore(bin): t - filters, sorting, tweak checks 2025-01-16 16:17:42 +02:00
github-actions[bot]
629fdf6d4c chore: update pre-commit hooks (#67) 2025-01-16 07:10:21 +02:00
7 changed files with 118 additions and 16 deletions

View File

@@ -49,7 +49,7 @@ repos:
- id: actionlint
- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 39.100.1
rev: 39.107.2
hooks:
- id: renovate-config-validator

View File

@@ -104,8 +104,4 @@ autocmd({ 'BufRead', 'BufNewFile' }, {
command = 'set filetype=sshconfig',
})
autocmd('QuickFixCmdPost', {
callback = function() vim.cmd [[Trouble qflist open]] end,
})
-- vim: ts=2 sts=2 sw=2 et

View File

@@ -42,12 +42,6 @@ local lsp_servers = {
diagnostics = {
globals = {
'vim',
-- busted
'describe',
'it',
'before_each',
'after_each',
'assert',
},
disable = {
-- Ignore lua_ls noisy `missing-fields` warnings
@@ -55,7 +49,7 @@ local lsp_servers = {
},
},
hint = {
enable = false,
enable = true,
arrayIndex = 'Auto',
await = true,
paramName = 'All',

View File

@@ -10,6 +10,28 @@ return {
'~/Downloads',
'~/Library',
},
bypass_save_filetypes = {
'PlenaryTestPopup',
'alpha',
'checkhealth',
'dashboard',
'dbout',
'gitsigns.blame',
'grug-far',
'help',
'lspinfo',
'man',
'neo-tree',
'neotest-output',
'neotest-output-panel',
'neotest-summary',
'notify',
'qf',
'spectre_panel',
'startuptime',
'trouble',
'tsplayground',
},
-- log_level = 'debug',
},
},

View File

@@ -503,6 +503,69 @@ section_helpers()
esac
}
section_apt()
{
USAGE_PREFIX="$SCRIPT apt <command>"
MENU=(
"upkeep:Run update, upgrade, autoremove and clean"
'install:Install packages from $DOTFILES/tools/apt.txt'
"update:Update apt packages"
"upgrade:Upgrade apt packages"
"autoremove:Remove unused apt packages"
"clean:Clean apt cache"
)
x-have apt && {
case "$1" in
upkeep)
sudo apt update \
&& sudo apt upgrade -y \
&& sudo apt autoremove -y \
&& sudo apt clean
;;
install)
# if apt.txt is not found, exit
[ ! -f "$DOTFILES/tools/apt.txt" ] && msgr err "apt.txt not found" && exit 0
# Load apt.txt, remove comments (even if trailing comment) and empty lines.
#
# Ignoring "Quote this to prevent word splitting."
# shellcheck disable=SC2046
sudo apt install \
-y $(
grep -vE '^\s*#' "$DOTFILES/tools/apt.txt" \
| sed -e 's/#.*//' \
| tr '\n' ' '
)
# If there's a apt.txt file under hosts/$hostname/apt.txt,
# run install on those lines too.
HOSTNAME=$(hostname -s)
HOST_APT="$DOTFILES/hosts/$HOSTNAME/apt.txt"
[[ -f $HOST_APT ]] && {
# shellcheck disable=SC2046
sudo apt install -y $(
grep -vE '^\s*#' "$HOST_APT" \
| sed -e 's/#.*//' \
| tr '\n' ' '
)
}
# Try this for an alternative way to install packages
# xargs -a <(awk '! /^ *(#|$)/' "$packagelist") -r -- sudo apt-get install -y
;;
update) sudo apt update ;;
upgrade) sudo apt upgrade -y ;;
autoremove) sudo apt autoremove -y ;;
clean) sudo apt clean ;;
*) menu_builder "$USAGE_PREFIX" "${MENU[@]}" ;;
esac
}
! x-have apt && menu_builder "$USAGE_PREFIX" "apt not available on this system"
}
section_docs()
{
USAGE_PREFIX="$SCRIPT docs <command>"
@@ -713,6 +776,8 @@ usage()
echo ""
section_install
echo ""
section_apt
echo ""
section_asdf
echo ""
section_brew
@@ -735,6 +800,7 @@ main()
# The main loop. The first keyword after $0 triggers section, or help.
case "$SECTION" in
install) section_install "$@" ;;
apt) section_apt "$@" ;;
asdf) section_asdf "$@" ;;
brew) section_brew "$@" ;;
check) section_check "$@" ;;

View File

@@ -21,7 +21,26 @@ get_directories()
{
local dirs=''
dirs+='# Directories\n'
dirs+=$(find "$T_ROOT" -maxdepth 2 -mindepth 1 -type d ! -name '.git' ! -name '.svn')
dirs+=$(
find "$T_ROOT" \
-maxdepth 3 \
-mindepth 1 \
-type d \
-not -path '*/dist/*' \
-not -path '*/dist' \
-not -path '*/node_modules/*' \
-not -path '*/node_modules' \
-not -path '*/vendor/*' \
-not -path '*/vendor' \
-not -path '*/.idea/*' \
-not -path '*/.idea' \
-not -path '*/.vscode/*' \
-not -path '*/.vscode' \
-not -path '*/.git/*' \
-not -path '*/.git' \
-not -path '*/.svn/*' \
-not -path '*/.svn'
)
dirs+="$(printf "\n%s" "$DOTFILES")"
echo "$dirs"
@@ -56,9 +75,9 @@ items=''
if [[ $# -eq 1 ]]; then
selected="$1"
else
items+=$(get_sessions)
items+=$(get_sessions | sort)
items+='\n'
items+=$(get_directories)
items+=$(get_directories | sort)
selected=$(echo -e "$items" | fzf) || exit 0 # Exit if no selection is made
fi
@@ -77,7 +96,11 @@ session_name=$(basename "$selected")
session_name="${session_name//./}"
# Try to switch to the tmux session
if tmux switch-client -t "=$session_name" 2> /dev/null; then
tmux switch-client -t "=$session_name"
active_session=$(tmux display-message -p -F '#{session_name}' 2> /dev/null)
# echo "active session: $active_session"
if [ -n "$active_session" ] && [ "$active_session" == "$session_name" ]; then
exit 0
fi

1
tools/apt.txt Normal file
View File

@@ -0,0 +1 @@
# apt install list