yazi: update & niri: minor adjustments
This commit is contained in:
@@ -335,7 +335,7 @@ binds {
|
|||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
Mod+V { spawn-sh "pkill -x rofi || rofi-cliphist"; }
|
Mod+V { spawn-sh "pkill -x rofi || rofi-cliphist"; }
|
||||||
Mod+Period { spawn "pkill -x rofi || rofi-emoji"; }
|
Mod+Period { spawn-sh "pkill -x rofi || rofi-emoji"; }
|
||||||
Ctrl+Alt+Delete { spawn "pkill -x wlogout || wlogout -p layer-shell"; }
|
Ctrl+Alt+Delete { spawn "pkill -x wlogout || wlogout -p layer-shell"; }
|
||||||
Print { spawn "screenshot-script" "full"; }
|
Print { spawn "screenshot-script" "full"; }
|
||||||
Mod+Shift+S { spawn "screenshot-script" "area"; }
|
Mod+Shift+S { spawn "screenshot-script" "area"; }
|
||||||
@@ -451,8 +451,6 @@ binds {
|
|||||||
Mod+Alt+Space { toggle-window-floating; }
|
Mod+Alt+Space { toggle-window-floating; }
|
||||||
Alt+Tab { switch-focus-between-floating-and-tiling; }
|
Alt+Tab { switch-focus-between-floating-and-tiling; }
|
||||||
|
|
||||||
Mod+Ctrl+W { toggle-column-tabbed-display; }
|
|
||||||
|
|
||||||
Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; }
|
Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; }
|
||||||
|
|
||||||
Mod+M allow-inhibiting=false { quit; }
|
Mod+M allow-inhibiting=false { quit; }
|
||||||
|
|||||||
1
config/shell/.config/fish/post.d/.gitignore
vendored
1
config/shell/.config/fish/post.d/.gitignore
vendored
@@ -1,6 +1,5 @@
|
|||||||
*
|
*
|
||||||
!.gitignore
|
!.gitignore
|
||||||
!fetch.fish
|
!fetch.fish
|
||||||
!fetch.fish.template
|
|
||||||
!sshs.fish
|
!sshs.fish
|
||||||
!alias.fish
|
!alias.fish
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
[[plugin.deps]]
|
[[plugin.deps]]
|
||||||
use = "yazi-rs/plugins:git"
|
use = "yazi-rs/plugins:git"
|
||||||
rev = "d1c8baa"
|
rev = "2301ff8"
|
||||||
hash = "63b6c222bf2103b3023389dde5e2ecfe"
|
hash = "27ca02f49fd236b5cc7bf03c243859fe"
|
||||||
|
|
||||||
[[plugin.deps]]
|
[[plugin.deps]]
|
||||||
use = "yazi-rs/plugins:smart-enter"
|
use = "yazi-rs/plugins:smart-enter"
|
||||||
rev = "d1c8baa"
|
rev = "2301ff8"
|
||||||
hash = "56fdabc96fc1f4d53c96eb884b02a5be"
|
hash = "56fdabc96fc1f4d53c96eb884b02a5be"
|
||||||
|
|
||||||
[[plugin.deps]]
|
[[plugin.deps]]
|
||||||
@@ -20,8 +20,8 @@ hash = "e17c11b605d989568a1d1741ca17c584"
|
|||||||
|
|
||||||
[[plugin.deps]]
|
[[plugin.deps]]
|
||||||
use = "llanosrocas/yaziline"
|
use = "llanosrocas/yaziline"
|
||||||
rev = "e79b067"
|
rev = "e7042a8"
|
||||||
hash = "f590c5b7d0730e8d6023b1b34ddf7ead"
|
hash = "9c2ab18ff5368056904e4ebb61b17571"
|
||||||
|
|
||||||
[flavor]
|
[flavor]
|
||||||
deps = []
|
deps = []
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ local function setup(st, opts)
|
|||||||
|
|
||||||
Linemode:children_add(function(self)
|
Linemode:children_add(function(self)
|
||||||
local url = self._file.url
|
local url = self._file.url
|
||||||
local repo = st.dirs[tostring(url.base)]
|
local repo = st.dirs[tostring(url.base or url.parent)]
|
||||||
local code
|
local code
|
||||||
if repo then
|
if repo then
|
||||||
code = repo == CODES.excluded and CODES.ignored or st.repos[repo][tostring(url):sub(#repo + 2)]
|
code = repo == CODES.excluded and CODES.ignored or st.repos[repo][tostring(url):sub(#repo + 2)]
|
||||||
@@ -208,7 +208,7 @@ end
|
|||||||
|
|
||||||
---@type UnstableFetcher
|
---@type UnstableFetcher
|
||||||
local function fetch(_, job)
|
local function fetch(_, job)
|
||||||
local cwd = job.files[1].url.base
|
local cwd = job.files[1].url.base or job.files[1].url.parent
|
||||||
local repo = root(cwd)
|
local repo = root(cwd)
|
||||||
if not repo then
|
if not repo then
|
||||||
remove(tostring(cwd))
|
remove(tostring(cwd))
|
||||||
|
|||||||
@@ -2,37 +2,59 @@
|
|||||||
|
|
||||||
Simple lualine-like status line for yazi.
|
Simple lualine-like status line for yazi.
|
||||||
|
|
||||||
Read more about features and configuration [here](#features).
|

|
||||||
|

|
||||||
|
|
||||||

|
All supported features are listed [here](#features). More presets are available [here](#presets).
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- yazi version >= [25.5.28](https://github.com/sxyazi/yazi/releases/tag/v25.5.28)
|
- yazi version >= [917e1f5](https://github.com/sxyazi/yazi/commit/917e1f54a10445f2e25147c4b81a3c77d8233632)
|
||||||
- Font with symbol support. For example [Nerd Fonts](https://www.nerdfonts.com/).
|
- Font with symbol support. For example [Nerd Fonts](https://www.nerdfonts.com/).
|
||||||
|
|
||||||
|
## Compatibility
|
||||||
|
|
||||||
|
To keep the plugin up to date, there are two branches: `main` and `nightly`.
|
||||||
|
The `main` branch follows major yazi releases, while `nightly` is linked to specific yazi commits or changes.
|
||||||
|
|
||||||
|
This setup allows shipping stable versions on time, while giving early access to "cutting-edge" changes. See matrix below.
|
||||||
|
|
||||||
|
<details close>
|
||||||
|
<summary>Compatibility matrix</summary>
|
||||||
|
|
||||||
|
| yaziline | yazi |
|
||||||
|
| :------------------------------------------------------------------------: | ----------------------------------------------------------------------------------------- |
|
||||||
|
| [v2.5.2](https://github.com/llanosrocas/yaziline.yazi/releases/tag/v2.5.2) | [917e1f5](https://github.com/sxyazi/yazi/commit/917e1f54a10445f2e25147c4b81a3c77d8233632) |
|
||||||
|
| [v2.5.1](https://github.com/llanosrocas/yaziline.yazi/releases/tag/v2.5.1) | [917e1f5](https://github.com/sxyazi/yazi/commit/917e1f54a10445f2e25147c4b81a3c77d8233632) |
|
||||||
|
| [v2.5.0](https://github.com/llanosrocas/yaziline.yazi/releases/tag/v2.5.0) | [v25.5.28](https://github.com/sxyazi/yazi/releases/tag/v25.5.28) |
|
||||||
|
| [v2.4.0](https://github.com/llanosrocas/yaziline.yazi/releases/tag/v2.4.0) | [v25.4.8](https://github.com/sxyazi/yazi/releases/tag/v25.4.8) |
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
1. Using yazi package manager
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ya pkg add llanosrocas/yaziline
|
ya pkg add llanosrocas/yaziline
|
||||||
```
|
```
|
||||||
|
|
||||||
Or manually copy `main.lua` to the `~/.config/yazi/plugins/yaziline.yazi/main.lua`
|
_Or manually copy `main.lua` to the `~/.config/yazi/plugins/yaziline.yazi/main.lua`_
|
||||||
|
|
||||||
## Usage
|
2. Add this line to your `~/.config/yazi/init.lua`:
|
||||||
|
|
||||||
Add this to your `~/.config/yazi/init.lua`:
|
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
require("yaziline"):setup()
|
require("yaziline"):setup()
|
||||||
```
|
```
|
||||||
|
|
||||||
Optionally, configure line:
|
## Configuration
|
||||||
|
|
||||||
|
This is default config, if you want to see presets go to [this section](#presets).
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
require("yaziline"):setup({
|
require("yaziline"):setup({
|
||||||
color = "#98c379", -- main theme color
|
color = "#98c379",
|
||||||
secondary_color = "#5A6078", -- secondary color
|
secondary_color = "#5A6078",
|
||||||
default_files_color = "darkgray", -- color of the file counter when it's inactive
|
default_files_color = "darkgray", -- color of the file counter when it's inactive
|
||||||
selected_files_color = "white",
|
selected_files_color = "white",
|
||||||
yanked_files_color = "green",
|
yanked_files_color = "green",
|
||||||
@@ -51,10 +73,18 @@ require("yaziline"):setup({
|
|||||||
|
|
||||||
filename_max_length = 24, -- truncate when filename > 24
|
filename_max_length = 24, -- truncate when filename > 24
|
||||||
filename_truncate_length = 6, -- leave 6 chars on both sides
|
filename_truncate_length = 6, -- leave 6 chars on both sides
|
||||||
filename_truncate_separator = "..." -- the separator of the truncated filename
|
filename_truncate_separator = "..."
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
By default yaziline uses color values from your `theme.toml`:
|
||||||
|
|
||||||
|
- mode and position font color: th.which.mask.bg
|
||||||
|
- default_files_color: which.separator_style.fg
|
||||||
|
- selected_files_color: mgr.count_selected.bg
|
||||||
|
- yanked_files_color: mgr.count_copied.bg
|
||||||
|
- cut_files_color: mgr.count_cut.bg
|
||||||
|
|
||||||
```
|
```
|
||||||
MODE size long_file...name.md S 0 Y 0
|
MODE size long_file...name.md S 0 Y 0
|
||||||
| | | | | | | | |
|
| | | | | | | | |
|
||||||
@@ -71,73 +101,16 @@ require("yaziline"):setup({
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
### Preconfigured separators
|
### Presets
|
||||||
|
|
||||||
Choose your style:
|
|
||||||
|
|
||||||
- `angly`
|
- `angly`
|
||||||

|

|
||||||
- `curvy`
|
- `curvy`
|
||||||

|

|
||||||
- `liney`
|
- `liney`
|
||||||

|

|
||||||
- `empty`
|
- `empty`
|
||||||

|

|
||||||
|
|
||||||
### Separator customization
|
|
||||||
|
|
||||||
You can provide your own symbols for separators combined with preconfigured separators. For example:
|
|
||||||
|
|
||||||
```lua
|
|
||||||
require("yaziline"):setup({
|
|
||||||
-- Optinal config
|
|
||||||
separator_style = "angly", -- preconfigured style
|
|
||||||
separator_open = "", -- instead of
|
|
||||||
separator_close = "", -- instead of
|
|
||||||
separator_open_thin = "", -- change to anything
|
|
||||||
separator_close_thin = "", -- change to anything
|
|
||||||
separator_head = "", -- to match the style
|
|
||||||
separator_tail = "" -- to match the style
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
_You can find more symbols [here](https://www.nerdfonts.com/cheat-sheet)_
|
|
||||||
|
|
||||||
### File actions icons
|
|
||||||
|
|
||||||
You can provide your own symbols for `select` and `yank`. For example:
|
|
||||||
|
|
||||||
```lua
|
|
||||||
require("yaziline"):setup({
|
|
||||||
-- Optinal config
|
|
||||||
select_symbol = "", -- "S" by default
|
|
||||||
yank_symbol = "" -- "Y" by default
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
_You can find more symbols [here](https://www.nerdfonts.com/cheat-sheet)_
|
|
||||||
|
|
||||||
### Colors and font weight
|
|
||||||
|
|
||||||
By default yaziline uses color values from your `theme.toml` (or flavor) but you can set custom colors in the `init.lua`:
|
|
||||||
|
|
||||||
```lua
|
|
||||||
require("yaziline"):setup({
|
|
||||||
color = "#98c379",
|
|
||||||
default_files_color = "darkgray",
|
|
||||||
selected_files_color = "white",
|
|
||||||
yanked_files_color = "green",
|
|
||||||
cut_files_color = "red",
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
For example, here is how my line looks like:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Selected and Yanked Counter
|
### Selected and Yanked Counter
|
||||||
|
|
||||||
@@ -149,9 +122,9 @@ Displays the truncated filename on the left, which is useful for smaller windows
|
|||||||
|
|
||||||
```lua
|
```lua
|
||||||
require("yaziline"):setup({
|
require("yaziline"):setup({
|
||||||
filename_max_length = 24, -- truncate when filename > 24
|
filename_max_length = 24,
|
||||||
filename_truncate_length = 6, -- leave 6 chars on both sides
|
filename_truncate_length = 6,
|
||||||
filename_truncate_separator = "..." -- the separator of the truncated filename
|
filename_truncate_separator = "..."
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,212 +1,212 @@
|
|||||||
---@diagnostic disable: undefined-global
|
---@diagnostic disable: undefined-global
|
||||||
|
|
||||||
local function setup(_, options)
|
local function setup(_, options)
|
||||||
options = options or {}
|
options = options or {}
|
||||||
|
|
||||||
local default_separators = {
|
local default_separators = {
|
||||||
angly = { "", "", "", "" },
|
angly = { "", "", "", "" },
|
||||||
curvy = { "", "", "", "" },
|
curvy = { "", "", "", "" },
|
||||||
liney = { "", "", "|", "|" },
|
liney = { "", "", "|", "|" },
|
||||||
empty = { "", "", "", "" },
|
empty = { "", "", "", "" },
|
||||||
}
|
}
|
||||||
local separators = default_separators[options.separator_style or "angly"]
|
local separators = default_separators[options.separator_style or "angly"]
|
||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
separator_styles = {
|
separator_styles = {
|
||||||
separator_open = options.separator_open or separators[1],
|
separator_open = options.separator_open or separators[1],
|
||||||
separator_close = options.separator_close or separators[2],
|
separator_close = options.separator_close or separators[2],
|
||||||
separator_open_thin = options.separator_open_thin or separators[3],
|
separator_open_thin = options.separator_open_thin or separators[3],
|
||||||
separator_close_thin = options.separator_close_thin or separators[4],
|
separator_close_thin = options.separator_close_thin or separators[4],
|
||||||
separator_head = options.separator_head or "",
|
separator_head = options.separator_head or "",
|
||||||
separator_tail = options.separator_tail or "",
|
separator_tail = options.separator_tail or "",
|
||||||
},
|
},
|
||||||
select_symbol = options.select_symbol or "S",
|
select_symbol = options.select_symbol or "S",
|
||||||
yank_symbol = options.yank_symbol or "Y",
|
yank_symbol = options.yank_symbol or "Y",
|
||||||
|
|
||||||
filename_max_length = options.filename_max_length or 24,
|
filename_max_length = options.filename_max_length or 24,
|
||||||
filename_truncate_length = options.filename_truncate_length or 6,
|
filename_truncate_length = options.filename_truncate_length or 6,
|
||||||
filename_truncate_separator = options.filename_truncate_separator or "...",
|
filename_truncate_separator = options.filename_truncate_separator or "...",
|
||||||
|
|
||||||
color = options.color or nil,
|
color = options.color or nil,
|
||||||
secondary_color = options.secondary_color or nil,
|
secondary_color = options.secondary_color or nil,
|
||||||
default_files_color = options.default_files_color
|
default_files_color = options.default_files_color
|
||||||
or th.which.separator_style.fg
|
or th.which.separator_style:fg()
|
||||||
or "darkgray",
|
or "darkgray",
|
||||||
selected_files_color = options.selected_files_color
|
selected_files_color = options.selected_files_color
|
||||||
or th.mgr.count_selected.bg
|
or th.mgr.count_selected:bg()
|
||||||
or "white",
|
or "white",
|
||||||
yanked_files_color = options.selected_files_color
|
yanked_files_color = options.selected_files_color
|
||||||
or th.mgr.count_copied.bg
|
or th.mgr.count_copied:bg()
|
||||||
or "green",
|
or "green",
|
||||||
cut_files_color = options.cut_files_color
|
cut_files_color = options.cut_files_color
|
||||||
or th.mgr.count_cut.bg
|
or th.mgr.count_cut:bg()
|
||||||
or "red",
|
or "red",
|
||||||
}
|
}
|
||||||
|
|
||||||
local current_separator_style = config.separator_styles
|
local current_separator_style = config.separator_styles
|
||||||
|
|
||||||
function Header:count()
|
function Header:count()
|
||||||
return ui.Line({})
|
return ui.Line({})
|
||||||
end
|
end
|
||||||
|
|
||||||
function Status:mode()
|
function Status:mode()
|
||||||
local mode = tostring(self._tab.mode):upper()
|
local mode = tostring(self._tab.mode):upper()
|
||||||
|
|
||||||
local style = self:style()
|
local style = self:style()
|
||||||
return ui.Line({
|
return ui.Line({
|
||||||
ui.Span(current_separator_style.separator_head)
|
ui.Span(current_separator_style.separator_head)
|
||||||
:fg(config.color or style.main.bg),
|
:fg(config.color or style.main:bg()),
|
||||||
ui.Span(" " .. mode .. " ")
|
ui.Span(" " .. mode .. " ")
|
||||||
:fg(th.which.mask.bg)
|
:fg(th.which.mask:bg())
|
||||||
:bg(config.color or style.main.bg),
|
:bg(config.color or style.main:bg()),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function Status:size()
|
function Status:size()
|
||||||
local h = self._current.hovered
|
local h = self._current.hovered
|
||||||
local size = h and (h:size() or h.cha.len) or 0
|
local size = h and (h:size() or h.cha.len) or 0
|
||||||
|
|
||||||
local style = self:style()
|
local style = self:style()
|
||||||
return ui.Span(current_separator_style.separator_close .. " " .. ya.readable_size(size) .. " ")
|
return ui.Span(current_separator_style.separator_close .. " " .. ya.readable_size(size) .. " ")
|
||||||
:fg(config.color or style.main.bg)
|
:fg(config.color or style.main:bg())
|
||||||
:bg(config.secondary_color or th.which.separator_style.fg)
|
:bg(config.secondary_color or th.which.separator_style:fg())
|
||||||
end
|
end
|
||||||
|
|
||||||
function Status:utf8_sub(str, start_char, end_char)
|
function Status:utf8_sub(str, start_char, end_char)
|
||||||
local start_byte = utf8.offset(str, start_char)
|
local start_byte = utf8.offset(str, start_char)
|
||||||
local end_byte = end_char and (utf8.offset(str, end_char + 1) - 1) or #str
|
local end_byte = end_char and (utf8.offset(str, end_char + 1) - 1) or #str
|
||||||
|
|
||||||
if not start_byte or not end_byte then
|
if not start_byte or not end_byte then
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
return string.sub(str, start_byte, end_byte)
|
return string.sub(str, start_byte, end_byte)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Status:truncate_name(filename, max_length)
|
function Status:truncate_name(filename, max_length)
|
||||||
local base_name, extension = filename:match("^(.+)(%.[^%.]+)$")
|
local base_name, extension = filename:match("^(.+)(%.[^%.]+)$")
|
||||||
base_name = base_name or filename
|
base_name = base_name or filename
|
||||||
extension = extension or ""
|
extension = extension or ""
|
||||||
|
|
||||||
if utf8.len(base_name) > max_length then
|
if utf8.len(base_name) > max_length then
|
||||||
base_name = self:utf8_sub(base_name, 1, config.filename_truncate_length)
|
base_name = self:utf8_sub(base_name, 1, config.filename_truncate_length)
|
||||||
.. config.filename_truncate_separator
|
.. config.filename_truncate_separator
|
||||||
.. self:utf8_sub(base_name, -config.filename_truncate_length)
|
.. self:utf8_sub(base_name, -config.filename_truncate_length)
|
||||||
end
|
end
|
||||||
|
|
||||||
return base_name .. extension
|
return base_name .. extension
|
||||||
end
|
end
|
||||||
|
|
||||||
function Status:name()
|
function Status:name()
|
||||||
local h = self._current.hovered
|
local h = self._current.hovered
|
||||||
if not h then
|
local style = self:style()
|
||||||
return ui.Line({
|
if not h then
|
||||||
ui.Span(current_separator_style.separator_close .. " ")
|
return ui.Line({
|
||||||
:fg(config.secondary_color or th.which.separator_style.fg),
|
ui.Span(current_separator_style.separator_close .. " ")
|
||||||
ui.Span("Empty dir")
|
:fg(config.secondary_color or th.which.separator_style:fg()),
|
||||||
:fg(config.color or style.main.bg),
|
ui.Span("Empty dir")
|
||||||
})
|
:fg(config.color or style.main:bg()),
|
||||||
end
|
})
|
||||||
|
end
|
||||||
|
|
||||||
local truncated_name = self:truncate_name(h.name, config.filename_max_length)
|
local truncated_name = self:truncate_name(h.name, config.filename_max_length)
|
||||||
|
|
||||||
local style = self:style()
|
return ui.Line({
|
||||||
return ui.Line({
|
ui.Span(current_separator_style.separator_close .. " ")
|
||||||
ui.Span(current_separator_style.separator_close .. " ")
|
:fg(config.secondary_color or th.which.separator_style:fg()),
|
||||||
:fg(config.secondary_color or th.which.separator_style.fg),
|
ui.Span(truncated_name)
|
||||||
ui.Span(truncated_name)
|
:fg(config.color or style.main:bg()),
|
||||||
:fg(config.color or style.main.bg),
|
})
|
||||||
})
|
end
|
||||||
end
|
|
||||||
|
|
||||||
function Status:files()
|
function Status:files()
|
||||||
local files_yanked = #cx.yanked
|
local files_yanked = #cx.yanked
|
||||||
local files_selected = #cx.active.selected
|
local files_selected = #cx.active.selected
|
||||||
local files_cut = cx.yanked.is_cut
|
local files_cut = cx.yanked.is_cut
|
||||||
|
|
||||||
local selected_fg = files_selected > 0
|
local selected_fg = files_selected > 0
|
||||||
and config.selected_files_color
|
and config.selected_files_color
|
||||||
or config.default_files_color
|
or config.default_files_color
|
||||||
local yanked_fg = files_yanked > 0
|
local yanked_fg = files_yanked > 0
|
||||||
and
|
and
|
||||||
(files_cut
|
(files_cut
|
||||||
and config.cut_files_color
|
and config.cut_files_color
|
||||||
or config.yanked_files_color
|
or config.yanked_files_color
|
||||||
)
|
)
|
||||||
or config.default_files_color
|
or config.default_files_color
|
||||||
|
|
||||||
local yanked_text = files_yanked > 0
|
local yanked_text = files_yanked > 0
|
||||||
and config.yank_symbol .. " " .. files_yanked
|
and config.yank_symbol .. " " .. files_yanked
|
||||||
or config.yank_symbol .. " 0"
|
or config.yank_symbol .. " 0"
|
||||||
|
|
||||||
return ui.Line({
|
return ui.Line({
|
||||||
ui.Span(" " .. current_separator_style.separator_close_thin .. " ")
|
ui.Span(" " .. current_separator_style.separator_close_thin .. " ")
|
||||||
:fg(th.which.separator_style.fg),
|
:fg(th.which.separator_style:fg()),
|
||||||
ui.Span(config.select_symbol .. " " .. files_selected .. " ")
|
ui.Span(config.select_symbol .. " " .. files_selected .. " ")
|
||||||
:fg(selected_fg),
|
:fg(selected_fg),
|
||||||
ui.Span(yanked_text .. " ")
|
ui.Span(yanked_text .. " ")
|
||||||
:fg(yanked_fg),
|
:fg(yanked_fg),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function Status:modified()
|
function Status:modified()
|
||||||
local hovered = cx.active.current.hovered
|
local hovered = cx.active.current.hovered
|
||||||
|
|
||||||
if not hovered then
|
if not hovered then
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
local cha = hovered.cha
|
local cha = hovered.cha
|
||||||
local time = (cha.mtime or 0) // 1
|
local time = (cha.mtime or 0) // 1
|
||||||
|
|
||||||
return ui.Span(os.date("%Y-%m-%d %H:%M", time) .. " " .. current_separator_style.separator_open_thin .. " ")
|
return ui.Span(os.date("%Y-%m-%d %H:%M", time) .. " " .. current_separator_style.separator_open_thin .. " ")
|
||||||
:fg(th.which.separator_style.fg)
|
:fg(th.which.separator_style:fg())
|
||||||
end
|
end
|
||||||
|
|
||||||
function Status:percent()
|
function Status:percent()
|
||||||
local percent = 0
|
local percent = 0
|
||||||
local cursor = self._tab.current.cursor
|
local cursor = self._tab.current.cursor
|
||||||
local length = #self._tab.current.files
|
local length = #self._tab.current.files
|
||||||
if cursor ~= 0 and length ~= 0 then
|
if cursor ~= 0 and length ~= 0 then
|
||||||
percent = math.floor((cursor + 1) * 100 / length)
|
percent = math.floor((cursor + 1) * 100 / length)
|
||||||
end
|
end
|
||||||
|
|
||||||
if percent == 0 then
|
if percent == 0 then
|
||||||
percent = " Top "
|
percent = " Top "
|
||||||
elseif percent == 100 then
|
elseif percent == 100 then
|
||||||
percent = " Bot "
|
percent = " Bot "
|
||||||
else
|
else
|
||||||
percent = string.format(" %2d%% ", percent)
|
percent = string.format(" %2d%% ", percent)
|
||||||
end
|
end
|
||||||
|
|
||||||
local style = self:style()
|
local style = self:style()
|
||||||
return ui.Line({
|
return ui.Line({
|
||||||
ui.Span(" " .. current_separator_style.separator_open)
|
ui.Span(" " .. current_separator_style.separator_open)
|
||||||
:fg(config.secondary_color or th.which.separator_style.fg),
|
:fg(config.secondary_color or th.which.separator_style:fg()),
|
||||||
ui.Span(percent)
|
ui.Span(percent)
|
||||||
:fg(config.color or style.main.bg)
|
:fg(config.color or style.main:bg())
|
||||||
:bg(config.secondary_color or th.which.separator_style.fg),
|
:bg(config.secondary_color or th.which.separator_style:fg()),
|
||||||
ui.Span(current_separator_style.separator_open)
|
ui.Span(current_separator_style.separator_open)
|
||||||
:fg(config.color or style.main.bg)
|
:fg(config.color or style.main:bg())
|
||||||
:bg(config.secondary_color or th.which.separator_style.fg),
|
:bg(config.secondary_color or th.which.separator_style:fg()),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function Status:position()
|
function Status:position()
|
||||||
local cursor = self._tab.current.cursor
|
local cursor = self._tab.current.cursor
|
||||||
local length = #self._tab.current.files
|
local length = #self._tab.current.files
|
||||||
|
|
||||||
local style = self:style()
|
local style = self:style()
|
||||||
return ui.Line({
|
return ui.Line({
|
||||||
ui.Span(string.format(" %2d/%-2d ", math.min(cursor + 1, length), length))
|
ui.Span(string.format(" %2d/%-2d ", math.min(cursor + 1, length), length))
|
||||||
:fg(th.which.mask.bg)
|
:fg(th.which.mask:bg())
|
||||||
:bg(config.color or style.main.bg),
|
:bg(config.color or style.main:bg()),
|
||||||
ui.Span(current_separator_style.separator_tail):fg(config.color or style.main.bg),
|
ui.Span(current_separator_style.separator_tail):fg(config.color or style.main:bg()),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
Status:children_add(Status.files, 4000, Status.LEFT)
|
Status:children_add(Status.files, 4000, Status.LEFT)
|
||||||
Status:children_add(Status.modified, 0, Status.RIGHT)
|
Status:children_add(Status.modified, 0, Status.RIGHT)
|
||||||
end
|
end
|
||||||
|
|
||||||
return { setup = setup }
|
return { setup = setup }
|
||||||
|
|||||||
Reference in New Issue
Block a user