refactoring
This commit is contained in:
parent
74ae1150a3
commit
69400c1aa3
142 changed files with 11 additions and 70 deletions
22
modules/home/yazi/plugins/yatline-symlink.yazi/LICENSE
Normal file
22
modules/home/yazi/plugins/yatline-symlink.yazi/LICENSE
Normal file
|
@ -0,0 +1,22 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 imsi32
|
||||
Copyright (c) 2024 llanosrocas
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
39
modules/home/yazi/plugins/yatline-symlink.yazi/README.md
Normal file
39
modules/home/yazi/plugins/yatline-symlink.yazi/README.md
Normal file
|
@ -0,0 +1,39 @@
|
|||
# yatline-symlink.yazi
|
||||
|
||||
An addon to show symlink target in your [yatline.yazi](https://github.com/imsi32/yatline.yazi)'s status or header line.
|
||||
|
||||

|
||||
|
||||
## Requirements
|
||||
|
||||
- yazi version >= 0.3.0
|
||||
- [yatline.yazi](https://github.com/imsi32/yatline.yazi)
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
ya pack -a lpanebr/yazi-plugins:yatline-symlink
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Add this to your `~/.config/yazi/init.lua` after yatline.yazi's initialization.
|
||||
|
||||
```lua
|
||||
require("yatline-symlink"):setup()
|
||||
```
|
||||
|
||||
Then, add it in one of your sections in the yatline configuration using:
|
||||
|
||||
```lua
|
||||
{ type = "coloreds", custom = false, name = "symlink" }
|
||||
```
|
||||
|
||||
**Optional configuration:**
|
||||
|
||||
```lua
|
||||
require("githead"):setup({
|
||||
symlink_color = "white"
|
||||
}
|
||||
```
|
33
modules/home/yazi/plugins/yatline-symlink.yazi/main.lua
Normal file
33
modules/home/yazi/plugins/yatline-symlink.yazi/main.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
function hovered()
|
||||
local hovered = cx.active.current.hovered
|
||||
if hovered then
|
||||
return hovered
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local function setup(_, options)
|
||||
options = options or {}
|
||||
|
||||
local config = {
|
||||
symlink_color = options.symlink_color or "silver",
|
||||
}
|
||||
|
||||
if Yatline ~= nil then
|
||||
function Yatline.coloreds.get:symlink()
|
||||
local symlink = {}
|
||||
local linked = ""
|
||||
|
||||
local h = hovered()
|
||||
if h.link_to ~= nil then
|
||||
linked = " -> " .. tostring(h.link_to)
|
||||
end
|
||||
|
||||
table.insert(symlink, { linked, config.symlink_color })
|
||||
return symlink
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return { setup = setup }
|
Loading…
Add table
Add a link
Reference in a new issue