mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-03-05 20:01:02 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7525f1f71d | |||
| 3b665bdba0 | |||
| 99477364bd | |||
|
|
629fdf6d4c |
@@ -49,7 +49,7 @@ repos:
|
|||||||
- id: actionlint
|
- id: actionlint
|
||||||
|
|
||||||
- repo: https://github.com/renovatebot/pre-commit-hooks
|
- repo: https://github.com/renovatebot/pre-commit-hooks
|
||||||
rev: 39.100.1
|
rev: 39.107.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: renovate-config-validator
|
- id: renovate-config-validator
|
||||||
|
|
||||||
|
|||||||
@@ -104,8 +104,4 @@ autocmd({ 'BufRead', 'BufNewFile' }, {
|
|||||||
command = 'set filetype=sshconfig',
|
command = 'set filetype=sshconfig',
|
||||||
})
|
})
|
||||||
|
|
||||||
autocmd('QuickFixCmdPost', {
|
|
||||||
callback = function() vim.cmd [[Trouble qflist open]] end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
-- vim: ts=2 sts=2 sw=2 et
|
||||||
|
|||||||
@@ -42,12 +42,6 @@ local lsp_servers = {
|
|||||||
diagnostics = {
|
diagnostics = {
|
||||||
globals = {
|
globals = {
|
||||||
'vim',
|
'vim',
|
||||||
-- busted
|
|
||||||
'describe',
|
|
||||||
'it',
|
|
||||||
'before_each',
|
|
||||||
'after_each',
|
|
||||||
'assert',
|
|
||||||
},
|
},
|
||||||
disable = {
|
disable = {
|
||||||
-- Ignore lua_ls noisy `missing-fields` warnings
|
-- Ignore lua_ls noisy `missing-fields` warnings
|
||||||
@@ -55,7 +49,7 @@ local lsp_servers = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
hint = {
|
hint = {
|
||||||
enable = false,
|
enable = true,
|
||||||
arrayIndex = 'Auto',
|
arrayIndex = 'Auto',
|
||||||
await = true,
|
await = true,
|
||||||
paramName = 'All',
|
paramName = 'All',
|
||||||
|
|||||||
@@ -10,6 +10,28 @@ return {
|
|||||||
'~/Downloads',
|
'~/Downloads',
|
||||||
'~/Library',
|
'~/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',
|
-- log_level = 'debug',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -503,6 +503,69 @@ section_helpers()
|
|||||||
esac
|
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()
|
section_docs()
|
||||||
{
|
{
|
||||||
USAGE_PREFIX="$SCRIPT docs <command>"
|
USAGE_PREFIX="$SCRIPT docs <command>"
|
||||||
@@ -713,6 +776,8 @@ usage()
|
|||||||
echo ""
|
echo ""
|
||||||
section_install
|
section_install
|
||||||
echo ""
|
echo ""
|
||||||
|
section_apt
|
||||||
|
echo ""
|
||||||
section_asdf
|
section_asdf
|
||||||
echo ""
|
echo ""
|
||||||
section_brew
|
section_brew
|
||||||
@@ -735,6 +800,7 @@ main()
|
|||||||
# The main loop. The first keyword after $0 triggers section, or help.
|
# The main loop. The first keyword after $0 triggers section, or help.
|
||||||
case "$SECTION" in
|
case "$SECTION" in
|
||||||
install) section_install "$@" ;;
|
install) section_install "$@" ;;
|
||||||
|
apt) section_apt "$@" ;;
|
||||||
asdf) section_asdf "$@" ;;
|
asdf) section_asdf "$@" ;;
|
||||||
brew) section_brew "$@" ;;
|
brew) section_brew "$@" ;;
|
||||||
check) section_check "$@" ;;
|
check) section_check "$@" ;;
|
||||||
|
|||||||
31
local/bin/t
31
local/bin/t
@@ -21,7 +21,26 @@ get_directories()
|
|||||||
{
|
{
|
||||||
local dirs=''
|
local dirs=''
|
||||||
dirs+='# Directories\n'
|
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")"
|
dirs+="$(printf "\n%s" "$DOTFILES")"
|
||||||
|
|
||||||
echo "$dirs"
|
echo "$dirs"
|
||||||
@@ -56,9 +75,9 @@ items=''
|
|||||||
if [[ $# -eq 1 ]]; then
|
if [[ $# -eq 1 ]]; then
|
||||||
selected="$1"
|
selected="$1"
|
||||||
else
|
else
|
||||||
items+=$(get_sessions)
|
items+=$(get_sessions | sort)
|
||||||
items+='\n'
|
items+='\n'
|
||||||
items+=$(get_directories)
|
items+=$(get_directories | sort)
|
||||||
|
|
||||||
selected=$(echo -e "$items" | fzf) || exit 0 # Exit if no selection is made
|
selected=$(echo -e "$items" | fzf) || exit 0 # Exit if no selection is made
|
||||||
fi
|
fi
|
||||||
@@ -77,7 +96,11 @@ session_name=$(basename "$selected")
|
|||||||
session_name="${session_name//./}"
|
session_name="${session_name//./}"
|
||||||
|
|
||||||
# Try to switch to the tmux session
|
# 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
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
1
tools/apt.txt
Normal file
1
tools/apt.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# apt install list
|
||||||
Reference in New Issue
Block a user