restertet yazi setup

new file:   herdr/.config/herdr/sessions/home/session-history.json
	new file:   herdr/.config/herdr/sessions/home/session.json
	new file:   kanata/.config/systemd/user/default.target.wants/duplicati.service
	new file:   pi/.pi/agent/extensions/atuin.ts
	new file:   yazi/.config/yazi/bookmark
	modified:   yazi/.config/yazi/init.lua
	modified:   yazi/.config/yazi/keymap.toml
	modified:   yazi/.config/yazi/package.toml
	renamed:    yazi/.config/yazi/flavors/catppuccin-mocha.yazi/LICENSE -> yazi/.config/yazi/plugins/chmod.yazi/LICENSE
	new file:   yazi/.config/yazi/plugins/chmod.yazi/README.md
	new file:   yazi/.config/yazi/plugins/chmod.yazi/main.lua
	new file:   yazi/.config/yazi/plugins/eza-preview.yazi/LICENSE
	new file:   yazi/.config/yazi/plugins/eza-preview.yazi/README.md
	new file:   yazi/.config/yazi/plugins/eza-preview.yazi/main.lua
	modified:   yazi/.config/yazi/plugins/fchar.yazi/README.md
	modified:   yazi/.config/yazi/plugins/fchar.yazi/main.lua
	deleted:    yazi/.config/yazi/plugins/file-extra-metadata.yazi/main.lua
	modified:   yazi/.config/yazi/plugins/mediainfo.yazi/LICENSE
	modified:   yazi/.config/yazi/plugins/mediainfo.yazi/README.md
	new file:   yazi/.config/yazi/plugins/mediainfo.yazi/adobe-old.lua
	new file:   yazi/.config/yazi/plugins/mediainfo.yazi/adobe-stable.lua
	new file:   yazi/.config/yazi/plugins/mediainfo.yazi/audio-old.lua
	new file:   yazi/.config/yazi/plugins/mediainfo.yazi/audio-stable.lua
	new file:   yazi/.config/yazi/plugins/mediainfo.yazi/const.lua
	new file:   yazi/.config/yazi/plugins/mediainfo.yazi/image-old.lua
	new file:   yazi/.config/yazi/plugins/mediainfo.yazi/image-stable.lua
	modified:   yazi/.config/yazi/plugins/mediainfo.yazi/main.lua
	new file:   yazi/.config/yazi/plugins/mediainfo.yazi/none-media-preview-old.lua
	new file:   yazi/.config/yazi/plugins/mediainfo.yazi/none-media-preview-stable.lua
	new file:   yazi/.config/yazi/plugins/mediainfo.yazi/utils.lua
	new file:   yazi/.config/yazi/plugins/mediainfo.yazi/video-old.lua
	new file:   yazi/.config/yazi/plugins/mediainfo.yazi/video-stable.lua
	modified:   yazi/.config/yazi/plugins/mime-ext.yazi/README.md
	new file:   yazi/.config/yazi/plugins/mime-ext.yazi/local.lua
	modified:   yazi/.config/yazi/plugins/mime-ext.yazi/main.lua
	new file:   yazi/.config/yazi/plugins/mime-ext.yazi/remote.lua
	modified:   yazi/.config/yazi/plugins/rich-preview.yazi/main.lua
	modified:   yazi/.config/yazi/plugins/smart-enter.yazi/README.md
	deleted:    yazi/.config/yazi/plugins/whoosh.yazi/.luarc.json
	modified:   yazi/.config/yazi/plugins/whoosh.yazi/LICENSE
	deleted:    yazi/.config/yazi/plugins/whoosh.yazi/README-RU.md
	modified:   yazi/.config/yazi/plugins/whoosh.yazi/README.md
	modified:   yazi/.config/yazi/plugins/whoosh.yazi/bookmarks
	deleted:    yazi/.config/yazi/plugins/whoosh.yazi/image/history.png
	deleted:    yazi/.config/yazi/plugins/whoosh.yazi/image/plugin.png
	modified:   yazi/.config/yazi/plugins/whoosh.yazi/main.lua
	modified:   yazi/.config/yazi/yazi.toml
	renamed:    yazi/.config/yazi/plugins/full-border.yazi/LICENSE -> yazi_1/.config/yazi/flavors/catppuccin-mocha.yazi/LICENSE
	renamed:    yazi/.config/yazi/flavors/catppuccin-mocha.yazi/LICENSE-tmtheme -> yazi_1/.config/yazi/flavors/catppuccin-mocha.yazi/LICENSE-tmtheme
	renamed:    yazi/.config/yazi/flavors/catppuccin-mocha.yazi/README.md -> yazi_1/.config/yazi/flavors/catppuccin-mocha.yazi/README.md
	renamed:    yazi/.config/yazi/flavors/catppuccin-mocha.yazi/flavor.toml -> yazi_1/.config/yazi/flavors/catppuccin-mocha.yazi/flavor.toml
	renamed:    yazi/.config/yazi/flavors/catppuccin-mocha.yazi/preview.png -> yazi_1/.config/yazi/flavors/catppuccin-mocha.yazi/preview.png
	renamed:    yazi/.config/yazi/flavors/catppuccin-mocha.yazi/tmtheme.xml -> yazi_1/.config/yazi/flavors/catppuccin-mocha.yazi/tmtheme.xml
	renamed:    yazi/.config/yazi/flavors/dracula.yazi -> yazi_1/.config/yazi/flavors/dracula.yazi
	renamed:    yazi/.config/yazi/flavors/everforest-medium.yazi/LICENSE -> yazi_1/.config/yazi/flavors/everforest-medium.yazi/LICENSE
	renamed:    yazi/.config/yazi/flavors/everforest-medium.yazi/LICENSE-tmtheme -> yazi_1/.config/yazi/flavors/everforest-medium.yazi/LICENSE-tmtheme
	renamed:    yazi/.config/yazi/flavors/everforest-medium.yazi/README.md -> yazi_1/.config/yazi/flavors/everforest-medium.yazi/README.md
	renamed:    yazi/.config/yazi/flavors/everforest-medium.yazi/flavor.toml -> yazi_1/.config/yazi/flavors/everforest-medium.yazi/flavor.toml
	renamed:    yazi/.config/yazi/flavors/everforest-medium.yazi/preview.png -> yazi_1/.config/yazi/flavors/everforest-medium.yazi/preview.png
	renamed:    yazi/.config/yazi/flavors/everforest-medium.yazi/tmtheme.xml -> yazi_1/.config/yazi/flavors/everforest-medium.yazi/tmtheme.xml
	new file:   yazi_1/.config/yazi/flavors/gruvbox-dark.yazi/LICENSE
	new file:   yazi_1/.config/yazi/flavors/gruvbox-dark.yazi/LICENSE-tmtheme
	new file:   yazi_1/.config/yazi/flavors/gruvbox-dark.yazi/README.md
	new file:   yazi_1/.config/yazi/flavors/gruvbox-dark.yazi/flavor.toml
	new file:   yazi_1/.config/yazi/flavors/gruvbox-dark.yazi/preview.png
	new file:   yazi_1/.config/yazi/flavors/gruvbox-dark.yazi/tmtheme.xml
	renamed:    yazi/.config/yazi/flavors/gruvbox-material.yazi/LICENSE -> yazi_1/.config/yazi/flavors/gruvbox-material.yazi/LICENSE
	renamed:    yazi/.config/yazi/flavors/gruvbox-material.yazi/LICENSE-tmtheme -> yazi_1/.config/yazi/flavors/gruvbox-material.yazi/LICENSE-tmtheme
	renamed:    yazi/.config/yazi/flavors/gruvbox-material.yazi/README.md -> yazi_1/.config/yazi/flavors/gruvbox-material.yazi/README.md
	renamed:    yazi/.config/yazi/flavors/gruvbox-material.yazi/flavor.toml -> yazi_1/.config/yazi/flavors/gruvbox-material.yazi/flavor.toml
	renamed:    yazi/.config/yazi/flavors/gruvbox-material.yazi/preview.png -> yazi_1/.config/yazi/flavors/gruvbox-material.yazi/preview.png
	renamed:    yazi/.config/yazi/flavors/gruvbox-material.yazi/tmtheme.xml -> yazi_1/.config/yazi/flavors/gruvbox-material.yazi/tmtheme.xml
	renamed:    yazi/.config/yazi/flavors/kanagawa.yazi/LICENSE -> yazi_1/.config/yazi/flavors/kanagawa.yazi/LICENSE
	renamed:    yazi/.config/yazi/flavors/kanagawa.yazi/LICENSE-tmtheme -> yazi_1/.config/yazi/flavors/kanagawa.yazi/LICENSE-tmtheme
	renamed:    yazi/.config/yazi/flavors/kanagawa.yazi/README.md -> yazi_1/.config/yazi/flavors/kanagawa.yazi/README.md
	renamed:    yazi/.config/yazi/flavors/kanagawa.yazi/flavor.toml -> yazi_1/.config/yazi/flavors/kanagawa.yazi/flavor.toml
	renamed:    yazi/.config/yazi/flavors/kanagawa.yazi/preview.png -> yazi_1/.config/yazi/flavors/kanagawa.yazi/preview.png
	renamed:    yazi/.config/yazi/flavors/kanagawa.yazi/tmtheme.xml -> yazi_1/.config/yazi/flavors/kanagawa.yazi/tmtheme.xml
	renamed:    yazi/.config/yazi/flavors/monokai.yazi/LICENSE -> yazi_1/.config/yazi/flavors/monokai.yazi/LICENSE
	renamed:    yazi/.config/yazi/flavors/monokai.yazi/LICENSE-tmtheme -> yazi_1/.config/yazi/flavors/monokai.yazi/LICENSE-tmtheme
	renamed:    yazi/.config/yazi/flavors/monokai.yazi/README.md -> yazi_1/.config/yazi/flavors/monokai.yazi/README.md
	renamed:    yazi/.config/yazi/flavors/monokai.yazi/flavor.toml -> yazi_1/.config/yazi/flavors/monokai.yazi/flavor.toml
	renamed:    yazi/.config/yazi/flavors/monokai.yazi/preview.png -> yazi_1/.config/yazi/flavors/monokai.yazi/preview.png
	renamed:    yazi/.config/yazi/flavors/monokai.yazi/tmtheme.xml -> yazi_1/.config/yazi/flavors/monokai.yazi/tmtheme.xml
	renamed:    yazi/.config/yazi/flavors/rose-pine-moon.yazi/LICENSE -> yazi_1/.config/yazi/flavors/rose-pine-moon.yazi/LICENSE
	renamed:    yazi/.config/yazi/flavors/rose-pine-moon.yazi/LICENSE-tmtheme -> yazi_1/.config/yazi/flavors/rose-pine-moon.yazi/LICENSE-tmtheme
	renamed:    yazi/.config/yazi/flavors/rose-pine-moon.yazi/README.md -> yazi_1/.config/yazi/flavors/rose-pine-moon.yazi/README.md
	renamed:    yazi/.config/yazi/flavors/rose-pine-moon.yazi/flavor.toml -> yazi_1/.config/yazi/flavors/rose-pine-moon.yazi/flavor.toml
	renamed:    yazi/.config/yazi/flavors/rose-pine-moon.yazi/preview.png -> yazi_1/.config/yazi/flavors/rose-pine-moon.yazi/preview.png
	renamed:    yazi/.config/yazi/flavors/rose-pine-moon.yazi/tmtheme.xml -> yazi_1/.config/yazi/flavors/rose-pine-moon.yazi/tmtheme.xml
	renamed:    yazi/.config/yazi/flavors/tokyo-night.yazi/LICENSE -> yazi_1/.config/yazi/flavors/tokyo-night.yazi/LICENSE
	renamed:    yazi/.config/yazi/flavors/tokyo-night.yazi/LICENSE-tmtheme -> yazi_1/.config/yazi/flavors/tokyo-night.yazi/LICENSE-tmtheme
	renamed:    yazi/.config/yazi/flavors/tokyo-night.yazi/README.md -> yazi_1/.config/yazi/flavors/tokyo-night.yazi/README.md
	renamed:    yazi/.config/yazi/flavors/tokyo-night.yazi/flavor.toml -> yazi_1/.config/yazi/flavors/tokyo-night.yazi/flavor.toml
	renamed:    yazi/.config/yazi/flavors/tokyo-night.yazi/preview.png -> yazi_1/.config/yazi/flavors/tokyo-night.yazi/preview.png
	renamed:    yazi/.config/yazi/flavors/tokyo-night.yazi/tmtheme.xml -> yazi_1/.config/yazi/flavors/tokyo-night.yazi/tmtheme.xml
	new file:   yazi_1/.config/yazi/init.lua
	new file:   yazi_1/.config/yazi/keymap.toml
	renamed:    yazi/.config/yazi/omp/omp.json -> yazi_1/.config/yazi/omp/omp.json
	renamed:    yazi/.config/yazi/omp/omp.toml -> yazi_1/.config/yazi/omp/omp.toml
	renamed:    yazi/.config/yazi/omp/omp2.toml -> yazi_1/.config/yazi/omp/omp2.toml
	renamed:    yazi/.config/yazi/omp/omp_rose-pine.toml -> yazi_1/.config/yazi/omp/omp_rose-pine.toml
	new file:   yazi_1/.config/yazi/package.toml
	renamed:    yazi/.config/yazi/plugins/bunny.yazi/LICENSE -> yazi_1/.config/yazi/plugins/bunny.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/bunny.yazi/README.md -> yazi_1/.config/yazi/plugins/bunny.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/bunny.yazi/main.lua -> yazi_1/.config/yazi/plugins/bunny.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/bypass.yazi/LICENSE -> yazi_1/.config/yazi/plugins/bypass.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/bypass.yazi/README.md -> yazi_1/.config/yazi/plugins/bypass.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/bypass.yazi/main.lua -> yazi_1/.config/yazi/plugins/bypass.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/dupes.yazi/LICENSE -> yazi_1/.config/yazi/plugins/dupes.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/dupes.yazi/README.md -> yazi_1/.config/yazi/plugins/dupes.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/dupes.yazi/main.lua -> yazi_1/.config/yazi/plugins/dupes.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/fazif.yazi/LICENSE -> yazi_1/.config/yazi/plugins/fazif.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/fazif.yazi/README.md -> yazi_1/.config/yazi/plugins/fazif.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/fazif.yazi/faziffd -> yazi_1/.config/yazi/plugins/fazif.yazi/faziffd
	renamed:    yazi/.config/yazi/plugins/fazif.yazi/faziffdr -> yazi_1/.config/yazi/plugins/fazif.yazi/faziffdr
	renamed:    yazi/.config/yazi/plugins/fazif.yazi/fazifrg -> yazi_1/.config/yazi/plugins/fazif.yazi/fazifrg
	renamed:    yazi/.config/yazi/plugins/fazif.yazi/fazifrga -> yazi_1/.config/yazi/plugins/fazif.yazi/fazifrga
	renamed:    yazi/.config/yazi/plugins/fazif.yazi/main.lua -> yazi_1/.config/yazi/plugins/fazif.yazi/main.lua
	new file:   yazi_1/.config/yazi/plugins/fchar.yazi/LICENSE
	new file:   yazi_1/.config/yazi/plugins/fchar.yazi/README.md
	new file:   yazi_1/.config/yazi/plugins/fchar.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/file-extra-metadata.yazi/LICENSE -> yazi_1/.config/yazi/plugins/file-extra-metadata.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/file-extra-metadata.yazi/README.md -> yazi_1/.config/yazi/plugins/file-extra-metadata.yazi/README.md
	new file:   yazi_1/.config/yazi/plugins/file-extra-metadata.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/git.yazi/LICENSE -> yazi_1/.config/yazi/plugins/full-border.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/full-border.yazi/README.md -> yazi_1/.config/yazi/plugins/full-border.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/full-border.yazi/main.lua -> yazi_1/.config/yazi/plugins/full-border.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/mount.yazi/LICENSE -> yazi_1/.config/yazi/plugins/git.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/git.yazi/README.md -> yazi_1/.config/yazi/plugins/git.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/git.yazi/main.lua -> yazi_1/.config/yazi/plugins/git.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/git.yazi/types.lua -> yazi_1/.config/yazi/plugins/git.yazi/types.lua
	renamed:    yazi/.config/yazi/plugins/lazygit.yazi/LICENSE -> yazi_1/.config/yazi/plugins/lazygit.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/lazygit.yazi/README.md -> yazi_1/.config/yazi/plugins/lazygit.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/lazygit.yazi/main.lua -> yazi_1/.config/yazi/plugins/lazygit.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/open-with-cmd.yazi/LICENSE -> yazi_1/.config/yazi/plugins/mediainfo.yazi/LICENSE
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/README.md
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/adobe-old.lua
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/adobe-stable.lua
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-09-14-23.png
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-09-15-39.png
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-16-51-11.png
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/assets/2025-02-15-16-52-39.png
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/audio-old.lua
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/audio-stable.lua
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/const.lua
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/image-old.lua
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/image-stable.lua
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/main.lua
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/none-media-preview-old.lua
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/none-media-preview-stable.lua
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/utils.lua
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/video-old.lua
	new file:   yazi_1/.config/yazi/plugins/mediainfo.yazi/video-stable.lua
	renamed:    yazi/.config/yazi/plugins/piper.yazi/LICENSE -> yazi_1/.config/yazi/plugins/mime-ext.yazi/LICENSE
	new file:   yazi_1/.config/yazi/plugins/mime-ext.yazi/README.md
	new file:   yazi_1/.config/yazi/plugins/mime-ext.yazi/local.lua
	new file:   yazi_1/.config/yazi/plugins/mime-ext.yazi/main.lua
	new file:   yazi_1/.config/yazi/plugins/mime-ext.yazi/remote.lua
	renamed:    yazi/.config/yazi/plugins/rsync.yazi/LICENSE -> yazi_1/.config/yazi/plugins/mount.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/mount.yazi/README.md -> yazi_1/.config/yazi/plugins/mount.yazi/README.md
	new file:   yazi_1/.config/yazi/plugins/mount.yazi/cross.lua
	renamed:    yazi/.config/yazi/plugins/mount.yazi/main.lua -> yazi_1/.config/yazi/plugins/mount.yazi/main.lua
	new file:   yazi_1/.config/yazi/plugins/mount.yazi/sudo.lua
	renamed:    yazi/.config/yazi/plugins/omp.yazi -> yazi_1/.config/yazi/plugins/omp.yazi
	renamed:    yazi/.config/yazi/plugins/open-git-remote.yazi/LICENSE -> yazi_1/.config/yazi/plugins/open-git-remote.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/open-git-remote.yazi/README.md -> yazi_1/.config/yazi/plugins/open-git-remote.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/open-git-remote.yazi/main.lua -> yazi_1/.config/yazi/plugins/open-git-remote.yazi/main.lua
	new file:   yazi_1/.config/yazi/plugins/open-with-cmd.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/open-with-cmd.yazi/README.md -> yazi_1/.config/yazi/plugins/open-with-cmd.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/open-with-cmd.yazi/main.lua -> yazi_1/.config/yazi/plugins/open-with-cmd.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/ouch.yazi/LICENSE -> yazi_1/.config/yazi/plugins/ouch.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/ouch.yazi/README.md -> yazi_1/.config/yazi/plugins/ouch.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/ouch.yazi/main.lua -> yazi_1/.config/yazi/plugins/ouch.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/toggle-pane.yazi/LICENSE -> yazi_1/.config/yazi/plugins/piper.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/piper.yazi/README.md -> yazi_1/.config/yazi/plugins/piper.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/piper.yazi/main.lua -> yazi_1/.config/yazi/plugins/piper.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/projects.yazi/LICENSE -> yazi_1/.config/yazi/plugins/projects.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/projects.yazi/README.md -> yazi_1/.config/yazi/plugins/projects.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/projects.yazi/json.lua -> yazi_1/.config/yazi/plugins/projects.yazi/json.lua
	renamed:    yazi/.config/yazi/plugins/projects.yazi/main.lua -> yazi_1/.config/yazi/plugins/projects.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/recycle-bin.yazi/LICENSE -> yazi_1/.config/yazi/plugins/recycle-bin.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/recycle-bin.yazi/README.md -> yazi_1/.config/yazi/plugins/recycle-bin.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/recycle-bin.yazi/main.lua -> yazi_1/.config/yazi/plugins/recycle-bin.yazi/main.lua
	new file:   yazi_1/.config/yazi/plugins/rich-preview.yazi/LICENSE
	new file:   yazi_1/.config/yazi/plugins/rich-preview.yazi/README.md
	new file:   yazi_1/.config/yazi/plugins/rich-preview.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/vcs-files.yazi/LICENSE -> yazi_1/.config/yazi/plugins/rsync.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/rsync.yazi/README.md -> yazi_1/.config/yazi/plugins/rsync.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/rsync.yazi/assets/demo.gif -> yazi_1/.config/yazi/plugins/rsync.yazi/assets/demo.gif
	renamed:    yazi/.config/yazi/plugins/rsync.yazi/assets/demo.webm -> yazi_1/.config/yazi/plugins/rsync.yazi/assets/demo.webm
	renamed:    yazi/.config/yazi/plugins/rsync.yazi/main.lua -> yazi_1/.config/yazi/plugins/rsync.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/simple-tag.yazi/LICENSE -> yazi_1/.config/yazi/plugins/simple-tag.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/simple-tag.yazi/README.md -> yazi_1/.config/yazi/plugins/simple-tag.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/simple-tag.yazi/main.lua -> yazi_1/.config/yazi/plugins/simple-tag.yazi/main.lua
	new file:   yazi_1/.config/yazi/plugins/smart-enter.yazi/LICENSE
	new file:   yazi_1/.config/yazi/plugins/smart-enter.yazi/README.md
	new file:   yazi_1/.config/yazi/plugins/smart-enter.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/smart-paste.yazi/LICENSE -> yazi_1/.config/yazi/plugins/smart-paste.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/smart-paste.yazi/README.md -> yazi_1/.config/yazi/plugins/smart-paste.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/smart-paste.yazi/main.lua -> yazi_1/.config/yazi/plugins/smart-paste.yazi/main.lua
	new file:   yazi_1/.config/yazi/plugins/toggle-pane.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/toggle-pane.yazi/README.md -> yazi_1/.config/yazi/plugins/toggle-pane.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/toggle-pane.yazi/main.lua -> yazi_1/.config/yazi/plugins/toggle-pane.yazi/main.lua
	new file:   yazi_1/.config/yazi/plugins/vcs-files.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/vcs-files.yazi/README.md -> yazi_1/.config/yazi/plugins/vcs-files.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/vcs-files.yazi/main.lua -> yazi_1/.config/yazi/plugins/vcs-files.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/what-size.yazi/LICENSE -> yazi_1/.config/yazi/plugins/what-size.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/what-size.yazi/README.md -> yazi_1/.config/yazi/plugins/what-size.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/what-size.yazi/main.lua -> yazi_1/.config/yazi/plugins/what-size.yazi/main.lua
	new file:   yazi_1/.config/yazi/plugins/whoosh.yazi
	new file:   yazi_1/.config/yazi/plugins/wise-enter.yazi/LICENSE
	new file:   yazi_1/.config/yazi/plugins/wise-enter.yazi/README.md
	new file:   yazi_1/.config/yazi/plugins/wise-enter.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/yafg.yazi/LICENSE -> yazi_1/.config/yazi/plugins/yafg.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/yafg.yazi/README.md -> yazi_1/.config/yazi/plugins/yafg.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/yafg.yazi/main.lua -> yazi_1/.config/yazi/plugins/yafg.yazi/main.lua
	renamed:    yazi/.config/yazi/plugins/yaziline.yazi/LICENSE -> yazi_1/.config/yazi/plugins/yaziline.yazi/LICENSE
	renamed:    yazi/.config/yazi/plugins/yaziline.yazi/README.md -> yazi_1/.config/yazi/plugins/yaziline.yazi/README.md
	renamed:    yazi/.config/yazi/plugins/yaziline.yazi/main.lua -> yazi_1/.config/yazi/plugins/yaziline.yazi/main.lua
	renamed:    yazi/.config/yazi/tags/home/liph/.local/share/Trash/files/tags.json -> yazi_1/.config/yazi/tags/home/liph/.local/share/Trash/files/tags.json
	renamed:    yazi/.config/yazi/tags/home/liph/Downloads/tags.json -> yazi_1/.config/yazi/tags/home/liph/Downloads/tags.json
	renamed:    yazi/.config/yazi/tags/home/liph/programming/webdev/html/static/tags.json -> yazi_1/.config/yazi/tags/home/liph/programming/webdev/html/static/tags.json
	new file:   yazi_1/.config/yazi/tags/home/liph/scripts/tags.json
	renamed:    yazi/.config/yazi/tags/home/liph/tags.json -> yazi_1/.config/yazi/tags/home/liph/tags.json
	new file:   yazi_1/.config/yazi/yazi.toml
This commit is contained in:
liph committed 2026-08-29 08:59:31 +02:00
1 parent d6fd64c8af
commit a8a1b5a718
226 files changed
+17541 -3631

No files matched your search

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 MasouShizuka
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,214 @@
# projects.yazi
A [Yazi](https://github.com/sxyazi/yazi) plugin that adds the functionality to save, load and merge projects.
A project means all `tabs` and their status, including `cwd` and so on.
> [!NOTE]
> The latest release of Yazi is required at the moment.
https://github.com/MasouShizuka/projects.yazi/assets/44764707/79c3559a-7776-48cd-8317-dd1478314eed
## Features
- Save/load projects
- Load last project
- Projects persistence
- Merge a project or its current tab to other projects
## Installation
```sh
ya pkg add MasouShizuka/projects
```
or
```sh
# Windows
git clone https://github.com/MasouShizuka/projects.yazi.git %AppData%\yazi\config\plugins\projects.yazi
# Linux/macOS
git clone https://github.com/MasouShizuka/projects.yazi.git ~/.config/yazi/plugins/projects.yazi
```
## Keymap
Add this to your `keymap.toml`:
```toml
[[mgr.prepend_keymap]]
on = [ "P", "s" ]
run = "plugin projects save"
desc = "Save current project"
[[mgr.prepend_keymap]]
on = [ "P", "l" ]
run = "plugin projects load"
desc = "Load project"
[[mgr.prepend_keymap]]
on = [ "P", "P" ]
run = "plugin projects load_last"
desc = "Load last project"
[[mgr.prepend_keymap]]
on = [ "P", "d" ]
run = "plugin projects delete"
desc = "Delete project"
[[mgr.prepend_keymap]]
on = [ "P", "D" ]
run = "plugin projects delete_all"
desc = "Delete all projects"
[[mgr.prepend_keymap]]
on = [ "P", "m" ]
run = "plugin projects 'merge current'"
desc = "Merge current tab to other projects"
[[mgr.prepend_keymap]]
on = [ "P", "M" ]
run = "plugin projects 'merge all'"
desc = "Merge current project to other projects"
```
### Load project by name or key
If you want to load a specific project with a keybinding (you can use either the key or the name of the project):
```toml
[[mgr.prepend_keymap]]
on = [ "P", "p" ]
run = "plugin projects 'load SomeProject'"
desc = "Load the 'SomeProject' project"
```
You can also load a specific project by using the below Bash/Zsh function (uses the "official" [shell wrapper](https://yazi-rs.github.io/docs/quick-start/#shell-wrapper), but you can also replace `y` with `yazi`):
```bash
function yap() {
local yaziProject="$1"
shift
if [ -z "$yaziProject" ]; then
>&2 echo "ERROR: The first argument must be a project"
return 64
fi
# Generate random Yazi client ID (DDS / `ya emit` uses `YAZI_ID`)
local yaziId=$RANDOM
# Use Yazi's DDS to run a plugin command after Yazi has started
# (the nested subshell is only to suppress "Done" output for the job)
( (sleep 0.1; YAZI_ID=$yaziId ya emit plugin projects "load $yaziProject") &)
# Run Yazi with the generated client ID
y --client-id $yaziId "$@" || return $?
}
```
With the above function you can open a specific project by running e.g. `yap SomeProject`
## Config
Don't forget to add the plugin's `setup` function in Yazi's `init.lua`, i.e. `~/.config/yazi/init.lua`.
The following are the default configurations:
```lua
require("projects"):setup({
event = {
save = {
enable = true,
name = "project-saved",
},
load = {
enable = true,
name = "project-loaded",
},
delete = {
enable = true,
name = "project-deleted",
},
delete_all = {
enable = true,
name = "project-deleted-all",
},
merge = {
enable = true,
name = "project-merged",
},
},
save = {
method = "yazi", -- yazi | lua
yazi_load_event = "@projects-load", -- event name when loading projects in `yazi` method
lua_save_path = "", -- path of saved file in `lua` method, comment out or assign explicitly
-- default value:
-- windows: "%APPDATA%/yazi/state/projects.json"
-- unix: "~/.local/state/yazi/projects.json"
},
last = {
update_after_save = true,
update_after_load = true,
update_before_quit = false,
load_after_start = false,
},
merge = {
event = "projects-merge",
quit_after_merge = false,
},
notify = {
enable = true,
title = "Projects",
timeout = 3,
level = "info",
},
})
```
> [!NOTE]
> Settings that are not set will use the default value.
### `event`
The corresponding event will be sent when the corresponding function is executed.
For specific usage, please refer to [#5](https://github.com/MasouShizuka/projects.yazi/issues/5) and [#12](https://github.com/MasouShizuka/projects.yazi/issues/12).
### `save`
> [!NOTE]
> Yazi's api sometimes doesn't work on Windows, which is why the `lua` method is proposed
`method`: the method of saving projects:
- `yazi`: using `yazi` api to save to `.dds` file
- `lua`: using `lua` api to save
`yazi_load_event`: event name when loading projects in `yazi` method
`lua_save_path`: path of saved file in `lua` method, the defalut value is
- `Windows`: `%APPDATA%/yazi/state/projects.json`
- `Unix`: `~/.local/state/yazi/projects.json`
### `last`
The last project is loaded by `load_last` command.
`update_after_save`: the saved project will be saved to last project.
`update_after_load`: the loaded project will be saved to last project.
`update_before_quit`: the current project will be saved to last project before quit.
`load_after_start`: the last project will be loaded after starting.
- Only work with `lua` method, please refer to [#2](https://github.com/MasouShizuka/projects.yazi/issues/2)
### `merge`
`event`: the name of event used by merge feature.
`quit_after_merge`: the merged project will be exited after merging.
### `notify`
When enabled, notifications are displayed when actions are performed.
`title`, `timeout`, `level` are the same as [ya.notify](https://yazi-rs.github.io/docs/plugins/utils/#ya.notify).
@@ -0,0 +1,386 @@
--
-- json.lua
--
-- Copyright (c) 2020 rxi
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy of
-- this software and associated documentation files (the "Software"), to deal in
-- the Software without restriction, including without limitation the rights to
-- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-- of the Software, and to permit persons to whom the Software is furnished to do
-- so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--
local json = { _version = "0.1.2" }
-------------------------------------------------------------------------------
-- Encode
-------------------------------------------------------------------------------
local encode
local escape_char_map = {
["\\"] = "\\",
["\""] = "\"",
["\b"] = "b",
["\f"] = "f",
["\n"] = "n",
["\r"] = "r",
["\t"] = "t",
}
local escape_char_map_inv = { ["/"] = "/" }
for k, v in pairs(escape_char_map) do
escape_char_map_inv[v] = k
end
local function escape_char(c)
return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte()))
end
local function encode_nil(val)
return "null"
end
local function encode_table(val, stack)
local res = {}
stack = stack or {}
-- Circular reference?
if stack[val] then error("circular reference") end
stack[val] = true
if rawget(val, 1) ~= nil or next(val) == nil then
-- Treat as array -- check keys are valid and it is not sparse
local n = 0
for k in pairs(val) do
if type(k) ~= "number" then
error("invalid table: mixed or invalid key types")
end
n = n + 1
end
if n ~= #val then
error("invalid table: sparse array")
end
-- Encode
for i, v in ipairs(val) do
table.insert(res, encode(v, stack))
end
stack[val] = nil
return "[" .. table.concat(res, ",") .. "]"
else
-- Treat as an object
for k, v in pairs(val) do
if type(k) ~= "string" then
error("invalid table: mixed or invalid key types")
end
table.insert(res, encode(k, stack) .. ":" .. encode(v, stack))
end
stack[val] = nil
return "{" .. table.concat(res, ",") .. "}"
end
end
local function encode_string(val)
return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"'
end
local function encode_number(val)
-- Check for NaN, -inf and inf
if val ~= val or val <= -math.huge or val >= math.huge then
error("unexpected number value '" .. tostring(val) .. "'")
end
return string.format("%.14g", val)
end
local type_func_map = {
["nil"] = encode_nil,
["table"] = encode_table,
["string"] = encode_string,
["number"] = encode_number,
["boolean"] = tostring,
}
encode = function(val, stack)
local t = type(val)
local f = type_func_map[t]
if f then
return f(val, stack)
end
error("unexpected type '" .. t .. "'")
end
function json.encode(val)
return (encode(val))
end
-------------------------------------------------------------------------------
-- Decode
-------------------------------------------------------------------------------
local parse
local function create_set(...)
local res = {}
for i = 1, select("#", ...) do
res[select(i, ...)] = true
end
return res
end
local space_chars = create_set(" ", "\t", "\r", "\n")
local delim_chars = create_set(" ", "\t", "\r", "\n", "]", "}", ",")
local escape_chars = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u")
local literals = create_set("true", "false", "null")
local literal_map = {
["true"] = true,
["false"] = false,
["null"] = nil,
}
local function next_char(str, idx, set, negate)
for i = idx, #str do
if set[str:sub(i, i)] ~= negate then
return i
end
end
return #str + 1
end
local function decode_error(str, idx, msg)
local line_count = 1
local col_count = 1
for i = 1, idx - 1 do
col_count = col_count + 1
if str:sub(i, i) == "\n" then
line_count = line_count + 1
col_count = 1
end
end
error(string.format("%s at line %d col %d", msg, line_count, col_count))
end
local function codepoint_to_utf8(n)
-- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa
local f = math.floor
if n <= 0x7f then
return string.char(n)
elseif n <= 0x7ff then
return string.char(f(n / 64) + 192, n % 64 + 128)
elseif n <= 0xffff then
return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128)
elseif n <= 0x10ffff then
return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128,
f(n % 4096 / 64) + 128, n % 64 + 128)
end
error(string.format("invalid unicode codepoint '%x'", n))
end
local function parse_unicode_escape(s)
local n1 = tonumber(s:sub(1, 4), 16)
local n2 = tonumber(s:sub(7, 10), 16)
-- Surrogate pair?
if n2 then
return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000)
else
return codepoint_to_utf8(n1)
end
end
local function parse_string(str, i)
local res = ""
local j = i + 1
local k = j
while j <= #str do
local x = str:byte(j)
if x < 32 then
decode_error(str, j, "control character in string")
elseif x == 92 then -- `\`: Escape
res = res .. str:sub(k, j - 1)
j = j + 1
local c = str:sub(j, j)
if c == "u" then
local hex = str:match("^[dD][89aAbB]%x%x\\u%x%x%x%x", j + 1)
or str:match("^%x%x%x%x", j + 1)
or decode_error(str, j - 1, "invalid unicode escape in string")
res = res .. parse_unicode_escape(hex)
j = j + #hex
else
if not escape_chars[c] then
decode_error(str, j - 1, "invalid escape char '" .. c .. "' in string")
end
res = res .. escape_char_map_inv[c]
end
k = j + 1
elseif x == 34 then -- `"`: End of string
res = res .. str:sub(k, j - 1)
return res, j + 1
end
j = j + 1
end
decode_error(str, i, "expected closing quote for string")
end
local function parse_number(str, i)
local x = next_char(str, i, delim_chars)
local s = str:sub(i, x - 1)
local n = tonumber(s)
if not n then
decode_error(str, i, "invalid number '" .. s .. "'")
end
return n, x
end
local function parse_literal(str, i)
local x = next_char(str, i, delim_chars)
local word = str:sub(i, x - 1)
if not literals[word] then
decode_error(str, i, "invalid literal '" .. word .. "'")
end
return literal_map[word], x
end
local function parse_array(str, i)
local res = {}
local n = 1
i = i + 1
while 1 do
local x
i = next_char(str, i, space_chars, true)
-- Empty / end of array?
if str:sub(i, i) == "]" then
i = i + 1
break
end
-- Read token
x, i = parse(str, i)
res[n] = x
n = n + 1
-- Next token
i = next_char(str, i, space_chars, true)
local chr = str:sub(i, i)
i = i + 1
if chr == "]" then break end
if chr ~= "," then decode_error(str, i, "expected ']' or ','") end
end
return res, i
end
local function parse_object(str, i)
local res = {}
i = i + 1
while 1 do
local key, val
i = next_char(str, i, space_chars, true)
-- Empty / end of object?
if str:sub(i, i) == "}" then
i = i + 1
break
end
-- Read key
if str:sub(i, i) ~= '"' then
decode_error(str, i, "expected string for key")
end
key, i = parse(str, i)
-- Read ':' delimiter
i = next_char(str, i, space_chars, true)
if str:sub(i, i) ~= ":" then
decode_error(str, i, "expected ':' after key")
end
i = next_char(str, i + 1, space_chars, true)
-- Read value
val, i = parse(str, i)
-- Set
res[key] = val
-- Next token
i = next_char(str, i, space_chars, true)
local chr = str:sub(i, i)
i = i + 1
if chr == "}" then break end
if chr ~= "," then decode_error(str, i, "expected '}' or ','") end
end
return res, i
end
local char_func_map = {
['"'] = parse_string,
["0"] = parse_number,
["1"] = parse_number,
["2"] = parse_number,
["3"] = parse_number,
["4"] = parse_number,
["5"] = parse_number,
["6"] = parse_number,
["7"] = parse_number,
["8"] = parse_number,
["9"] = parse_number,
["-"] = parse_number,
["t"] = parse_literal,
["f"] = parse_literal,
["n"] = parse_literal,
["["] = parse_array,
["{"] = parse_object,
}
parse = function(str, idx)
local chr = str:sub(idx, idx)
local f = char_func_map[chr]
if f then
return f(str, idx)
end
decode_error(str, idx, "unexpected character '" .. chr .. "'")
end
function json.decode(str)
if type(str) ~= "string" then
error("expected argument of type string, got " .. type(str))
end
local res, idx = parse(str, next_char(str, 1, space_chars, true))
idx = next_char(str, idx, space_chars, true)
if idx <= #str then
decode_error(str, idx, "trailing garbage")
end
return res
end
return {
encode = json.encode,
decode = json.decode,
}
@@ -0,0 +1,652 @@
local SUPPORTED_KEYS_MAP = {
["0"] = 1,
["1"] = 2,
["2"] = 3,
["3"] = 4,
["4"] = 5,
["5"] = 6,
["6"] = 7,
["7"] = 8,
["8"] = 9,
["9"] = 10,
["A"] = 11,
["B"] = 12,
["C"] = 13,
["D"] = 14,
["E"] = 15,
["F"] = 16,
["G"] = 17,
["H"] = 18,
["I"] = 19,
["J"] = 20,
["K"] = 21,
["L"] = 22,
["M"] = 23,
["N"] = 24,
["O"] = 25,
["P"] = 26,
["Q"] = 27,
["R"] = 28,
["S"] = 29,
["T"] = 30,
["U"] = 31,
["V"] = 32,
["W"] = 33,
["X"] = 34,
["Y"] = 35,
["Z"] = 36,
["a"] = 37,
["b"] = 38,
["c"] = 39,
["d"] = 40,
["e"] = 41,
["f"] = 42,
["g"] = 43,
["h"] = 44,
["i"] = 45,
["j"] = 46,
["k"] = 47,
["l"] = 48,
["m"] = 49,
["n"] = 50,
["o"] = 51,
["p"] = 52,
["q"] = 53,
["r"] = 54,
["s"] = 55,
["t"] = 56,
["u"] = 57,
["v"] = 58,
["w"] = 59,
["x"] = 60,
["y"] = 61,
["z"] = 62,
}
local SUPPORTED_KEYS = {
{ on = "0" },
{ on = "1" },
{ on = "2" },
{ on = "3" },
{ on = "4" },
{ on = "5" },
{ on = "6" },
{ on = "7" },
{ on = "8" },
{ on = "9" },
{ on = "A" },
{ on = "B" },
{ on = "C" },
{ on = "D" },
{ on = "E" },
{ on = "F" },
{ on = "G" },
{ on = "H" },
{ on = "I" },
{ on = "J" },
{ on = "K" },
{ on = "L" },
{ on = "M" },
{ on = "N" },
{ on = "O" },
{ on = "P" },
{ on = "Q" },
{ on = "R" },
{ on = "S" },
{ on = "T" },
{ on = "U" },
{ on = "V" },
{ on = "W" },
{ on = "X" },
{ on = "Y" },
{ on = "Z" },
{ on = "a" },
{ on = "b" },
{ on = "c" },
{ on = "d" },
{ on = "e" },
{ on = "f" },
{ on = "g" },
{ on = "h" },
{ on = "i" },
{ on = "j" },
{ on = "k" },
{ on = "l" },
{ on = "m" },
{ on = "n" },
{ on = "o" },
{ on = "p" },
{ on = "q" },
{ on = "r" },
{ on = "s" },
{ on = "t" },
{ on = "u" },
{ on = "v" },
{ on = "w" },
{ on = "x" },
{ on = "y" },
{ on = "z" },
}
local _notify = ya.sync(function(state, message)
ya.notify({
title = state.notify.title,
content = message,
timeout = state.notify.timeout,
level = state.notify.level,
})
end)
local _get_default_projects = ya.sync(function(state)
return {
list = {},
last = nil,
}
end)
local _get_projects = ya.sync(function(state)
return not state.projects and _get_default_projects() or state.projects
end)
local _get_real_idx = ya.sync(function(state, idx)
for real_idx, value in ipairs(_get_projects().list) do
if value.on == SUPPORTED_KEYS[idx].on then
return real_idx
end
end
return nil
end)
local _get_current_project = ya.sync(function(state)
local tabs = cx.tabs
-- TODO: add more tab properties
local project = {
active_idx = tonumber(tabs.idx),
tabs = {},
}
for index, tab in ipairs(tabs) do
project.tabs[#project.tabs + 1] = {
idx = index,
cwd = tostring(tab.current.cwd):gsub("\\", "/"),
}
end
return project
end)
local _save_projects = ya.sync(function(state, projects)
state.projects = projects
if state.save.method == "yazi" then
ps.pub_to(0, state.save.yazi_load_event, projects)
elseif state.save.method == "lua" then
local f = io.open(state.save.lua_save_path, "w")
if not f then
return
end
f:write(state.json.encode(projects))
io.close(f)
end
end)
local save_project = ya.sync(function(state, idx, desc)
local projects = _get_projects()
local real_idx = _get_real_idx(idx)
if not real_idx then
real_idx = #projects.list + 1
end
local project = _get_current_project()
projects.list[real_idx] = {
on = SUPPORTED_KEYS[idx].on,
desc = desc,
project = project,
}
if state.last.update_after_save then
projects.last = project
end
_save_projects(projects)
if state.event.save.enable then
ps.pub_to(0, state.event.save.name, project)
end
if state.notify.enable then
local message = string.format("Project saved to %s", state.projects.list[real_idx].on)
_notify(message)
end
end)
local load_project = ya.sync(function(state, project, desc)
-- TODO: add more tab properties to restore
-- when cx is nil, it is called in setup
if cx then
for _ = 1, #cx.tabs - 1 do
ya.emit("tab_close", { 0 })
end
end
local sorted_tabs = {}
for _, tab in pairs(project.tabs) do
sorted_tabs[tonumber(tab.idx)] = tab
end
for _, tab in pairs(sorted_tabs) do
ya.emit("tab_create", { tab.cwd })
end
ya.emit("tab_close", { 0 })
ya.emit("tab_switch", { project.active_idx - 1 })
if state.last.update_after_load then
local projects = _get_projects()
projects.last = project
_save_projects(projects)
end
if state.event.load.enable then
ps.pub_to(0, state.event.load.name, project)
end
if state.notify.enable then
local message
if desc then
message = string.format([["%s" loaded]], desc)
else
message = string.format([[Last project loaded]], desc)
end
_notify(message)
end
end)
local _load_projects = ya.sync(function(state)
if state.save.method == "yazi" then
ps.sub_remote(state.save.yazi_load_event, function(body)
state.projects = body
end)
elseif state.save.method == "lua" then
local f = io.open(state.save.lua_save_path, "r")
if f then
state.projects = state.json.decode(f:read("*a"))
io.close(f)
end
end
if not state.projects then
state.projects = _get_default_projects()
end
if state.last.load_after_start then
local last_project = _get_projects().last
if last_project then
load_project(last_project)
end
end
end)
local delete_all_projects = ya.sync(function(state)
_save_projects(_get_default_projects())
local msg = "All projects deleted"
if state.event.delete_all.enable then
ps.pub_to(0, state.event.delete_all.name, msg)
end
if state.notify.enable then
_notify(msg)
end
end)
local delete_project = ya.sync(function(state, idx)
local projects = _get_projects()
local message = string.format([["%s" deleted]], tostring(projects.list[idx].desc))
local deleted_project = projects.list[idx]
table.remove(projects.list, idx)
_save_projects(projects)
if state.event.delete.enable then
ps.pub_to(0, state.event.delete.name, deleted_project)
end
if state.notify.enable then
_notify(message)
end
end)
local merge_project = ya.sync(function(state, opt)
local project = _get_current_project()
project.opt = opt or "all"
ps.pub_to(0, state.merge.event, project)
if state.event.merge.enable then
ps.pub_to(0, state.event.merge.name, project)
end
if state.merge.quit_after_merge then
ya.emit("quit", {})
end
end)
local _merge_tab = ya.sync(function(state, tab)
ya.emit("tab_create", { tab.cwd })
end)
local _merge_event = ya.sync(function(state)
ps.sub_remote(state.merge.event, function(body)
if body then
local active_idx = tonumber(cx.tabs.idx)
local opt = body.opt
if opt == "all" then
local sorted_tabs = {}
for _, tab in pairs(body.tabs) do
sorted_tabs[tonumber(tab.idx)] = tab
end
for _, tab in ipairs(sorted_tabs) do
_merge_tab(tab)
end
if state.notify.enable then
local message = "A project is merged"
_notify(message)
end
elseif opt == "current" then
local tab = body.tabs[tonumber(body.active_idx)]
_merge_tab(tab)
if state.notify.enable then
local message = "A tab is merged"
_notify(message)
end
end
ya.emit("tab_switch", { active_idx - 1 })
end
end)
end)
local _find_project_index = ya.sync(function(state, list, search_term)
if not search_term then
return nil
end
for i, project in ipairs(list) do
-- Match the project by the "on" key or by "desc"
if project.on == search_term or project.desc == search_term then
return i
end
end
return nil
end)
local _load_config = ya.sync(function(state, opts)
state.event = {
save = {
enable = true,
name = "project-saved",
},
load = {
enable = true,
name = "project-loaded",
},
delete = {
enable = true,
name = "project-deleted",
},
delete_all = {
enable = true,
name = "project-deleted-all",
},
merge = {
enable = true,
name = "project-merged",
},
}
if type(opts.event) == "table" then
if type(opts.event.save) == "table" then
if type(opts.event.save.enable) == "boolean" then
state.event.save.enable = opts.event.save.enable
end
if type(opts.event.save.name) == "string" then
state.event.save.name = opts.event.save.name
end
elseif type(opts.event.save) == "boolean" then
state.event.save.enable = opts.event.save
end
if type(opts.event.load) == "table" then
if type(opts.event.load.enable) == "boolean" then
state.event.load.enable = opts.event.load.enable
end
if type(opts.event.load.name) == "string" then
state.event.load.name = opts.event.load.name
end
elseif type(opts.event.load) == "boolean" then
state.event.load.enable = opts.event.load
end
if type(opts.event.delete) == "table" then
if type(opts.event.delete.enable) == "boolean" then
state.event.delete.enable = opts.event.delete.enable
end
if type(opts.event.delete.name) == "string" then
state.event.delete.name = opts.event.delete.name
end
elseif type(opts.event.delete) == "boolean" then
state.event.delete.enable = opts.event.delete
end
if type(opts.event.delete_all) == "table" then
if type(opts.event.delete_all.enable) == "boolean" then
state.event.delete_all.enable = opts.event.delete_all.enable
end
if type(opts.event.delete_all.name) == "string" then
state.event.delete_all.name = opts.event.delete_all.name
end
elseif type(opts.event.delete_all) == "boolean" then
state.event.delete_all.enable = opts.event.delete_all
end
if type(opts.event.merge) == "table" then
if type(opts.event.merge.enable) == "boolean" then
state.event.merge.enable = opts.event.merge.enable
end
if type(opts.event.merge.name) == "string" then
state.event.merge.name = opts.event.merge.name
end
elseif type(opts.event.merge) == "boolean" then
state.event.merge.enable = opts.event.merge
end
end
state.save = {
method = "yazi",
yazi_load_event = "@projects-load",
lua_save_path = "",
}
if type(opts.save) == "table" then
if type(opts.save.method) == "string" then
state.save.method = opts.save.method
end
if type(opts.save.yazi_load_event) == "string" then
state.save.yazi_load_event = opts.save.yazi_load_event
end
if type(opts.save.lua_save_path) == "string" then
state.save.lua_save_path = opts.save.lua_save_path
else
local lua_save_path
local appdata = os.getenv("APPDATA")
if appdata then
lua_save_path = appdata:gsub("\\", "/") .. "/yazi/state/projects.json"
else
lua_save_path = os.getenv("HOME") .. "/.local/state/yazi/projects.json"
end
state.save.lua_save_path = lua_save_path
end
end
state.last = {
update_after_save = true,
update_after_load = true,
update_before_quit = false,
load_after_start = false,
}
if type(opts.last) == "table" then
if type(opts.last.update_after_save) == "boolean" then
state.last.update_after_save = opts.last.update_after_save
end
if type(opts.last.update_after_load) == "boolean" then
state.last.update_after_load = opts.last.update_after_load
end
if type(opts.last.update_before_quit) == "boolean" then
state.last.update_before_quit = opts.last.update_before_quit
end
if type(opts.last.load_after_start) == "boolean" then
state.last.load_after_start = opts.last.load_after_start
end
end
if state.last.update_before_quit then
ps.sub("key-quit", function(body)
local projects = _get_projects()
local current_project = _get_current_project()
projects.last = current_project
_save_projects(projects)
if state.event.save.enable then
ps.pub_to(0, state.event.save.name, current_project)
end
ya.emit("quit", {})
return true
end)
end
state.merge = {
event = "projects-merge",
quit_after_merge = false,
}
if type(opts.merge) == "table" then
if type(opts.merge.event) == "string" then
state.merge.event = opts.merge.event
end
if type(opts.merge.quit_after_merge) == "boolean" then
state.merge.quit_after_merge = opts.merge.quit_after_merge
end
end
state.notify = {
enable = true,
title = "Projects",
timeout = 3,
level = "info",
}
if type(opts.notify) == "table" then
if type(opts.notify.enable) == "boolean" then
state.notify.enable = opts.notify.enable
end
if type(opts.notify.title) == "string" then
state.notify.title = opts.notify.title
end
if type(opts.notify.timeout) == "number" then
state.notify.timeout = opts.notify.timeout
end
if type(opts.notify.level) == "string" then
state.notify.level = opts.notify.level
end
end
end)
return {
setup = function(state, opts)
state.json = require(".json")
_load_config(opts)
_load_projects()
_merge_event()
end,
entry = function(_, job)
local action = job.args[1]
if not action then
return
end
if action == "delete_all" then
delete_all_projects()
return
end
if action == "merge" then
local opt = job.args[2]
merge_project(opt)
return
end
local projects = _get_projects()
if action == "load_last" then
local last_project = projects.last
if last_project then
load_project(last_project)
end
return
end
local list = projects.list
if action == "save" then
-- load the desc of saved projects
for _, value in pairs(list) do
local idx = SUPPORTED_KEYS_MAP[value.on]
if idx then
SUPPORTED_KEYS[idx].desc = value.desc
end
end
local idx = ya.which({ cands = SUPPORTED_KEYS, silent = false })
if not idx then
return
end
-- if target is not empty, use the saved desc as default desc
local default_desc = SUPPORTED_KEYS[idx].desc or string.format("Project %s", SUPPORTED_KEYS[idx].on)
local value, event = ya.input({
pos = { "center", w = 40 },
title = "Project name:",
value = default_desc,
})
if event ~= 1 then
return
end
local desc
if value ~= "" then
desc = value
else
desc = default_desc
end
save_project(idx, desc)
return
end
-- Search for the project, if an argument was given
-- Or ask interactively
local selected_idx = _find_project_index(list, job.args[2]) or ya.which({ cands = list, silent = false })
if not selected_idx then
return
end
if action == "load" then
local selected = list[selected_idx]
load_project(selected.project, selected.desc)
elseif action == "delete" then
delete_project(selected_idx)
end
end,
}