update lua config
This commit is contained in:
parent
768e4e1b9e
commit
e474f94fb6
14 changed files with 417 additions and 66 deletions
|
@ -90,3 +90,281 @@ 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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# : Manager {{{
|
||||
|
||||
[manager]
|
||||
[mgr]
|
||||
cwd = { fg = "#8be9fd" }
|
||||
|
||||
# Hovered
|
||||
|
@ -36,6 +36,15 @@ border_style = { fg = "#7282b5" }
|
|||
# : }}}
|
||||
|
||||
|
||||
# : Tabs {{{
|
||||
|
||||
[tabs]
|
||||
active = { fg = "#282a36", bg = "#bd93f9", bold = true }
|
||||
inactive = { fg = "#bd93f9", bg = "#44475a" }
|
||||
|
||||
# : }}}
|
||||
|
||||
|
||||
# : Mode {{{
|
||||
|
||||
[mode]
|
||||
|
|
|
@ -1,108 +1,108 @@
|
|||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "g", "c" ]
|
||||
run = "cd /home/peter/.config"
|
||||
desc = "Configs"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "!"
|
||||
run = 'shell "$SHELL" --block'
|
||||
desc = "Open shell here"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "T"
|
||||
run = "plugin toggle-pane min-preview"
|
||||
desc = "Show or hide the preview pane"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "g", "d" ]
|
||||
run = "cd /home/peter/Downloads"
|
||||
desc = "Downloads"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "g", "b" ]
|
||||
run = "cd /mnt/Backups"
|
||||
desc = "Backups"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "g", "v" ]
|
||||
run = "cd /media/Games"
|
||||
desc = "Games"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "g", "s" ]
|
||||
run = "cd /mnt/SSD"
|
||||
desc = "SSD"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "g", "n" ]
|
||||
run = "cd /home/peter/Nextcloud"
|
||||
desc = "Nextcloud"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "g", "r" ]
|
||||
run = "cd /run/media"
|
||||
desc = "Media"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "g", "a" ]
|
||||
run = "cd /home/peter/Downloads/AUR"
|
||||
desc = "AUR"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "g", "!" ]
|
||||
run = "cd ~/.bin/sh"
|
||||
desc = "Scripts"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "g", "t" ]
|
||||
run = "cd ~/.local/share/Trash/files"
|
||||
desc = "Trash"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "g", "y" ]
|
||||
run = "cd ~/Sync"
|
||||
desc = "Sync"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "c", "m" ]
|
||||
run = "plugin chmod"
|
||||
desc = "Chmod on selected files"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = ["C"]
|
||||
run = "plugin ouch"
|
||||
desc = "Compress with ouch"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "2"
|
||||
run = "plugin smart-switch 1"
|
||||
desc = "Switch or create tab 2"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "3"
|
||||
run = "plugin smart-switch 2"
|
||||
desc = "Switch or create tab 3"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "4"
|
||||
run = "plugin smart-switch 3"
|
||||
desc = "Switch or create tab 4"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "5"
|
||||
run = "plugin smart-switch 4"
|
||||
desc = "Switch or create tab 5"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "t"
|
||||
run = "plugin smart-tab"
|
||||
desc = "Create a tab and enter the hovered directory"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "g", "R" ]
|
||||
run = 'shell -- ya emit cd "$(git rev-parse --show-toplevel)"'
|
||||
desc = "Repo root"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "q"
|
||||
run = "plugin confirm-quit"
|
||||
|
|
|
@ -7,7 +7,7 @@ https://github.com/yazi-rs/plugins/assets/17523360/7aa3abc2-d057-498c-8473-a6282
|
|||
## Installation
|
||||
|
||||
```sh
|
||||
ya pack -a yazi-rs/plugins:chmod
|
||||
ya pkg add yazi-rs/plugins:chmod
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
@ -15,7 +15,7 @@ ya pack -a yazi-rs/plugins:chmod
|
|||
Add this to your `~/.config/yazi/keymap.toml`:
|
||||
|
||||
```toml
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "c", "m" ]
|
||||
run = "plugin chmod"
|
||||
desc = "Chmod on selected files"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
--- @since 25.2.26
|
||||
--- @since 25.5.28
|
||||
|
||||
local selected_or_hovered = ya.sync(function()
|
||||
local tab, paths = cx.active, {}
|
||||
|
@ -13,7 +13,7 @@ end)
|
|||
|
||||
return {
|
||||
entry = function()
|
||||
ya.mgr_emit("escape", { visual = true })
|
||||
ya.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):args(urls):spawn():wait()
|
||||
local status, err = Command("chmod"):arg(value):arg(urls):spawn():wait()
|
||||
if not status or not status.success then
|
||||
ya.notify {
|
||||
title = "Chmod",
|
||||
|
|
|
@ -7,7 +7,7 @@ Add a full border to Yazi to make it look fancier.
|
|||
## Installation
|
||||
|
||||
```sh
|
||||
ya pack -a yazi-rs/plugins:full-border
|
||||
ya pkg add yazi-rs/plugins:full-border
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
|
|
@ -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.Bar.TOP)
|
||||
return ui.Bar(ui.Edge.TOP)
|
||||
end
|
||||
|
||||
return ui.Bar(ui.Bar.TOP)
|
||||
return ui.Bar(ui.Edge.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.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),
|
||||
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),
|
||||
|
||||
bar("┬", c[1].right - 1, c[1].y),
|
||||
bar("┴", c[1].right - 1, c[1].bottom - 1),
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# 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
|
||||
|
@ -10,7 +7,7 @@ https://github.com/user-attachments/assets/34976be9-a871-4ffe-9d5a-c4cdd0bf4576
|
|||
## Installation
|
||||
|
||||
```sh
|
||||
ya pack -a yazi-rs/plugins:git
|
||||
ya pkg add yazi-rs/plugins:git
|
||||
```
|
||||
|
||||
## Setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
--- @since 25.4.4
|
||||
--- @since 25.5.28
|
||||
|
||||
local WINDOWS = ya.target_family() == "windows"
|
||||
|
||||
|
@ -190,8 +190,8 @@ local function fetch(_, job)
|
|||
-- stylua: ignore
|
||||
local output, err = Command("git")
|
||||
:cwd(tostring(cwd))
|
||||
:args({ "--no-optional-locks", "-c", "core.quotePath=", "status", "--porcelain", "-unormal", "--no-renames", "--ignored=matching" })
|
||||
:args(paths)
|
||||
:arg({ "--no-optional-locks", "-c", "core.quotePath=", "status", "--porcelain", "-unormal", "--no-renames", "--ignored=matching" })
|
||||
:arg(paths)
|
||||
:stdout(Command.PIPED)
|
||||
:output()
|
||||
if not output then
|
||||
|
|
|
@ -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#manager.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#mgr.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 pack -a yazi-rs/plugins:toggle-pane
|
||||
ya pkg add yazi-rs/plugins:toggle-pane
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
@ -24,7 +24,7 @@ Hide/Show preview:
|
|||
|
||||
```toml
|
||||
# keymap.toml
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.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
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "T"
|
||||
run = "plugin toggle-pane max-preview"
|
||||
desc = "Maximize or restore the preview pane"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
--- @since 25.2.26
|
||||
--- @since 25.5.28
|
||||
--- @sync entry
|
||||
|
||||
local function entry(st, job)
|
||||
|
@ -39,13 +39,7 @@ local function entry(st, job)
|
|||
Tab.layout, st.old = st.old, nil
|
||||
st.parent, st.current, st.preview = nil, nil, nil
|
||||
end
|
||||
|
||||
-- TODO: remove this in the future
|
||||
if ya.emit then
|
||||
ya.emit("app:resize", {})
|
||||
else
|
||||
ya.app_emit("resize", {})
|
||||
end
|
||||
ya.emit("app:resize", {})
|
||||
end
|
||||
|
||||
return { entry = entry }
|
||||
|
|
|
@ -227,16 +227,18 @@ return {
|
|||
local callback = function()
|
||||
local cwd = cx.active.current.cwd
|
||||
|
||||
if this.cwd ~= cwd then
|
||||
this.cwd = cwd
|
||||
ya.manager_emit("plugin", {
|
||||
this._id,
|
||||
ya.quote(tostring(cwd), true),
|
||||
})
|
||||
end
|
||||
ya.emit("plugin", {
|
||||
this._id,
|
||||
ya.quote(tostring(cwd), true),
|
||||
})
|
||||
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
|
||||
|
@ -244,6 +246,10 @@ 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 })
|
||||
|
@ -301,7 +307,7 @@ return {
|
|||
entry = function(_, job)
|
||||
local args = job.args or job
|
||||
local command = Command("git")
|
||||
:args({ "status", "--ignore-submodules=dirty", "--branch", "--show-stash", "--ahead-behind" })
|
||||
:arg({ "status", "--ignore-submodules=dirty", "--branch", "--show-stash", "--ahead-behind" })
|
||||
:cwd(args[1])
|
||||
:env("LANGUAGE", "en_US.UTF-8")
|
||||
:stdout(Command.PIPED)
|
||||
|
|
|
@ -424,12 +424,20 @@ 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
|
||||
return ya.user_name(hovered.cha.uid) .. ":" .. ya.group_name(hovered.cha.gid)
|
||||
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
|
||||
else
|
||||
return ""
|
||||
end
|
||||
|
@ -713,6 +721,7 @@ 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
|
||||
|
@ -990,8 +999,10 @@ local function config_side(side)
|
|||
|
||||
if component_group then
|
||||
if component.custom then
|
||||
section_components[#section_components + 1] =
|
||||
{ component_group.create(component.name, in_section), component_group.has_separator }
|
||||
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
|
||||
else
|
||||
local getter = component_group.get[component.name]
|
||||
|
||||
|
@ -1075,9 +1086,65 @@ local function config_paragraph(area, line)
|
|||
end
|
||||
|
||||
return {
|
||||
setup = function(_, config)
|
||||
setup = function(_, config, pre_theme)
|
||||
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" }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[manager]
|
||||
[mgr]
|
||||
show_hidden = true
|
||||
linemode = "size_and_mtime"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue