Compare commits

..

1 Commits

Author SHA1 Message Date
d38875e471 add compile_tools.sh 2025-10-03 08:56:33 +02:00
7 changed files with 80 additions and 139 deletions

1
.gitignore vendored
View File

@@ -10,4 +10,3 @@ __pycache__
/dwm /dwm
/st /st
/vis/.config/vis/plugins/ /vis/.config/vis/plugins/
/tools/.local/bin/

44
compile_tools.sh Executable file → Normal file
View File

@@ -1,43 +1,17 @@
#!/bin/sh
mkdir -p tools/.local/bin mkdir -p tools/.local/bin
uid=$(id -u):$(id -g)
go-install() {
echo "build $1"
docker exec -u "$uid" dotfiles-go go install -ldflags="-s -w" "$@"
}
cargo-install() {
B="$1"
shift
echo "build $B"
docker exec -u "$uid" dotfiles-rust cargo install --quiet "$@"
docker exec -u "$uid" dotfiles-rust cp "/usr/local/cargo/bin/$B" /rust/bin
strip "tools/.local/bin/$B"
}
docker kill dotfiles-go && sleep 3 || : docker kill dotfiles-go && sleep 3 || :
docker run --rm -d --name dotfiles-go -e HOME=/go -v ./tools/.local/bin:/go/bin golang:1.25.1-alpine3.22 tail -f /dev/null docker run --rm -d --name dotfiles-go -v ./tools/.local/bin:/go/bin golang:1.25.1-alpine3.22 tail -f /dev/null
docker exec dotfiles-go chown "$uid" /go docker exec dotfiles-go go install github.com/junegunn/fzf@latest
docker exec dotfiles-go go install github.com/gokcehan/lf@latest
go-install github.com/junegunn/fzf@latest
go-install github.com/gokcehan/lf@latest
go-install github.com/rs/curlie@latest
docker kill dotfiles-go docker kill dotfiles-go
docker kill dotfiles-rust && sleep 3 || : docker kill dotfiles-rust && sleep 3 || :
docker run --rm -d --name dotfiles-rust -v ./tools/.local/bin:/rust/bin rust:1.90-bullseye tail -f /dev/null docker run --rm -d --name dotfiles-rust -v ./tools/.local/bin:/rust/bin rust:1.90-bullseye tail -f /dev/null
docker exec dotfiles-rust cargo install zoxide --locked
cargo-install zoxide zoxide --locked docker exec dotfiles-rust cp /usr/local/cargo/bin/zoxide /rust/bin
cargo-install rg ripgrep docker exec dotfiles-rust cargo install ripgrep
cargo-install fd fd-find docker exec dotfiles-rust cp /usr/local/cargo/bin/rg /rust/bin
cargo-install bat bat --locked docker exec dotfiles-rust cargo install fd-find
cargo-install eza eza docker exec dotfiles-rust cp /usr/local/cargo/bin/fd /rust/bin
cargo-install delta git-delta
cargo-install jj --bin jj jj-cli --locked
cargo-install lazyjj lazyjj --locked
docker kill dotfiles-rust docker kill dotfiles-rust

View File

@@ -18,7 +18,6 @@ if [ "$1" = list ]; then
case "$prompt" in case "$prompt" in
dir:*) dir:*)
dir=${FZF_HEADER_LABEL#?} dir=${FZF_HEADER_LABEL#?}
fd -t d '' ~/src ~/dotfiles 2 -H -E '\.git' -E node_modules
zoxide query -l zoxide query -l
echo $dir echo $dir
exit exit
@@ -29,9 +28,6 @@ if [ "$1" = list ]; then
files+hidden) files+hidden)
exec fd --type f -H '' $dir exec fd --type f -H '' $dir
;; ;;
find-files*)
exec find $dir -type f
;;
search) search)
exec $ripgrep "$FZF_QUERY" $dir exec $ripgrep "$FZF_QUERY" $dir
;; ;;
@@ -120,9 +116,6 @@ if [ "$1" = key ]; then
;; ;;
alt-f) alt-f)
case "$cmd" in case "$cmd" in
files)
prompt="find-files$hidden"
;;
*files|search) *files|search)
prompt="files$hidden" prompt="files$hidden"
;; ;;
@@ -227,7 +220,7 @@ auto-search)
action="$no_search" action="$no_search"
prompt="$cmd> " prompt="$cmd> "
;; ;;
files|git-files|jj-files|find-files) files|git-files|jj-files)
cmd="$1" cmd="$1"
action="$search" action="$search"
prompt="$1> " prompt="$1> "
@@ -272,7 +265,6 @@ exec fzf --query "$3" \
--header-label "$label" \ --header-label "$label" \
--multi \ --multi \
--ansi \ --ansi \
--scheme path \
--delimiter : \ --delimiter : \
--ghost ' (Use alt-? for help)' \ --ghost ' (Use alt-? for help)' \
--bind "enter:transform($accept)" \ --bind "enter:transform($accept)" \
@@ -287,5 +279,4 @@ exec fzf --query "$3" \
--bind "alt-s:$key" \ --bind "alt-s:$key" \
--bind "alt-p:change-preview(sh $0 preview {1} {2})+toggle-preview" \ --bind "alt-p:change-preview(sh $0 preview {1} {2})+toggle-preview" \
--bind "alt-u:change-preview-window(up|right)" \ --bind "alt-u:change-preview-window(up|right)" \
--bind "alt-?:change-preview(echo '$HELP')+show-preview" \ --bind "alt-?:change-preview(echo '$HELP')+show-preview"
--bind "alt-enter:unbind(change,alt-enter)+enable-search+clear-query"

View File

@@ -1,62 +0,0 @@
#!/bin/sh
if [ $# -eq 0 ]; then
echo 'error: argument required (action), one of: clone, fetch, merge' >&2
exit 1
fi
ACTION="$1"
PLUGINS_DIR=$(dirname $(realpath "$0"))/plugins
cd "$PLUGINS_DIR"
action() {
case "$1" in
*:*)
P="$1"
;;
*)
P="https://github.com/$1"
;;
esac
B=$(basename "$1")
B="${B%.git}"
case "$ACTION" in
clone)
if [ ! -e "$B" ]; then
echo "$ACTION $B"
git clone "$P"
fi
;;
fetch)
if [ -e "$B" ]; then
echo "$ACTION $B"
git -C "$B" fetch
fi
;;
merge)
if [ -e "$B" ]; then
echo "$ACTION $B"
git -C "$B" merge
fi
;;
*)
echo "error: unsupported action: $ACTION" >&2
exit 1
;;
esac
}
for plugin in \
'https://gitlab.com/muhq/vis-lspc' \
'lutobler/vis-commentary' \
'https://repo.or.cz/vis-surround.git' \
'peaceant/vis-fzf-mru' \
'https://gitlab.com/muhq/vis-build' \
'erf/vis-cursors' \
'thimc/vis-colorizer' \
'https://gitea.lupan.pl/lupan/vis-pin-files.git'; \
do
action "$plugin"
done

View File

@@ -1,32 +1,44 @@
require('vis') require('vis')
require('fast-jump') require('fast-jump')
local lspc = require('plugins/vis-lspc') local plug = (function()
require('plugins/vis-commentary') if not pcall(require, 'plugins/vis-plug') then
require('plugins/vis-surround') os.execute('git clone --quiet https://github.com/erf/vis-plug ' ..
local fzfmru = require('plugins/vis-fzf-mru/fzf-mru') (os.getenv('XDG_CONFIG_HOME') or os.getenv('HOME') .. '/.config')
require('plugins/vis-build') .. '/vis/plugins/vis-plug')
require('plugins/vis-cursors') end
require('plugins/vis-colorizer') return require('plugins/vis-plug')
end)()
require('plugins/vis-pin-files') plug = require('plugins/vis-plug')
local plugins = {
{ 'https://gitlab.com/muhq/vis-lspc', alias = 'lspc' },
{ 'lutobler/vis-commentary' },
{ 'https://repo.or.cz/vis-surround.git' },
{ 'peaceant/vis-fzf-mru', file = 'fzf-mru', alias = 'fzfmru' },
{ 'https://gitlab.com/muhq/vis-build' },
{ 'erf/vis-cursors' },
}
plug.init(plugins, true)
vis.ftdetect.filetypes.go_ext = vis.ftdetect.filetypes.go vis.ftdetect.filetypes.go_ext = vis.ftdetect.filetypes.go
vis.ftdetect.filetypes.go = nil vis.ftdetect.filetypes.go = nil
lspc.ls_map.go_ext = lspc.ls_map.go plug.plugins.lspc.ls_map.go_ext = plug.plugins.lspc.ls_map.go
vis.ftdetect.filetypes.templ = { vis.ftdetect.filetypes.templ = {
ext = { "%.templ$" }, ext = { "%.templ$" },
} }
lspc.message_level = 2 plug.plugins.lspc.message_level = 2
lspc.ls_map.templ = { plug.plugins.lspc.ls_map.templ = {
name = 'templ-lsp', name = 'templ-lsp',
cmd = 'templ lsp', cmd = 'templ lsp',
} }
fzfmru.fzfmru_history = 60 plug.plugins.fzfmru.fzfmru_history = 60
local function open_file(file, cmd) local function open_file(file, cmd)
vis:command((cmd or 'o') .. ' ' .. file) vis:command((cmd or 'o') .. ' ' .. file)
@@ -122,6 +134,30 @@ local function search(cmd, action)
cmd_action(cmd, action) cmd_action(cmd, action)
end end
local file_slots = {}
local function set_file_slot(num)
local file = vis.win.file.path
if file ~= nil then
file_slots[num] = file
vis:info('File slot [' .. num .. '] updated')
else
vis:info('Window has no file')
end
end
local function open_file_slot(num, open_cmd)
local file = file_slots[num]
if file == nil then
vis:info('File slot [' .. num .. '] empty')
elseif file == vis.win.file.path then
vis:info('File slot [' .. num .. '] is the same file, no file change')
else
vis:info('File slot [' .. num .. '] open')
open_file(file, open_cmd)
end
end
local function fzf_reload(cmd) local function fzf_reload(cmd)
local prompt = escape_and_quoted('1. ' .. cmd:match('^%w*') .. '> ') local prompt = escape_and_quoted('1. ' .. cmd:match('^%w*') .. '> ')
if not cmd:match('{q}') then if not cmd:match('{q}') then
@@ -242,7 +278,6 @@ vis.events.subscribe(vis.events.INIT, function()
vis:map(vis.modes.NORMAL, '<M-k>', '<vis-window-prev>') vis:map(vis.modes.NORMAL, '<M-k>', '<vis-window-prev>')
vis:map(vis.modes.NORMAL, '<M-j>', '<vis-window-next>') vis:map(vis.modes.NORMAL, '<M-j>', '<vis-window-next>')
vis:map(vis.modes.NORMAL, '<M-n>', '<vis-prompt-show>open<Enter>')
vis:map(vis.modes.NORMAL, ' K', close_prev_win) vis:map(vis.modes.NORMAL, ' K', close_prev_win)
vis:map(vis.modes.NORMAL, ' J', close_next_win) vis:map(vis.modes.NORMAL, ' J', close_next_win)
@@ -250,6 +285,14 @@ vis.events.subscribe(vis.events.INIT, function()
vis:map(vis.modes.NORMAL, ' ]', '<vis-prompt-show>lspc-next-diagnostic<Enter>') vis:map(vis.modes.NORMAL, ' ]', '<vis-prompt-show>lspc-next-diagnostic<Enter>')
vis:map(vis.modes.NORMAL, ' =', '<vis-prompt-show>lspc-format<Enter>') vis:map(vis.modes.NORMAL, ' =', '<vis-prompt-show>lspc-format<Enter>')
for num = 1, 9 do
vis:map(vis.modes.NORMAL, ' r' .. num, function() set_file_slot(num) end, 'set file slot ' .. num)
vis:map(vis.modes.NORMAL, ' ' .. num, function() open_file_slot(num, 'e') end, 'open file slot ' .. num)
vis:map(vis.modes.NORMAL, ' h' .. num, function() open_file_slot(num, 'o') end, 'open file slot ' .. num)
vis:map(vis.modes.NORMAL, ' v' .. num, function() open_file_slot(num, 'vsplit') end,
'open file slot ' .. num)
end
vis:map(vis.modes.NORMAL, ' s', '<vis-prompt-show>fzf-files auto-search<Enter>', 'fzf: search') vis:map(vis.modes.NORMAL, ' s', '<vis-prompt-show>fzf-files auto-search<Enter>', 'fzf: search')
vis:map(vis.modes.NORMAL, ' f', '<vis-prompt-show>fzf-files auto-files<Enter>', 'fzf: files') vis:map(vis.modes.NORMAL, ' f', '<vis-prompt-show>fzf-files auto-files<Enter>', 'fzf: files')
vis:map(vis.modes.NORMAL, ' S', '<vis-prompt-show>fzf-files search<Enter>', 'fzf: search with rg') vis:map(vis.modes.NORMAL, ' S', '<vis-prompt-show>fzf-files search<Enter>', 'fzf: search with rg')
@@ -259,12 +302,12 @@ vis.events.subscribe(vis.events.INIT, function()
search(fzf_reload(ripgrep .. ' --with-filename {q} ' .. escape_and_quoted(vis.win.file.path))) search(fzf_reload(ripgrep .. ' --with-filename {q} ' .. escape_and_quoted(vis.win.file.path)))
end, 'fzf: rg current file') end, 'fzf: rg current file')
vis:map(vis.modes.NORMAL, ' d', function() vis:map(vis.modes.NORMAL, ' .', function()
local shell = os.getenv('SHELL') local shell = os.getenv('SHELL')
vis:command('!' .. shell) vis:command('!' .. shell)
end, 'run shell') end, 'run shell')
vis:map(vis.modes.NORMAL, ' D', function() vis:map(vis.modes.NORMAL, ' ds', function()
local shell = os.getenv('SHELL') local shell = os.getenv('SHELL')
local path = vis.win.file.path local path = vis.win.file.path
if path then if path then
@@ -305,7 +348,7 @@ vis.events.subscribe(vis.events.INIT, function()
end, 'open file from current line in below window (with optional line and col)') end, 'open file from current line in below window (with optional line and col)')
vis:map(vis.modes.NORMAL, ' c', function() vis:map(vis.modes.NORMAL, ' c', function()
search('( fd -t d "" ~/src ~/dotfiles -H -E "\\.git" -E node_modules ; zoxide query -l ) | fzf --scheme path', function(path) search('zoxide query -l | fzf', function(path)
vis:command('cd ' .. path) vis:command('cd ' .. path)
end) end)
end, 'fzf change directory') end, 'fzf change directory')
@@ -327,7 +370,7 @@ vis.events.subscribe(vis.events.INIT, function()
search('cat ~/.config/vis/global-marks.txt | fzf --tac') search('cat ~/.config/vis/global-marks.txt | fzf --tac')
end, 'global marks: jump') end, 'global marks: jump')
vis:map(vis.modes.NORMAL, ' zm', function() vis:map(vis.modes.NORMAL, ' em', function()
vis:command('o ~/.config/vis/global-marks.txt') vis:command('o ~/.config/vis/global-marks.txt')
end, 'global marks: edit') end, 'global marks: edit')

View File

@@ -30,11 +30,6 @@ xsetroot -cursor_name left_ptr
picom -b -I 1 -O 1 -i 1 -e 1 --no-fading-openclose || compton -b --no-fading-openclose picom -b -I 1 -O 1 -i 1 -e 1 --no-fading-openclose || compton -b --no-fading-openclose
if which dwm > /dev/null; then
lupan-clock &
exec dwm
fi
if which awesome > /dev/null; then if which awesome > /dev/null; then
exec awesome exec awesome
fi fi
@@ -47,6 +42,11 @@ fi
exec dk exec dk
fi fi
if which dwm > /dev/null; then
lupan-clock &
exec dwm
fi
if which xmonad > /dev/null && test -f ~/.config/xmonad/xmonad.hs; then if which xmonad > /dev/null && test -f ~/.config/xmonad/xmonad.hs; then
exec xmonad exec xmonad
fi fi

View File

@@ -2,27 +2,24 @@
THEME="$1" THEME="$1"
XSET=$(readlink -e ~/.config/xsettingsd/xsettingsd.conf)
if [ "$THEME" = "toggle" ]; then if [ "$THEME" = "toggle" ]; then
if [ -e ~/.lightmode ]; then if grep Materia-dark "$XSET" > /dev/null; then
THEME=dark
else
THEME=light THEME=light
else
THEME=dark
fi fi
fi fi
if [ "$THEME" = dark ]; then if [ "$THEME" = dark ]; then
GTK_THEME=Materia-dark GTK_THEME=Materia-dark
rm -f ~/.lightmode
elif [ "$THEME" = light ]; then elif [ "$THEME" = light ]; then
GTK_THEME=Materia-light GTK_THEME=Materia-light
touch ~/.lightmode
else else
echo "error: unknown theme: should be either dark, light or toggle" >&2 echo "error: unknown theme: should be either dark, light or toggle" >&2
exit 1 exit 1
fi fi
killall -USR1 dwm
XRES=$(readlink -e ~/.Xresources) XRES=$(readlink -e ~/.Xresources)
if [ -n "$XRES" ]; then if [ -n "$XRES" ]; then
if [ "$THEME" = dark ]; then if [ "$THEME" = dark ]; then
@@ -44,7 +41,6 @@ if [ -f "$ATOML" ]; then
sed -i "s#^import =.*#import = [\"~/.config/alacritty/$THEME.toml\"]#" "$ATOML" sed -i "s#^import =.*#import = [\"~/.config/alacritty/$THEME.toml\"]#" "$ATOML"
fi fi
XSET=$(readlink -e ~/.config/xsettingsd/xsettingsd.conf)
if [ "$THEME" = dark ]; then if [ "$THEME" = dark ]; then
kitten themes --reload-in=all Afterglow kitten themes --reload-in=all Afterglow
elif [ "$THEME" = light ]; then elif [ "$THEME" = light ]; then