Compare commits
No commits in common. "e474f94fb6127772dbe69e668b000bc4adc3d2a3" and "55021b000f1437bda5a2febf9dbfc1cbd888d3c0" have entirely different histories.
e474f94fb6
...
55021b000f
17 changed files with 66 additions and 617 deletions
|
@ -90,281 +90,3 @@ require('lualine').setup {
|
||||||
inactive_winbar = {},
|
inactive_winbar = {},
|
||||||
extensions = {}
|
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
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
-- mini.icons
|
|
||||||
return {
|
|
||||||
{
|
|
||||||
"echasnovski/mini.icons",
|
|
||||||
version = "*",
|
|
||||||
lazy = false
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
|
||||||
{ "<leader><space>", function() Snacks.picker.smart() end, desc = "Smart Find Files" },
|
|
||||||
{ "<leader>,", function() Snacks.picker.buffers() end, desc = "Buffers" },
|
|
||||||
{ "<leader>/", function() Snacks.picker.grep() end, desc = "Grep" },
|
|
||||||
{ "<leader>:", function() Snacks.picker.command_history() end, desc = "Command History" },
|
|
||||||
{ "<leader>n", function() Snacks.picker.notifications() end, desc = "Notification History" },
|
|
||||||
{ "<leader>e", function() Snacks.explorer() end, desc = "File Explorer" },
|
|
||||||
-- find
|
|
||||||
{ "<leader>fb", function() Snacks.picker.buffers() end, desc = "Buffers" },
|
|
||||||
{ "<leader>fc", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, desc = "Find Config File" },
|
|
||||||
{ "<leader>ff", function() Snacks.picker.files() end, desc = "Find Files" },
|
|
||||||
{ "<leader>fg", function() Snacks.picker.git_files() end, desc = "Find Git Files" },
|
|
||||||
{ "<leader>fp", function() Snacks.picker.projects() end, desc = "Projects" },
|
|
||||||
{ "<leader>fr", function() Snacks.picker.recent() end, desc = "Recent" },
|
|
||||||
-- git
|
|
||||||
{ "<leader>gb", function() Snacks.picker.git_branches() end, desc = "Git Branches" },
|
|
||||||
{ "<leader>gl", function() Snacks.picker.git_log() end, desc = "Git Log" },
|
|
||||||
{ "<leader>gL", function() Snacks.picker.git_log_line() end, desc = "Git Log Line" },
|
|
||||||
{ "<leader>gs", function() Snacks.picker.git_status() end, desc = "Git Status" },
|
|
||||||
{ "<leader>gS", function() Snacks.picker.git_stash() end, desc = "Git Stash" },
|
|
||||||
{ "<leader>gd", function() Snacks.picker.git_diff() end, desc = "Git Diff (Hunks)" },
|
|
||||||
{ "<leader>gf", function() Snacks.picker.git_log_file() end, desc = "Git Log File" },
|
|
||||||
-- Grep
|
|
||||||
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
|
|
||||||
{ "<leader>sB", function() Snacks.picker.grep_buffers() end, desc = "Grep Open Buffers" },
|
|
||||||
{ "<leader>sg", function() Snacks.picker.grep() end, desc = "Grep" },
|
|
||||||
{ "<leader>sw", function() Snacks.picker.grep_word() end, desc = "Visual selection or word", mode = { "n", "x" } },
|
|
||||||
-- search
|
|
||||||
{ '<leader>s"', function() Snacks.picker.registers() end, desc = "Registers" },
|
|
||||||
{ '<leader>s/', function() Snacks.picker.search_history() end, desc = "Search History" },
|
|
||||||
{ "<leader>sa", function() Snacks.picker.autocmds() end, desc = "Autocmds" },
|
|
||||||
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
|
|
||||||
{ "<leader>sc", function() Snacks.picker.command_history() end, desc = "Command History" },
|
|
||||||
{ "<leader>sC", function() Snacks.picker.commands() end, desc = "Commands" },
|
|
||||||
{ "<leader>sd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" },
|
|
||||||
{ "<leader>sD", function() Snacks.picker.diagnostics_buffer() end, desc = "Buffer Diagnostics" },
|
|
||||||
{ "<leader>sh", function() Snacks.picker.help() end, desc = "Help Pages" },
|
|
||||||
{ "<leader>sH", function() Snacks.picker.highlights() end, desc = "Highlights" },
|
|
||||||
{ "<leader>si", function() Snacks.picker.icons() end, desc = "Icons" },
|
|
||||||
{ "<leader>sj", function() Snacks.picker.jumps() end, desc = "Jumps" },
|
|
||||||
{ "<leader>sk", function() Snacks.picker.keymaps() end, desc = "Keymaps" },
|
|
||||||
{ "<leader>sl", function() Snacks.picker.loclist() end, desc = "Location List" },
|
|
||||||
{ "<leader>sm", function() Snacks.picker.marks() end, desc = "Marks" },
|
|
||||||
{ "<leader>sM", function() Snacks.picker.man() end, desc = "Man Pages" },
|
|
||||||
{ "<leader>sp", function() Snacks.picker.lazy() end, desc = "Search for Plugin Spec" },
|
|
||||||
{ "<leader>sq", function() Snacks.picker.qflist() end, desc = "Quickfix List" },
|
|
||||||
{ "<leader>sR", function() Snacks.picker.resume() end, desc = "Resume" },
|
|
||||||
{ "<leader>su", function() Snacks.picker.undo() end, desc = "Undo History" },
|
|
||||||
{ "<leader>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" },
|
|
||||||
{ "<leader>ss", function() Snacks.picker.lsp_symbols() end, desc = "LSP Symbols" },
|
|
||||||
{ "<leader>sS", function() Snacks.picker.lsp_workspace_symbols() end, desc = "LSP Workspace Symbols" },
|
|
||||||
-- Other
|
|
||||||
{ "<leader>z", function() Snacks.zen() end, desc = "Toggle Zen Mode" },
|
|
||||||
{ "<leader>Z", function() Snacks.zen.zoom() end, desc = "Toggle Zoom" },
|
|
||||||
{ "<leader>.", function() Snacks.scratch() end, desc = "Toggle Scratch Buffer" },
|
|
||||||
{ "<leader>S", function() Snacks.scratch.select() end, desc = "Select Scratch Buffer" },
|
|
||||||
{ "<leader>n", function() Snacks.notifier.show_history() end, desc = "Notification History" },
|
|
||||||
{ "<leader>bd", function() Snacks.bufdelete() end, desc = "Delete Buffer" },
|
|
||||||
{ "<leader>cR", function() Snacks.rename.rename_file() end, desc = "Rename File" },
|
|
||||||
{ "<leader>gB", function() Snacks.gitbrowse() end, desc = "Git Browse", mode = { "n", "v" } },
|
|
||||||
{ "<leader>gg", function() Snacks.lazygit() end, desc = "Lazygit" },
|
|
||||||
{ "<leader>un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" },
|
|
||||||
{ "<c-/>", function() Snacks.terminal() end, desc = "Toggle Terminal" },
|
|
||||||
{ "<c-_>", 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" } },
|
|
||||||
{
|
|
||||||
"<leader>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("<leader>us")
|
|
||||||
Snacks.toggle.option("wrap", { name = "Wrap" }):map("<leader>uw")
|
|
||||||
Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("<leader>uL")
|
|
||||||
Snacks.toggle.diagnostics():map("<leader>ud")
|
|
||||||
Snacks.toggle.line_number():map("<leader>ul")
|
|
||||||
Snacks.toggle.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map("<leader>uc")
|
|
||||||
Snacks.toggle.treesitter():map("<leader>uT")
|
|
||||||
Snacks.toggle.option("background", { off = "light", on = "dark", name = "Dark Background" }):map("<leader>ub")
|
|
||||||
Snacks.toggle.inlay_hints():map("<leader>uh")
|
|
||||||
Snacks.toggle.indent():map("<leader>ug")
|
|
||||||
Snacks.toggle.dim():map("<leader>uD")
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -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",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# : Manager {{{
|
# : Manager {{{
|
||||||
|
|
||||||
[mgr]
|
[manager]
|
||||||
cwd = { fg = "#8be9fd" }
|
cwd = { fg = "#8be9fd" }
|
||||||
|
|
||||||
# Hovered
|
# 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 {{{
|
||||||
|
|
||||||
[mode]
|
[mode]
|
||||||
|
|
|
@ -1,108 +1,108 @@
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "g", "c" ]
|
on = [ "g", "c" ]
|
||||||
run = "cd /home/peter/.config"
|
run = "cd /home/peter/.config"
|
||||||
desc = "Configs"
|
desc = "Configs"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = "!"
|
on = "!"
|
||||||
run = 'shell "$SHELL" --block'
|
run = 'shell "$SHELL" --block'
|
||||||
desc = "Open shell here"
|
desc = "Open shell here"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = "T"
|
on = "T"
|
||||||
run = "plugin toggle-pane min-preview"
|
run = "plugin toggle-pane min-preview"
|
||||||
desc = "Show or hide the preview pane"
|
desc = "Show or hide the preview pane"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "g", "d" ]
|
on = [ "g", "d" ]
|
||||||
run = "cd /home/peter/Downloads"
|
run = "cd /home/peter/Downloads"
|
||||||
desc = "Downloads"
|
desc = "Downloads"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "g", "b" ]
|
on = [ "g", "b" ]
|
||||||
run = "cd /mnt/Backups"
|
run = "cd /mnt/Backups"
|
||||||
desc = "Backups"
|
desc = "Backups"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "g", "v" ]
|
on = [ "g", "v" ]
|
||||||
run = "cd /media/Games"
|
run = "cd /media/Games"
|
||||||
desc = "Games"
|
desc = "Games"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "g", "s" ]
|
on = [ "g", "s" ]
|
||||||
run = "cd /mnt/SSD"
|
run = "cd /mnt/SSD"
|
||||||
desc = "SSD"
|
desc = "SSD"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "g", "n" ]
|
on = [ "g", "n" ]
|
||||||
run = "cd /home/peter/Nextcloud"
|
run = "cd /home/peter/Nextcloud"
|
||||||
desc = "Nextcloud"
|
desc = "Nextcloud"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "g", "r" ]
|
on = [ "g", "r" ]
|
||||||
run = "cd /run/media"
|
run = "cd /run/media"
|
||||||
desc = "Media"
|
desc = "Media"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "g", "a" ]
|
on = [ "g", "a" ]
|
||||||
run = "cd /home/peter/Downloads/AUR"
|
run = "cd /home/peter/Downloads/AUR"
|
||||||
desc = "AUR"
|
desc = "AUR"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "g", "!" ]
|
on = [ "g", "!" ]
|
||||||
run = "cd ~/.bin/sh"
|
run = "cd ~/.bin/sh"
|
||||||
desc = "Scripts"
|
desc = "Scripts"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "g", "t" ]
|
on = [ "g", "t" ]
|
||||||
run = "cd ~/.local/share/Trash/files"
|
run = "cd ~/.local/share/Trash/files"
|
||||||
desc = "Trash"
|
desc = "Trash"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "g", "y" ]
|
on = [ "g", "y" ]
|
||||||
run = "cd ~/Sync"
|
run = "cd ~/Sync"
|
||||||
desc = "Sync"
|
desc = "Sync"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "c", "m" ]
|
on = [ "c", "m" ]
|
||||||
run = "plugin chmod"
|
run = "plugin chmod"
|
||||||
desc = "Chmod on selected files"
|
desc = "Chmod on selected files"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = ["C"]
|
on = ["C"]
|
||||||
run = "plugin ouch"
|
run = "plugin ouch"
|
||||||
desc = "Compress with ouch"
|
desc = "Compress with ouch"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = "2"
|
on = "2"
|
||||||
run = "plugin smart-switch 1"
|
run = "plugin smart-switch 1"
|
||||||
desc = "Switch or create tab 2"
|
desc = "Switch or create tab 2"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = "3"
|
on = "3"
|
||||||
run = "plugin smart-switch 2"
|
run = "plugin smart-switch 2"
|
||||||
desc = "Switch or create tab 3"
|
desc = "Switch or create tab 3"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = "4"
|
on = "4"
|
||||||
run = "plugin smart-switch 3"
|
run = "plugin smart-switch 3"
|
||||||
desc = "Switch or create tab 4"
|
desc = "Switch or create tab 4"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = "5"
|
on = "5"
|
||||||
run = "plugin smart-switch 4"
|
run = "plugin smart-switch 4"
|
||||||
desc = "Switch or create tab 5"
|
desc = "Switch or create tab 5"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = "t"
|
on = "t"
|
||||||
run = "plugin smart-tab"
|
run = "plugin smart-tab"
|
||||||
desc = "Create a tab and enter the hovered directory"
|
desc = "Create a tab and enter the hovered directory"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "g", "R" ]
|
on = [ "g", "R" ]
|
||||||
run = 'shell -- ya emit cd "$(git rev-parse --show-toplevel)"'
|
run = 'shell -- ya emit cd "$(git rev-parse --show-toplevel)"'
|
||||||
desc = "Repo root"
|
desc = "Repo root"
|
||||||
|
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = "q"
|
on = "q"
|
||||||
run = "plugin confirm-quit"
|
run = "plugin confirm-quit"
|
||||||
|
|
|
@ -7,7 +7,7 @@ https://github.com/yazi-rs/plugins/assets/17523360/7aa3abc2-d057-498c-8473-a6282
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ya pkg add yazi-rs/plugins:chmod
|
ya pack -a yazi-rs/plugins:chmod
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
@ -15,7 +15,7 @@ ya pkg add yazi-rs/plugins:chmod
|
||||||
Add this to your `~/.config/yazi/keymap.toml`:
|
Add this to your `~/.config/yazi/keymap.toml`:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = [ "c", "m" ]
|
on = [ "c", "m" ]
|
||||||
run = "plugin chmod"
|
run = "plugin chmod"
|
||||||
desc = "Chmod on selected files"
|
desc = "Chmod on selected files"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
--- @since 25.5.28
|
--- @since 25.2.26
|
||||||
|
|
||||||
local selected_or_hovered = ya.sync(function()
|
local selected_or_hovered = ya.sync(function()
|
||||||
local tab, paths = cx.active, {}
|
local tab, paths = cx.active, {}
|
||||||
|
@ -13,7 +13,7 @@ end)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
entry = function()
|
entry = function()
|
||||||
ya.emit("escape", { visual = true })
|
ya.mgr_emit("escape", { visual = true })
|
||||||
|
|
||||||
local urls = selected_or_hovered()
|
local urls = selected_or_hovered()
|
||||||
if #urls == 0 then
|
if #urls == 0 then
|
||||||
|
@ -28,7 +28,7 @@ return {
|
||||||
return
|
return
|
||||||
end
|
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
|
if not status or not status.success then
|
||||||
ya.notify {
|
ya.notify {
|
||||||
title = "Chmod",
|
title = "Chmod",
|
||||||
|
|
|
@ -7,7 +7,7 @@ Add a full border to Yazi to make it look fancier.
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ya pkg add yazi-rs/plugins:full-border
|
ya pack -a yazi-rs/plugins:full-border
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
|
@ -7,10 +7,10 @@ local function setup(_, opts)
|
||||||
Tab.build = function(self, ...)
|
Tab.build = function(self, ...)
|
||||||
local bar = function(c, x, y)
|
local bar = function(c, x, y)
|
||||||
if x <= 0 or x == self._area.w - 1 or th.mgr.border_symbol ~= "│" then
|
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
|
end
|
||||||
|
|
||||||
return ui.Bar(ui.Edge.TOP)
|
return ui.Bar(ui.Bar.TOP)
|
||||||
:area(
|
: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) }
|
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
|
local style = th.mgr.border_style
|
||||||
self._base = ya.list_merge(self._base or {}, {
|
self._base = ya.list_merge(self._base or {}, {
|
||||||
ui.Border(ui.Edge.ALL):area(self._area):type(type):style(style),
|
ui.Border(ui.Border.ALL):area(self._area):type(type):style(style),
|
||||||
ui.Bar(ui.Edge.RIGHT):area(self._chunks[1]):style(style),
|
ui.Bar(ui.Bar.RIGHT):area(self._chunks[1]):style(style),
|
||||||
ui.Bar(ui.Edge.LEFT):area(self._chunks[3]):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].y),
|
||||||
bar("┴", c[1].right - 1, c[1].bottom - 1),
|
bar("┴", c[1].right - 1, c[1].bottom - 1),
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# git.yazi
|
# 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.
|
Show the status of Git file changes as linemode in the file list.
|
||||||
|
|
||||||
https://github.com/user-attachments/assets/34976be9-a871-4ffe-9d5a-c4cdd0bf4576
|
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
|
## Installation
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ya pkg add yazi-rs/plugins:git
|
ya pack -a yazi-rs/plugins:git
|
||||||
```
|
```
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
--- @since 25.5.28
|
--- @since 25.4.4
|
||||||
|
|
||||||
local WINDOWS = ya.target_family() == "windows"
|
local WINDOWS = ya.target_family() == "windows"
|
||||||
|
|
||||||
|
@ -190,8 +190,8 @@ local function fetch(_, job)
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
local output, err = Command("git")
|
local output, err = Command("git")
|
||||||
:cwd(tostring(cwd))
|
:cwd(tostring(cwd))
|
||||||
:arg({ "--no-optional-locks", "-c", "core.quotePath=", "status", "--porcelain", "-unormal", "--no-renames", "--ignored=matching" })
|
:args({ "--no-optional-locks", "-c", "core.quotePath=", "status", "--porcelain", "-unormal", "--no-renames", "--ignored=matching" })
|
||||||
:arg(paths)
|
:args(paths)
|
||||||
:stdout(Command.PIPED)
|
:stdout(Command.PIPED)
|
||||||
:output()
|
:output()
|
||||||
if not output then
|
if not output then
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# toggle-pane.yazi
|
# 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$$:
|
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
|
## Installation
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ya pkg add yazi-rs/plugins:toggle-pane
|
ya pack -a yazi-rs/plugins:toggle-pane
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
@ -24,7 +24,7 @@ Hide/Show preview:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# keymap.toml
|
# keymap.toml
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = "T"
|
on = "T"
|
||||||
run = "plugin toggle-pane min-preview"
|
run = "plugin toggle-pane min-preview"
|
||||||
desc = "Show or hide the preview pane"
|
desc = "Show or hide the preview pane"
|
||||||
|
@ -34,7 +34,7 @@ Maximize/Restore preview:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# keymap.toml
|
# keymap.toml
|
||||||
[[mgr.prepend_keymap]]
|
[[manager.prepend_keymap]]
|
||||||
on = "T"
|
on = "T"
|
||||||
run = "plugin toggle-pane max-preview"
|
run = "plugin toggle-pane max-preview"
|
||||||
desc = "Maximize or restore the preview pane"
|
desc = "Maximize or restore the preview pane"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
--- @since 25.5.28
|
--- @since 25.2.26
|
||||||
--- @sync entry
|
--- @sync entry
|
||||||
|
|
||||||
local function entry(st, job)
|
local function entry(st, job)
|
||||||
|
@ -39,7 +39,13 @@ local function entry(st, job)
|
||||||
Tab.layout, st.old = st.old, nil
|
Tab.layout, st.old = st.old, nil
|
||||||
st.parent, st.current, st.preview = nil, nil, nil
|
st.parent, st.current, st.preview = nil, nil, nil
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
return { entry = entry }
|
return { entry = entry }
|
||||||
|
|
|
@ -227,18 +227,16 @@ return {
|
||||||
local callback = function()
|
local callback = function()
|
||||||
local cwd = cx.active.current.cwd
|
local cwd = cx.active.current.cwd
|
||||||
|
|
||||||
ya.emit("plugin", {
|
if this.cwd ~= cwd then
|
||||||
this._id,
|
this.cwd = cwd
|
||||||
ya.quote(tostring(cwd), true),
|
ya.manager_emit("plugin", {
|
||||||
})
|
this._id,
|
||||||
|
ya.quote(tostring(cwd), true),
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ps.sub("cd", callback)
|
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)
|
ps.sub("tab", callback)
|
||||||
|
|
||||||
if Yatline ~= nil then
|
if Yatline ~= nil then
|
||||||
|
@ -246,10 +244,6 @@ return {
|
||||||
local status = this.output
|
local status = this.output
|
||||||
local githead = {}
|
local githead = {}
|
||||||
|
|
||||||
if not status then
|
|
||||||
return githead
|
|
||||||
end
|
|
||||||
|
|
||||||
local branch = config.show_branch and get_branch(status) or ""
|
local branch = config.show_branch and get_branch(status) or ""
|
||||||
if branch ~= nil and branch ~= "" then
|
if branch ~= nil and branch ~= "" then
|
||||||
table.insert(githead, { branch[2], theme.prefix_color })
|
table.insert(githead, { branch[2], theme.prefix_color })
|
||||||
|
@ -307,7 +301,7 @@ return {
|
||||||
entry = function(_, job)
|
entry = function(_, job)
|
||||||
local args = job.args or job
|
local args = job.args or job
|
||||||
local command = Command("git")
|
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])
|
:cwd(args[1])
|
||||||
:env("LANGUAGE", "en_US.UTF-8")
|
:env("LANGUAGE", "en_US.UTF-8")
|
||||||
:stdout(Command.PIPED)
|
:stdout(Command.PIPED)
|
||||||
|
|
|
@ -424,20 +424,12 @@ function Yatline.string.get:hovered_mime()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Gets the hovered file's user and group ownership of the current active tab.
|
--- 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.
|
--- @return string ownership Current active tab's hovered file's user and group ownership.
|
||||||
function Yatline.string.get:hovered_ownership()
|
function Yatline.string.get:hovered_ownership()
|
||||||
local hovered = cx.active.current.hovered
|
local hovered = cx.active.current.hovered
|
||||||
|
|
||||||
if hovered then
|
if hovered then
|
||||||
if not hovered.cha.uid or not hovered.cha.gid then
|
return ya.user_name(hovered.cha.uid) .. ":" .. ya.group_name(hovered.cha.gid)
|
||||||
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
|
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
@ -721,7 +713,6 @@ function Yatline.coloreds.create(coloreds, component_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Gets the hovered file's permissions of the current active tab.
|
--- 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
|
--- @return Coloreds coloreds Current active tab's hovered file's permissions
|
||||||
function Yatline.coloreds.get:permissions()
|
function Yatline.coloreds.get:permissions()
|
||||||
local hovered = cx.active.current.hovered
|
local hovered = cx.active.current.hovered
|
||||||
|
@ -999,10 +990,8 @@ local function config_side(side)
|
||||||
|
|
||||||
if component_group then
|
if component_group then
|
||||||
if component.custom then
|
if component.custom then
|
||||||
if component.name ~= nil and component.name ~= "" and #component.name ~= 0 then
|
section_components[#section_components + 1] =
|
||||||
section_components[#section_components + 1] =
|
{ component_group.create(component.name, in_section), component_group.has_separator }
|
||||||
{ component_group.create(component.name, in_section), component_group.has_separator }
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
local getter = component_group.get[component.name]
|
local getter = component_group.get[component.name]
|
||||||
|
|
||||||
|
@ -1086,65 +1075,9 @@ local function config_paragraph(area, line)
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
setup = function(_, config, pre_theme)
|
setup = function(_, config)
|
||||||
config = config or {}
|
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
|
tab_width = config.tab_width or 20
|
||||||
|
|
||||||
local component_positions = config.component_positions or { "header", "tab", "status" }
|
local component_positions = config.component_positions or { "header", "tab", "status" }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[mgr]
|
[manager]
|
||||||
show_hidden = true
|
show_hidden = true
|
||||||
linemode = "size_and_mtime"
|
linemode = "size_and_mtime"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue