5 Commits
Author SHA1 Message Date
Fabian Ising 6fc74d4315 [ALL] Tool moves 2026-08-24 09:37:49 +02:00
Fabian Ising 3e3fb7141e [NVIM] Keep update notices visible 2026-08-24 09:15:53 +02:00
Fabian Ising 2afca7e6c3 [NVIM] Defer plugin update checks 2026-08-24 08:55:33 +02:00
Fabian Ising 0af702e3f3 [ZSH] Add custom completions 2026-08-11 15:03:13 +02:00
Fabian Ising 06b0d9bc90 [ZSH] Note update has happened 2026-07-27 11:09:57 +02:00
7 changed files with 136 additions and 73 deletions
+1
View File
@@ -3,3 +3,4 @@
tags
.DS_STORE
__pycache__
.env.local
-2
View File
@@ -26,5 +26,3 @@ else
rm -rf $HOME/.config/nvim
ln -Tsfv $PWD/nvim $HOME/.config/nvim
fi
cat $PWD/ssh_tty | sudo tee /etc/sudoers.d/ssh_tty > /dev/null
+123 -4
View File
@@ -19,9 +19,6 @@ if empty(glob(data_dir . '/autoload/plug.vim'))
endif
call plug#begin()
" Warn about plugin updates
Plug 'semanser/vim-outdated-plugins'
" Powerline replacement
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
@@ -76,6 +73,129 @@ Plug 'fatih/vim-go'
call plug#end()
" Check for plugin updates after the editor is responsive.
lua << EOF
local function check_plugin_updates()
local plugins = {}
for name, plugin in pairs(vim.g.plugs or {}) do
if vim.fn.isdirectory(plugin.dir) == 1 then
table.insert(plugins, { name = name, dir = plugin.dir })
end
end
table.sort(plugins, function(a, b) return a.name < b.name end)
local next_plugin = 1
local active = 0
local finished = 0
local failures = 0
local updates = {}
local concurrency = 2
local function git_command(args)
local command = { 'ionice', '-c', '3', 'nice', '-n', '10', 'git' }
vim.list_extend(command, args)
return command
end
local function set_airline_status(message)
vim.g.plugin_update_status = message
local marker = '%{get(g:,"plugin_update_status","")}'
local warning = vim.g.airline_section_warning or ''
if not string.find(warning, 'plugin_update_status', 1, true) then
vim.g.airline_section_warning = warning .. ' ' .. marker
end
if vim.fn.exists(':AirlineRefresh') == 2 then
vim.cmd('AirlineRefresh')
end
end
local function report()
if #updates > 0 then
set_airline_status(string.format('[updates: %d]', #updates))
local message = string.format(
'%d plugin update%s available: %s',
#updates,
#updates == 1 and '' or 's',
table.concat(updates, ', ')
)
if failures > 0 then
message = message .. string.format(' (%d check%s failed)', failures, failures == 1 and '' or 's')
end
vim.notify(message, failures > 0 and vim.log.levels.WARN or vim.log.levels.INFO)
elseif failures > 0 then
set_airline_status('[update check failed]')
vim.notify(
string.format('Plugin update check incomplete: %d check%s failed', failures, failures == 1 and '' or 's'),
vim.log.levels.WARN
)
else
set_airline_status('')
vim.notify('All plugins up-to-date', vim.log.levels.INFO)
end
end
local pump
local function complete_one()
active = active - 1
finished = finished + 1
if finished == #plugins then
report()
else
pump()
end
end
local function check_one(plugin)
active = active + 1
vim.system(
git_command({ '-C', plugin.dir, 'fetch', '--quiet', '--no-tags', 'origin' }),
{ text = true, timeout = 20000 },
vim.schedule_wrap(function(fetch_result)
if fetch_result.code ~= 0 then
failures = failures + 1
complete_one()
return
end
vim.system(
git_command({ '-C', plugin.dir, 'rev-list', '--count', 'HEAD..@{upstream}' }),
{ text = true, timeout = 5000 },
vim.schedule_wrap(function(count_result)
local count = tonumber(vim.trim(count_result.stdout or ''))
if count_result.code ~= 0 or count == nil then
failures = failures + 1
elseif count > 0 then
table.insert(updates, plugin.name)
end
complete_one()
end)
)
end)
)
end
pump = function()
while active < concurrency and next_plugin <= #plugins do
local plugin = plugins[next_plugin]
next_plugin = next_plugin + 1
check_one(plugin)
end
end
if #plugins > 0 then
pump()
end
end
vim.api.nvim_create_autocmd('VimEnter', {
group = vim.api.nvim_create_augroup('plugin_update_check', { clear = true }),
once = true,
callback = function()
vim.defer_fn(check_plugin_updates, 1500)
end,
})
EOF
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
@@ -278,4 +398,3 @@ if filereadable(expand("~/python-envs/neovim/bin/python3"))
else
let g:python3_host_prog="/usr/bin/python3"
endif
-64
View File
@@ -1,64 +0,0 @@
#!/bin/sh
#
# Usage: yank [FILE...]
#
# Copies the contents of the given files (or stdin if no files are given) to
# the terminal that runs this program. If this program is run inside tmux(1),
# then it also copies the given contents into tmux's current clipboard buffer.
# If this program is run inside X11, then it also copies to the X11 clipboard.
#
# This is achieved by writing an OSC 52 escape sequence to the said terminal.
# The maximum length of an OSC 52 escape sequence is 100_000 bytes, of which
# 7 bytes are occupied by a "\033]52;c;" header, 1 byte by a "\a" footer, and
# 99_992 bytes by the base64-encoded result of 74_994 bytes of copyable text.
#
# In other words, this program can only copy up to 74_994 bytes of its input.
# However, in such cases, this program tries to bypass the input length limit
# by copying directly to the X11 clipboard if a $DISPLAY server is available;
# otherwise, it emits a warning (on stderr) about the number of bytes dropped.
#
# See http://en.wikipedia.org/wiki/Base64 for the 4*ceil(n/3) length formula.
# See http://sourceforge.net/p/tmux/mailman/message/32221257 for copy limits.
# See http://sourceforge.net/p/tmux/tmux-code/ci/a0295b4c2f6 for DCS in tmux.
#
# Written in 2014 by Suraj N. Kurapati and documented at http://goo.gl/NwYqfW
buf=$( cat "$@" )
# Create the OSC52 escape string.
len=$( printf %s "$buf" | wc -c ) max=74994
test $len -gt $max && echo "$0: input is $(( len - max )) bytes too long" >&2
esc="\033]52;c;$( printf %s "$buf" | head -c $max | base64 | tr -d '\r\n' )\a"
test -n "$TMUX" && esc="\033Ptmux;\033$esc\033\\"
# Output the string to waiting terminals
printf "$esc"
# Attempt to push to the raw SSH_TTY if that exists.
test -n "$SSH_TTY" && printf "$esc" > $SSH_TTY
if [ -n "$TMUX" ]; then
#push the OSC52 esc string to the clients directly.
# tmux_clients=$(tmux list-clients -F "#{client_tty}")
# readarray -t tmux_clients <<<"$tmux_clients"
# for c in ${tmux_clients[@]}; do
# printf "$esc" > $c
# done
#
# And add it directly to the TMUX copy buffer.
test -n "$TMUX" && tmux set-buffer "$buf"
fi
# copy to X11 if possible...
test -n "$DISPLAY" && command -v xsel > /dev/null && command -v xclip > /dev/null \
&& printf %s "$buf" | { xsel -ib || xclip -sel c ;} && exit
# copy to pbcopy on MacOS
command -v pbcopy > /dev/null && printf %s "$buf" | pbcopy
# Copy to remote pbcopy daemon, if attached
if $(nc -z localhost 5556); then
printf %s "$buf" | nc localhost 5556
fi
-1
View File
@@ -1 +0,0 @@
Defaults env_keep += "SSH_TTY SSH_CONNECTION SSH_CLIENT"
+5 -1
View File
@@ -1,4 +1,4 @@
export PATH="/snap/bin:$HOME/.local/bin:$HOME/dotfiles/scripts:$PATH"
export PATH="/snap/bin:$HOME/.local/bin:$PATH"
export XDG_CONFIG_HOME="$HOME/.config"
[[ -z $SSH_AUTH_SOCK ]] || export FORWARD_SOCK=$SSH_AUTH_SOCK
@@ -29,6 +29,10 @@ if (( ! shared_config )); then
export GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
fi
# Completions for tools installed under ~/.local (e.g. tools-repo's safe*
# wrappers). Must precede antidote, whose completion plugin runs compinit.
fpath=("$HOME/.local/share/zsh/site-functions" $fpath)
static_file=${ZDOTDIR:-$HOME}/.cache/zsh/.zsh_plugins.zsh
if (( ! shared_config )); then
plugins_txt=${ZDOTDIR:-$HOME}/.zsh/.zsh_plugins.txt
+7 -1
View File
@@ -10,7 +10,13 @@ update_dotfiles() {
$TO git -C "$repo" fetch --quiet </dev/null 2>/dev/null || return
git -C "$repo" rev-parse --abbrev-ref '@{u}' >/dev/null 2>&1 || return
git -C "$repo" merge-base --is-ancestor '@{u}' HEAD 2>/dev/null && return
git -C "$repo" merge --ff-only --quiet '@{u}' 2>/dev/null && return
if git -C "$repo" merge --ff-only --quiet '@{u}' 2>/dev/null; then
local notice="⬆ dotfiles updated — run: exec zsh"
mkdir -p "$cache_dir" || return
print -r -- "$notice" >| "$notice_tmp" || return
mv -f "$notice_tmp" "$notice_file"
return
fi
local notice="⚠ dotfiles: $(git -C "$repo" symbolic-ref --short HEAD) can't fast-forward to @{u} — run: git -C ~/dotfiles pull"
mkdir -p "$cache_dir" || return
print -r -- "$notice" >| "$notice_tmp" || return