Compare commits
9 Commits
d38875e471
...
7c05d57053
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c05d57053 | |||
| bce8fbc87c | |||
| 58fa05c6f8 | |||
| 77108587b2 | |||
| 297d2959fa | |||
| bcd7480efc | |||
| e149e46b81 | |||
| e54be984ac | |||
| 9130eb1a37 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,3 +10,4 @@ __pycache__
|
||||
/dwm
|
||||
/st
|
||||
/vis/.config/vis/plugins/
|
||||
/tools/.local/bin/
|
||||
|
||||
43
compile_tools.sh
Executable file
43
compile_tools.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
|
||||
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 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 exec dotfiles-go chown "$uid" /go
|
||||
|
||||
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-rust && sleep 3 || :
|
||||
docker run --rm -d --name dotfiles-rust -v ./tools/.local/bin:/rust/bin rust:1.90-bullseye tail -f /dev/null
|
||||
|
||||
cargo-install zoxide zoxide --locked
|
||||
cargo-install rg ripgrep
|
||||
cargo-install fd fd-find
|
||||
cargo-install bat bat --locked
|
||||
cargo-install eza eza
|
||||
cargo-install delta git-delta
|
||||
cargo-install jj --bin jj jj-cli --locked
|
||||
cargo-install lazyjj lazyjj --locked
|
||||
|
||||
docker kill dotfiles-rust
|
||||
@@ -18,6 +18,7 @@ if [ "$1" = list ]; then
|
||||
case "$prompt" in
|
||||
dir:*)
|
||||
dir=${FZF_HEADER_LABEL#?}
|
||||
fd -t d '' ~/src ~/dotfiles 2 -H -E '\.git' -E node_modules
|
||||
zoxide query -l
|
||||
echo $dir
|
||||
exit
|
||||
@@ -28,6 +29,9 @@ if [ "$1" = list ]; then
|
||||
files+hidden)
|
||||
exec fd --type f -H '' $dir
|
||||
;;
|
||||
find-files*)
|
||||
exec find $dir -type f
|
||||
;;
|
||||
search)
|
||||
exec $ripgrep "$FZF_QUERY" $dir
|
||||
;;
|
||||
@@ -116,6 +120,9 @@ if [ "$1" = key ]; then
|
||||
;;
|
||||
alt-f)
|
||||
case "$cmd" in
|
||||
files)
|
||||
prompt="find-files$hidden"
|
||||
;;
|
||||
*files|search)
|
||||
prompt="files$hidden"
|
||||
;;
|
||||
@@ -220,7 +227,7 @@ auto-search)
|
||||
action="$no_search"
|
||||
prompt="$cmd> "
|
||||
;;
|
||||
files|git-files|jj-files)
|
||||
files|git-files|jj-files|find-files)
|
||||
cmd="$1"
|
||||
action="$search"
|
||||
prompt="$1> "
|
||||
@@ -265,6 +272,7 @@ exec fzf --query "$3" \
|
||||
--header-label "$label" \
|
||||
--multi \
|
||||
--ansi \
|
||||
--scheme path \
|
||||
--delimiter : \
|
||||
--ghost ' (Use alt-? for help)' \
|
||||
--bind "enter:transform($accept)" \
|
||||
@@ -279,4 +287,5 @@ exec fzf --query "$3" \
|
||||
--bind "alt-s:$key" \
|
||||
--bind "alt-p:change-preview(sh $0 preview {1} {2})+toggle-preview" \
|
||||
--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"
|
||||
|
||||
62
vis/.config/vis/plugins.sh
Executable file
62
vis/.config/vis/plugins.sh
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/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
|
||||
@@ -1,44 +1,32 @@
|
||||
require('vis')
|
||||
require('fast-jump')
|
||||
|
||||
local plug = (function()
|
||||
if not pcall(require, 'plugins/vis-plug') then
|
||||
os.execute('git clone --quiet https://github.com/erf/vis-plug ' ..
|
||||
(os.getenv('XDG_CONFIG_HOME') or os.getenv('HOME') .. '/.config')
|
||||
.. '/vis/plugins/vis-plug')
|
||||
end
|
||||
return require('plugins/vis-plug')
|
||||
end)()
|
||||
local lspc = require('plugins/vis-lspc')
|
||||
require('plugins/vis-commentary')
|
||||
require('plugins/vis-surround')
|
||||
local fzfmru = require('plugins/vis-fzf-mru/fzf-mru')
|
||||
require('plugins/vis-build')
|
||||
require('plugins/vis-cursors')
|
||||
require('plugins/vis-colorizer')
|
||||
|
||||
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)
|
||||
require('plugins/vis-pin-files')
|
||||
|
||||
vis.ftdetect.filetypes.go_ext = vis.ftdetect.filetypes.go
|
||||
vis.ftdetect.filetypes.go = nil
|
||||
plug.plugins.lspc.ls_map.go_ext = plug.plugins.lspc.ls_map.go
|
||||
lspc.ls_map.go_ext = lspc.ls_map.go
|
||||
|
||||
vis.ftdetect.filetypes.templ = {
|
||||
ext = { "%.templ$" },
|
||||
}
|
||||
|
||||
plug.plugins.lspc.message_level = 2
|
||||
lspc.message_level = 2
|
||||
|
||||
plug.plugins.lspc.ls_map.templ = {
|
||||
lspc.ls_map.templ = {
|
||||
name = 'templ-lsp',
|
||||
cmd = 'templ lsp',
|
||||
}
|
||||
|
||||
plug.plugins.fzfmru.fzfmru_history = 60
|
||||
fzfmru.fzfmru_history = 60
|
||||
|
||||
local function open_file(file, cmd)
|
||||
vis:command((cmd or 'o') .. ' ' .. file)
|
||||
@@ -134,30 +122,6 @@ local function search(cmd, action)
|
||||
cmd_action(cmd, action)
|
||||
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 prompt = escape_and_quoted('1. ' .. cmd:match('^%w*') .. '> ')
|
||||
if not cmd:match('{q}') then
|
||||
@@ -278,6 +242,7 @@ vis.events.subscribe(vis.events.INIT, function()
|
||||
|
||||
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-n>', '<vis-prompt-show>open<Enter>')
|
||||
vis:map(vis.modes.NORMAL, ' K', close_prev_win)
|
||||
vis:map(vis.modes.NORMAL, ' J', close_next_win)
|
||||
|
||||
@@ -285,14 +250,6 @@ 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-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, ' 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')
|
||||
@@ -302,12 +259,12 @@ vis.events.subscribe(vis.events.INIT, function()
|
||||
search(fzf_reload(ripgrep .. ' --with-filename {q} ' .. escape_and_quoted(vis.win.file.path)))
|
||||
end, 'fzf: rg current file')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' .', function()
|
||||
vis:map(vis.modes.NORMAL, ' d', function()
|
||||
local shell = os.getenv('SHELL')
|
||||
vis:command('!' .. shell)
|
||||
end, 'run shell')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' ds', function()
|
||||
vis:map(vis.modes.NORMAL, ' D', function()
|
||||
local shell = os.getenv('SHELL')
|
||||
local path = vis.win.file.path
|
||||
if path then
|
||||
@@ -348,7 +305,7 @@ vis.events.subscribe(vis.events.INIT, function()
|
||||
end, 'open file from current line in below window (with optional line and col)')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' c', function()
|
||||
search('zoxide query -l | fzf', function(path)
|
||||
search('( fd -t d "" ~/src ~/dotfiles -H -E "\\.git" -E node_modules ; zoxide query -l ) | fzf --scheme path', function(path)
|
||||
vis:command('cd ' .. path)
|
||||
end)
|
||||
end, 'fzf change directory')
|
||||
@@ -370,7 +327,7 @@ vis.events.subscribe(vis.events.INIT, function()
|
||||
search('cat ~/.config/vis/global-marks.txt | fzf --tac')
|
||||
end, 'global marks: jump')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' em', function()
|
||||
vis:map(vis.modes.NORMAL, ' zm', function()
|
||||
vis:command('o ~/.config/vis/global-marks.txt')
|
||||
end, 'global marks: edit')
|
||||
|
||||
|
||||
@@ -30,6 +30,11 @@ xsetroot -cursor_name left_ptr
|
||||
|
||||
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
|
||||
exec awesome
|
||||
fi
|
||||
@@ -42,11 +47,6 @@ fi
|
||||
exec dk
|
||||
fi
|
||||
|
||||
if which dwm > /dev/null; then
|
||||
lupan-clock &
|
||||
exec dwm
|
||||
fi
|
||||
|
||||
if which xmonad > /dev/null && test -f ~/.config/xmonad/xmonad.hs; then
|
||||
exec xmonad
|
||||
fi
|
||||
|
||||
@@ -2,24 +2,27 @@
|
||||
|
||||
THEME="$1"
|
||||
|
||||
XSET=$(readlink -e ~/.config/xsettingsd/xsettingsd.conf)
|
||||
if [ "$THEME" = "toggle" ]; then
|
||||
if grep Materia-dark "$XSET" > /dev/null; then
|
||||
THEME=light
|
||||
else
|
||||
if [ -e ~/.lightmode ]; then
|
||||
THEME=dark
|
||||
else
|
||||
THEME=light
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$THEME" = dark ]; then
|
||||
GTK_THEME=Materia-dark
|
||||
rm -f ~/.lightmode
|
||||
elif [ "$THEME" = light ]; then
|
||||
GTK_THEME=Materia-light
|
||||
touch ~/.lightmode
|
||||
else
|
||||
echo "error: unknown theme: should be either dark, light or toggle" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
killall -USR1 dwm
|
||||
|
||||
XRES=$(readlink -e ~/.Xresources)
|
||||
if [ -n "$XRES" ]; then
|
||||
if [ "$THEME" = dark ]; then
|
||||
@@ -41,6 +44,7 @@ if [ -f "$ATOML" ]; then
|
||||
sed -i "s#^import =.*#import = [\"~/.config/alacritty/$THEME.toml\"]#" "$ATOML"
|
||||
fi
|
||||
|
||||
XSET=$(readlink -e ~/.config/xsettingsd/xsettingsd.conf)
|
||||
if [ "$THEME" = dark ]; then
|
||||
kitten themes --reload-in=all Afterglow
|
||||
elif [ "$THEME" = light ]; then
|
||||
|
||||
Reference in New Issue
Block a user