diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua index bfdc6fc..2514b1b 100644 --- a/.config/nvim/lua/config/lazy.lua +++ b/.config/nvim/lua/config/lazy.lua @@ -90,281 +90,3 @@ require('lualine').setup { inactive_winbar = {}, extensions = {} } --- mini.icons -require('mini.icons').setup() --- plenary -local async = require "plenary.async" --- yazi -require("yazi.commands").create_yazi_commands() ----@module "plenary" - -local configModule = require("yazi.config") - -local M = {} - -M.version = "11.5.1" -- x-release-please-version - --- The last known state of yazi when it was closed ----@type YaziPreviousState -M.previous_state = {} - -M.active_contexts = vim.ringbuf(2) - ----@alias yazi.Arguments {reveal_path: string} - ----@param config? YaziConfig | {} ----@param input_path? string ----@param args? yazi.Arguments -function M.yazi(config, input_path, args) - local utils = require("yazi.utils") - local YaziProcess = require("yazi.process.yazi_process") - local yazi_event_handling = require("yazi.event_handling.yazi_event_handling") - - if utils.is_yazi_available() ~= true then - print( - "Please install yazi and make sure it is on your `vim.env.PATH`. Check the documentation for more information" - ) - return - end - - config = - vim.tbl_deep_extend("force", configModule.default(), M.config, config or {}) - - local Log = require("yazi.log") - Log.level = config.log_level - - if utils.is_ya_available() ~= true then - print( - "Please install ya (the yazi command line utility) and make sure it is on your `vim.env.PATH`. Check the documentation for more information" - ) - return - end - - local paths = utils.selected_file_paths(input_path) - local path = paths[1] - - local prev_win = vim.api.nvim_get_current_win() - - config.chosen_file_path = config.chosen_file_path or vim.fn.tempname() - - local win = require("yazi.window").YaziFloatingWindow.new(config) - win:open_and_display() - local yazi_buffer = win.content_buffer - - local yazi_process, yazi_context = YaziProcess:start(config, paths, { - on_ya_first_event = function(api) - config.hooks.on_yazi_ready(yazi_buffer, config, api) - do - if not (args and args.reveal_path) then - Log:debug("No reveal_path provided, skipping initial reveal") - return - end - - local retries = 15 - require("yazi.process.retry").retry({ - delay = 50, - retries = retries, - action = function(retries_remaining) - local reveal_job = api:reveal(args.reveal_path) - local completed = reveal_job:wait(500) - assert( - completed.code == 0, - string.format( - "Failed to reveal path '%s' with exit code: %s, details: %s", - args.reveal_path, - completed.code, - vim.inspect({ - stdout = completed.stdout, - stderr = completed.stderr, - }) - ) - ) - Log:debug( - string.format( - "Revealed path '%s' successfully after retries_remaining: %s", - args.reveal_path, - retries_remaining - ) - ) - return nil - end, - on_failure = function(_, retries_remaining) - Log:debug( - string.format( - "Failed to reveal path '%s', retrying after 50ms. retries_remaining: %s", - args.reveal_path, - retries_remaining - ) - ) - end, - on_final_failure = function(result) - Log:debug( - string.format( - "Failed to reveal path '%s' after %s retries. Details: %s", - args.reveal_path, - retries, - vim.inspect(result) - ) - ) - end, - }) - end - end, - on_exit = function( - exit_code, - selected_files, - events, - hovered_url, - last_directory, - context - ) - if exit_code ~= 0 then - print( - "yazi.nvim: had trouble opening yazi. Run ':checkhealth yazi' for more information." - ) - Log:debug( - string.format("yazi.nvim: had trouble opening yazi: %s", exit_code) - ) - return - end - - Log:debug( - string.format( - "yazi process exited successfully with code: %s, selected_files %s, and events %s", - exit_code, - vim.inspect(selected_files), - vim.inspect(events) - ) - ) - - -- this is the legacy implementation used when - -- `future_features.process_events_live = false`. When that is used, - -- events should be processed in ya_process.lua and should not be - -- processed a second time here. - assert(#events == 0 or not config.future_features.process_events_live) - - yazi_event_handling.process_events_emitted_from_yazi( - events, - config, - context - ) - - if last_directory == nil then - if path:is_file() then - last_directory = path:parent() - else - last_directory = path - end - Log:debug( - string.format( - "No last_directory provided, presuming the last directory is %s based on the path %s", - last_directory, - path.filename - ) - ) - end - - Log:debug( - string.format("Resolved the last_directory to %s", last_directory) - ) - - utils.on_yazi_exited(prev_win, win, config, selected_files, { - last_directory = last_directory, - }) - - if hovered_url then - -- currently we can't reliably get the hovered_url from ya due to - -- https://github.com/sxyazi/yazi/issues/1314 so let's try to at least - -- not corrupt the last working hovered state - M.previous_state.last_hovered = hovered_url - Log:debug( - string.format( - "Setting the last hovered state to %s", - vim.inspect(M.previous_state.last_hovered) - ) - ) - else - Log:debug( - "No hovered_url provided, presuming the last hovered file is the initial file" - ) - M.previous_state.last_hovered = path.filename - end - end, - }) - - M.active_contexts:push(yazi_context) - - config.hooks.yazi_opened(path.filename, win.content_buffer, config) - - if config.set_keymappings_function ~= nil then - config.set_keymappings_function(yazi_buffer, config, yazi_context) - end - - if config.keymaps ~= false then - require("yazi.config").set_keymappings(yazi_buffer, config, yazi_context) - end - - win.on_resized = function(event) - vim.fn.jobresize( - yazi_process.yazi_job_id, - event.win_width, - event.win_height - ) - end - - vim.schedule(function() - vim.cmd("startinsert") - end) -end - --- Open yazi, continuing from the previously hovered file. If no previous file --- was hovered, open yazi with the default path. ----@param config? YaziConfig | {} -function M.toggle(config) - local path = M.previous_state and M.previous_state.last_hovered or nil - - local Log = require("yazi.log") - if path == nil then - Log:debug("No previous file hovered, opening yazi with default path") - else - Log:debug( - string.format("Opening yazi with previous file hovered: %s", path) - ) - end - if path then - M.yazi(config, path, { reveal_path = path }) - else - M.yazi(config, path) - end -end - -M.config = configModule.default() - ----@param opts YaziConfig | {} -function M.setup(opts) - M.config = - vim.tbl_deep_extend("force", configModule.default(), M.config, opts or {}) - - local Log = require("yazi.log") - Log.level = M.config.log_level - - pcall(function() - require("yazi.lsp.embedded-lsp-file-operations.lsp-file-operations").setup() - end) - - local yazi_augroup = vim.api.nvim_create_augroup("yazi", { clear = true }) - - if M.config.open_for_directories == true then - Log:debug("Hijacking netrw to open yazi for directories") - require("yazi.hijack_netrw").hijack_netrw(yazi_augroup) - end - - if - M.config.integrations.picker_add_copy_relative_path_action - == "snacks.picker" - then - require("yazi.integrations.snacks_relative_path").setup_copy_relative_path_picker_action() - end -end - -return M diff --git a/.config/nvim/lua/plugins/mini.icons.lua b/.config/nvim/lua/plugins/mini.icons.lua deleted file mode 100644 index 48230d0..0000000 --- a/.config/nvim/lua/plugins/mini.icons.lua +++ /dev/null @@ -1,8 +0,0 @@ --- mini.icons -return { -{ - "echasnovski/mini.icons", - version = "*", - lazy = false - } -} diff --git a/.config/nvim/lua/plugins/snacks.lua b/.config/nvim/lua/plugins/snacks.lua deleted file mode 100644 index 007a0e3..0000000 --- a/.config/nvim/lua/plugins/snacks.lua +++ /dev/null @@ -1,151 +0,0 @@ --- snacks -return { -{ - "folke/snacks.nvim", - priority = 1000, - lazy = false, - ---@type snacks.Config - opts = { - bigfile = { enabled = true }, - dashboard = { enabled = true }, - explorer = { enabled = true }, - indent = { enabled = true }, - input = { enabled = true }, - notifier = { - enabled = true, - timeout = 3000, - }, - picker = { enabled = true }, - quickfile = { enabled = true }, - scope = { enabled = true }, - scroll = { enabled = true }, - statuscolumn = { enabled = true }, - words = { enabled = true }, - styles = { - notification = { - -- wo = { wrap = true } -- Wrap notifications - } - } - }, - keys = { - -- Top Pickers & Explorer - { "", function() Snacks.picker.smart() end, desc = "Smart Find Files" }, - { ",", function() Snacks.picker.buffers() end, desc = "Buffers" }, - { "/", function() Snacks.picker.grep() end, desc = "Grep" }, - { ":", function() Snacks.picker.command_history() end, desc = "Command History" }, - { "n", function() Snacks.picker.notifications() end, desc = "Notification History" }, - { "e", function() Snacks.explorer() end, desc = "File Explorer" }, - -- find - { "fb", function() Snacks.picker.buffers() end, desc = "Buffers" }, - { "fc", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, desc = "Find Config File" }, - { "ff", function() Snacks.picker.files() end, desc = "Find Files" }, - { "fg", function() Snacks.picker.git_files() end, desc = "Find Git Files" }, - { "fp", function() Snacks.picker.projects() end, desc = "Projects" }, - { "fr", function() Snacks.picker.recent() end, desc = "Recent" }, - -- git - { "gb", function() Snacks.picker.git_branches() end, desc = "Git Branches" }, - { "gl", function() Snacks.picker.git_log() end, desc = "Git Log" }, - { "gL", function() Snacks.picker.git_log_line() end, desc = "Git Log Line" }, - { "gs", function() Snacks.picker.git_status() end, desc = "Git Status" }, - { "gS", function() Snacks.picker.git_stash() end, desc = "Git Stash" }, - { "gd", function() Snacks.picker.git_diff() end, desc = "Git Diff (Hunks)" }, - { "gf", function() Snacks.picker.git_log_file() end, desc = "Git Log File" }, - -- Grep - { "sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" }, - { "sB", function() Snacks.picker.grep_buffers() end, desc = "Grep Open Buffers" }, - { "sg", function() Snacks.picker.grep() end, desc = "Grep" }, - { "sw", function() Snacks.picker.grep_word() end, desc = "Visual selection or word", mode = { "n", "x" } }, - -- search - { 's"', function() Snacks.picker.registers() end, desc = "Registers" }, - { 's/', function() Snacks.picker.search_history() end, desc = "Search History" }, - { "sa", function() Snacks.picker.autocmds() end, desc = "Autocmds" }, - { "sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" }, - { "sc", function() Snacks.picker.command_history() end, desc = "Command History" }, - { "sC", function() Snacks.picker.commands() end, desc = "Commands" }, - { "sd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" }, - { "sD", function() Snacks.picker.diagnostics_buffer() end, desc = "Buffer Diagnostics" }, - { "sh", function() Snacks.picker.help() end, desc = "Help Pages" }, - { "sH", function() Snacks.picker.highlights() end, desc = "Highlights" }, - { "si", function() Snacks.picker.icons() end, desc = "Icons" }, - { "sj", function() Snacks.picker.jumps() end, desc = "Jumps" }, - { "sk", function() Snacks.picker.keymaps() end, desc = "Keymaps" }, - { "sl", function() Snacks.picker.loclist() end, desc = "Location List" }, - { "sm", function() Snacks.picker.marks() end, desc = "Marks" }, - { "sM", function() Snacks.picker.man() end, desc = "Man Pages" }, - { "sp", function() Snacks.picker.lazy() end, desc = "Search for Plugin Spec" }, - { "sq", function() Snacks.picker.qflist() end, desc = "Quickfix List" }, - { "sR", function() Snacks.picker.resume() end, desc = "Resume" }, - { "su", function() Snacks.picker.undo() end, desc = "Undo History" }, - { "uC", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" }, - -- LSP - { "gd", function() Snacks.picker.lsp_definitions() end, desc = "Goto Definition" }, - { "gD", function() Snacks.picker.lsp_declarations() end, desc = "Goto Declaration" }, - { "gr", function() Snacks.picker.lsp_references() end, nowait = true, desc = "References" }, - { "gI", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation" }, - { "gy", function() Snacks.picker.lsp_type_definitions() end, desc = "Goto T[y]pe Definition" }, - { "ss", function() Snacks.picker.lsp_symbols() end, desc = "LSP Symbols" }, - { "sS", function() Snacks.picker.lsp_workspace_symbols() end, desc = "LSP Workspace Symbols" }, - -- Other - { "z", function() Snacks.zen() end, desc = "Toggle Zen Mode" }, - { "Z", function() Snacks.zen.zoom() end, desc = "Toggle Zoom" }, - { ".", function() Snacks.scratch() end, desc = "Toggle Scratch Buffer" }, - { "S", function() Snacks.scratch.select() end, desc = "Select Scratch Buffer" }, - { "n", function() Snacks.notifier.show_history() end, desc = "Notification History" }, - { "bd", function() Snacks.bufdelete() end, desc = "Delete Buffer" }, - { "cR", function() Snacks.rename.rename_file() end, desc = "Rename File" }, - { "gB", function() Snacks.gitbrowse() end, desc = "Git Browse", mode = { "n", "v" } }, - { "gg", function() Snacks.lazygit() end, desc = "Lazygit" }, - { "un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" }, - { "", function() Snacks.terminal() end, desc = "Toggle Terminal" }, - { "", function() Snacks.terminal() end, desc = "which_key_ignore" }, - { "]]", function() Snacks.words.jump(vim.v.count1) end, desc = "Next Reference", mode = { "n", "t" } }, - { "[[", function() Snacks.words.jump(-vim.v.count1) end, desc = "Prev Reference", mode = { "n", "t" } }, - { - "N", - desc = "Neovim News", - function() - Snacks.win({ - file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1], - width = 0.6, - height = 0.6, - wo = { - spell = false, - wrap = false, - signcolumn = "yes", - statuscolumn = " ", - conceallevel = 3, - }, - }) - end, - } - }, - init = function() - vim.api.nvim_create_autocmd("User", { - pattern = "VeryLazy", - callback = function() - -- Setup some globals for debugging (lazy-loaded) - _G.dd = function(...) - Snacks.debug.inspect(...) - end - _G.bt = function() - Snacks.debug.backtrace() - end - vim.print = _G.dd -- Override print to use snacks for `:=` command - - -- Create some toggle mappings - Snacks.toggle.option("spell", { name = "Spelling" }):map("us") - Snacks.toggle.option("wrap", { name = "Wrap" }):map("uw") - Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("uL") - Snacks.toggle.diagnostics():map("ud") - Snacks.toggle.line_number():map("ul") - Snacks.toggle.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map("uc") - Snacks.toggle.treesitter():map("uT") - Snacks.toggle.option("background", { off = "light", on = "dark", name = "Dark Background" }):map("ub") - Snacks.toggle.inlay_hints():map("uh") - Snacks.toggle.indent():map("ug") - Snacks.toggle.dim():map("uD") - end, - }) - end, -}, -} diff --git a/.config/nvim/lua/plugins/yazi.lua b/.config/nvim/lua/plugins/yazi.lua deleted file mode 100644 index faf4f88..0000000 --- a/.config/nvim/lua/plugins/yazi.lua +++ /dev/null @@ -1,41 +0,0 @@ --- yazi --- This file is used to define the dependencies of this plugin when the user is --- using lazy.nvim. --- --- If you are curious about how exactly the plugins are used, you can use e.g. --- the search functionality on Github. --- ---https://lazy.folke.io/packages#lazy - ----@module "lazy" ----@module "yazi" - ----@type LazySpec -return { - -- Needed for file path resolution mainly - -- - -- https://github.com/nvim-lua/plenary.nvim/ - { "nvim-lua/plenary.nvim", lazy = true }, - -- { "folke/snacks.nvim", lazy = true }, - - -- - -- TODO enable after https://github.com/nvim-neorocks/nvim-busted-action/issues/4 is resolved - -- - -- { - -- -- Neovim plugin that adds support for file operations using built-in LSP - -- -- https://github.com/antosha417/nvim-lsp-file-operations - -- 'antosha417/nvim-lsp-file-operations', - -- lazy = true, - -- }, - - { - "mikavilpas/yazi.nvim", - ---@type YaziConfig | {} - opts = {}, - cmd = { - "Yazi", - "Yazi cwd", - "Yazi toggle", - }, - }, -} diff --git a/.config/yazi/flavors/dracula.yazi/flavor.toml b/.config/yazi/flavors/dracula.yazi/flavor.toml index 3dc0958..01ded4a 100644 --- a/.config/yazi/flavors/dracula.yazi/flavor.toml +++ b/.config/yazi/flavors/dracula.yazi/flavor.toml @@ -2,7 +2,7 @@ # : Manager {{{ -[mgr] +[manager] cwd = { fg = "#8be9fd" } # Hovered @@ -36,15 +36,6 @@ border_style = { fg = "#7282b5" } # : }}} -# : Tabs {{{ - -[tabs] -active = { fg = "#282a36", bg = "#bd93f9", bold = true } -inactive = { fg = "#bd93f9", bg = "#44475a" } - -# : }}} - - # : Mode {{{ [mode] diff --git a/.config/yazi/keymap.toml b/.config/yazi/keymap.toml index b59eebe..03a85ad 100644 --- a/.config/yazi/keymap.toml +++ b/.config/yazi/keymap.toml @@ -1,108 +1,108 @@ -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = [ "g", "c" ] run = "cd /home/peter/.config" desc = "Configs" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = "!" run = 'shell "$SHELL" --block' desc = "Open shell here" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = "T" run = "plugin toggle-pane min-preview" desc = "Show or hide the preview pane" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = [ "g", "d" ] run = "cd /home/peter/Downloads" desc = "Downloads" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = [ "g", "b" ] run = "cd /mnt/Backups" desc = "Backups" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = [ "g", "v" ] run = "cd /media/Games" desc = "Games" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = [ "g", "s" ] run = "cd /mnt/SSD" desc = "SSD" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = [ "g", "n" ] run = "cd /home/peter/Nextcloud" desc = "Nextcloud" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = [ "g", "r" ] run = "cd /run/media" desc = "Media" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = [ "g", "a" ] run = "cd /home/peter/Downloads/AUR" desc = "AUR" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = [ "g", "!" ] run = "cd ~/.bin/sh" desc = "Scripts" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = [ "g", "t" ] run = "cd ~/.local/share/Trash/files" desc = "Trash" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = [ "g", "y" ] run = "cd ~/Sync" desc = "Sync" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = [ "c", "m" ] run = "plugin chmod" desc = "Chmod on selected files" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = ["C"] run = "plugin ouch" desc = "Compress with ouch" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = "2" run = "plugin smart-switch 1" desc = "Switch or create tab 2" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = "3" run = "plugin smart-switch 2" desc = "Switch or create tab 3" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = "4" run = "plugin smart-switch 3" desc = "Switch or create tab 4" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = "5" run = "plugin smart-switch 4" desc = "Switch or create tab 5" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = "t" run = "plugin smart-tab" desc = "Create a tab and enter the hovered directory" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = [ "g", "R" ] run = 'shell -- ya emit cd "$(git rev-parse --show-toplevel)"' desc = "Repo root" -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = "q" run = "plugin confirm-quit" diff --git a/.config/yazi/plugins/chmod.yazi/README.md b/.config/yazi/plugins/chmod.yazi/README.md index b2ad136..e8a6614 100644 --- a/.config/yazi/plugins/chmod.yazi/README.md +++ b/.config/yazi/plugins/chmod.yazi/README.md @@ -7,7 +7,7 @@ https://github.com/yazi-rs/plugins/assets/17523360/7aa3abc2-d057-498c-8473-a6282 ## Installation ```sh -ya pkg add yazi-rs/plugins:chmod +ya pack -a yazi-rs/plugins:chmod ``` ## Usage @@ -15,7 +15,7 @@ ya pkg add yazi-rs/plugins:chmod Add this to your `~/.config/yazi/keymap.toml`: ```toml -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = [ "c", "m" ] run = "plugin chmod" desc = "Chmod on selected files" diff --git a/.config/yazi/plugins/chmod.yazi/main.lua b/.config/yazi/plugins/chmod.yazi/main.lua index 589ebd5..ad565c6 100644 --- a/.config/yazi/plugins/chmod.yazi/main.lua +++ b/.config/yazi/plugins/chmod.yazi/main.lua @@ -1,4 +1,4 @@ ---- @since 25.5.28 +--- @since 25.2.26 local selected_or_hovered = ya.sync(function() local tab, paths = cx.active, {} @@ -13,7 +13,7 @@ end) return { entry = function() - ya.emit("escape", { visual = true }) + ya.mgr_emit("escape", { visual = true }) local urls = selected_or_hovered() if #urls == 0 then @@ -28,7 +28,7 @@ return { return end - local status, err = Command("chmod"):arg(value):arg(urls):spawn():wait() + local status, err = Command("chmod"):arg(value):args(urls):spawn():wait() if not status or not status.success then ya.notify { title = "Chmod", diff --git a/.config/yazi/plugins/full-border.yazi/README.md b/.config/yazi/plugins/full-border.yazi/README.md index 269ca8e..6e78bd4 100644 --- a/.config/yazi/plugins/full-border.yazi/README.md +++ b/.config/yazi/plugins/full-border.yazi/README.md @@ -7,7 +7,7 @@ Add a full border to Yazi to make it look fancier. ## Installation ```sh -ya pkg add yazi-rs/plugins:full-border +ya pack -a yazi-rs/plugins:full-border ``` ## Usage diff --git a/.config/yazi/plugins/full-border.yazi/main.lua b/.config/yazi/plugins/full-border.yazi/main.lua index a917e1e..abb1c3e 100644 --- a/.config/yazi/plugins/full-border.yazi/main.lua +++ b/.config/yazi/plugins/full-border.yazi/main.lua @@ -7,10 +7,10 @@ local function setup(_, opts) Tab.build = function(self, ...) local bar = function(c, x, y) if x <= 0 or x == self._area.w - 1 or th.mgr.border_symbol ~= "│" then - return ui.Bar(ui.Edge.TOP) + return ui.Bar(ui.Bar.TOP) end - return ui.Bar(ui.Edge.TOP) + return ui.Bar(ui.Bar.TOP) :area( ui.Rect { x = x, y = math.max(0, y), w = ya.clamp(0, self._area.w - x, 1), h = math.min(1, self._area.h) } ) @@ -26,9 +26,9 @@ local function setup(_, opts) local style = th.mgr.border_style self._base = ya.list_merge(self._base or {}, { - ui.Border(ui.Edge.ALL):area(self._area):type(type):style(style), - ui.Bar(ui.Edge.RIGHT):area(self._chunks[1]):style(style), - ui.Bar(ui.Edge.LEFT):area(self._chunks[3]):style(style), + ui.Border(ui.Border.ALL):area(self._area):type(type):style(style), + ui.Bar(ui.Bar.RIGHT):area(self._chunks[1]):style(style), + ui.Bar(ui.Bar.LEFT):area(self._chunks[3]):style(style), bar("┬", c[1].right - 1, c[1].y), bar("┴", c[1].right - 1, c[1].bottom - 1), diff --git a/.config/yazi/plugins/git.yazi/README.md b/.config/yazi/plugins/git.yazi/README.md index f1848e9..4c5b07c 100644 --- a/.config/yazi/plugins/git.yazi/README.md +++ b/.config/yazi/plugins/git.yazi/README.md @@ -1,5 +1,8 @@ # git.yazi +> [!NOTE] +> Yazi v25.2.26 or later is required for this plugin to work. + Show the status of Git file changes as linemode in the file list. https://github.com/user-attachments/assets/34976be9-a871-4ffe-9d5a-c4cdd0bf4576 @@ -7,7 +10,7 @@ https://github.com/user-attachments/assets/34976be9-a871-4ffe-9d5a-c4cdd0bf4576 ## Installation ```sh -ya pkg add yazi-rs/plugins:git +ya pack -a yazi-rs/plugins:git ``` ## Setup diff --git a/.config/yazi/plugins/git.yazi/main.lua b/.config/yazi/plugins/git.yazi/main.lua index fd8b8bf..d8f365a 100644 --- a/.config/yazi/plugins/git.yazi/main.lua +++ b/.config/yazi/plugins/git.yazi/main.lua @@ -1,4 +1,4 @@ ---- @since 25.5.28 +--- @since 25.4.4 local WINDOWS = ya.target_family() == "windows" @@ -190,8 +190,8 @@ local function fetch(_, job) -- stylua: ignore local output, err = Command("git") :cwd(tostring(cwd)) - :arg({ "--no-optional-locks", "-c", "core.quotePath=", "status", "--porcelain", "-unormal", "--no-renames", "--ignored=matching" }) - :arg(paths) + :args({ "--no-optional-locks", "-c", "core.quotePath=", "status", "--porcelain", "-unormal", "--no-renames", "--ignored=matching" }) + :args(paths) :stdout(Command.PIPED) :output() if not output then diff --git a/.config/yazi/plugins/toggle-pane.yazi/README.md b/.config/yazi/plugins/toggle-pane.yazi/README.md index 3ef4095..d00c169 100644 --- a/.config/yazi/plugins/toggle-pane.yazi/README.md +++ b/.config/yazi/plugins/toggle-pane.yazi/README.md @@ -1,6 +1,6 @@ # toggle-pane.yazi -Toggle the show, hide, and maximize states for different panes: parent, current, and preview. It respects the user's [`ratio` settings](https://yazi-rs.github.io/docs/configuration/yazi#mgr.ratio)! +Toggle the show, hide, and maximize states for different panes: parent, current, and preview. It respects the user's [`ratio` settings](https://yazi-rs.github.io/docs/configuration/yazi#manager.ratio)! Assume the user's `ratio` is $$[A, B, C]$$, that is, $$\text{parent}=A, \text{current}=B, \text{preview}=C$$: @@ -15,7 +15,7 @@ Assume the user's `ratio` is $$[A, B, C]$$, that is, $$\text{parent}=A, \text{cu ## Installation ```sh -ya pkg add yazi-rs/plugins:toggle-pane +ya pack -a yazi-rs/plugins:toggle-pane ``` ## Usage @@ -24,7 +24,7 @@ Hide/Show preview: ```toml # keymap.toml -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = "T" run = "plugin toggle-pane min-preview" desc = "Show or hide the preview pane" @@ -34,7 +34,7 @@ Maximize/Restore preview: ```toml # keymap.toml -[[mgr.prepend_keymap]] +[[manager.prepend_keymap]] on = "T" run = "plugin toggle-pane max-preview" desc = "Maximize or restore the preview pane" diff --git a/.config/yazi/plugins/toggle-pane.yazi/main.lua b/.config/yazi/plugins/toggle-pane.yazi/main.lua index 130c174..b408692 100644 --- a/.config/yazi/plugins/toggle-pane.yazi/main.lua +++ b/.config/yazi/plugins/toggle-pane.yazi/main.lua @@ -1,4 +1,4 @@ ---- @since 25.5.28 +--- @since 25.2.26 --- @sync entry local function entry(st, job) @@ -39,7 +39,13 @@ local function entry(st, job) Tab.layout, st.old = st.old, nil st.parent, st.current, st.preview = nil, nil, nil end - ya.emit("app:resize", {}) + + -- TODO: remove this in the future + if ya.emit then + ya.emit("app:resize", {}) + else + ya.app_emit("resize", {}) + end end return { entry = entry } diff --git a/.config/yazi/plugins/yatline-githead.yazi/main.lua b/.config/yazi/plugins/yatline-githead.yazi/main.lua index 714358a..73e2df0 100644 --- a/.config/yazi/plugins/yatline-githead.yazi/main.lua +++ b/.config/yazi/plugins/yatline-githead.yazi/main.lua @@ -227,18 +227,16 @@ return { local callback = function() local cwd = cx.active.current.cwd - ya.emit("plugin", { - this._id, - ya.quote(tostring(cwd), true), - }) + if this.cwd ~= cwd then + this.cwd = cwd + ya.manager_emit("plugin", { + this._id, + ya.quote(tostring(cwd), true), + }) + end end ps.sub("cd", callback) - ps.sub("rename", callback) - ps.sub("bulk", callback) - ps.sub("move", callback) - ps.sub("trash", callback) - ps.sub("delete", callback) ps.sub("tab", callback) if Yatline ~= nil then @@ -246,10 +244,6 @@ return { local status = this.output local githead = {} - if not status then - return githead - end - local branch = config.show_branch and get_branch(status) or "" if branch ~= nil and branch ~= "" then table.insert(githead, { branch[2], theme.prefix_color }) @@ -307,7 +301,7 @@ return { entry = function(_, job) local args = job.args or job local command = Command("git") - :arg({ "status", "--ignore-submodules=dirty", "--branch", "--show-stash", "--ahead-behind" }) + :args({ "status", "--ignore-submodules=dirty", "--branch", "--show-stash", "--ahead-behind" }) :cwd(args[1]) :env("LANGUAGE", "en_US.UTF-8") :stdout(Command.PIPED) diff --git a/.config/yazi/plugins/yatline.yazi/main.lua b/.config/yazi/plugins/yatline.yazi/main.lua index ea354f3..48591c5 100644 --- a/.config/yazi/plugins/yatline.yazi/main.lua +++ b/.config/yazi/plugins/yatline.yazi/main.lua @@ -424,20 +424,12 @@ function Yatline.string.get:hovered_mime() end --- Gets the hovered file's user and group ownership of the current active tab. ---- Unix-like systems only. --- @return string ownership Current active tab's hovered file's user and group ownership. function Yatline.string.get:hovered_ownership() local hovered = cx.active.current.hovered if hovered then - if not hovered.cha.uid or not hovered.cha.gid then - return "" - end - - local username = ya.user_name(hovered.cha.uid) or tostring(hovered.cha.uid) - local groupname = ya.group_name(hovered.cha.gid) or tostring(hovered.cha.gid) - - return username .. ":" .. groupname + return ya.user_name(hovered.cha.uid) .. ":" .. ya.group_name(hovered.cha.gid) else return "" end @@ -721,7 +713,6 @@ function Yatline.coloreds.create(coloreds, component_type) end --- Gets the hovered file's permissions of the current active tab. ---- Unix-like systems only. --- @return Coloreds coloreds Current active tab's hovered file's permissions function Yatline.coloreds.get:permissions() local hovered = cx.active.current.hovered @@ -999,10 +990,8 @@ local function config_side(side) if component_group then if component.custom then - if component.name ~= nil and component.name ~= "" and #component.name ~= 0 then - section_components[#section_components + 1] = - { component_group.create(component.name, in_section), component_group.has_separator } - end + section_components[#section_components + 1] = + { component_group.create(component.name, in_section), component_group.has_separator } else local getter = component_group.get[component.name] @@ -1086,65 +1075,9 @@ local function config_paragraph(area, line) end return { - setup = function(_, config, pre_theme) + setup = function(_, config) config = config or {} - if config == 0 then - config = { - show_background = false, - - header_line = { - left = { - section_a = { - { type = "line", custom = false, name = "tabs", params = { "left" } }, - }, - section_b = {}, - section_c = {}, - }, - right = { - section_a = { - { type = "string", custom = false, name = "date", params = { "%A, %d %B %Y" } }, - }, - section_b = { - { type = "string", custom = false, name = "date", params = { "%X" } }, - }, - section_c = {}, - }, - }, - - status_line = { - left = { - section_a = { - { type = "string", custom = false, name = "tab_mode" }, - }, - section_b = { - { type = "string", custom = false, name = "hovered_size" }, - }, - section_c = { - { type = "string", custom = false, name = "hovered_path" }, - { type = "coloreds", custom = false, name = "count" }, - }, - }, - right = { - section_a = { - { type = "string", custom = false, name = "cursor_position" }, - }, - section_b = { - { type = "string", custom = false, name = "cursor_percentage" }, - }, - section_c = { - { type = "string", custom = false, name = "hovered_file_extension", params = { true } }, - { type = "coloreds", custom = false, name = "permissions" }, - }, - }, - }, - } - end - - if pre_theme then - config.theme = pre_theme - end - tab_width = config.tab_width or 20 local component_positions = config.component_positions or { "header", "tab", "status" } diff --git a/.config/yazi/yazi.toml b/.config/yazi/yazi.toml index bfd7f90..49c88e1 100644 --- a/.config/yazi/yazi.toml +++ b/.config/yazi/yazi.toml @@ -1,4 +1,4 @@ -[mgr] +[manager] show_hidden = true linemode = "size_and_mtime"