initial dotfiles

This commit is contained in:
srtk 2026-04-25 16:39:11 +05:30
commit 45e5fe53d2
370 changed files with 25449 additions and 0 deletions

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 greg
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.

View file

@ -0,0 +1,18 @@
# mdcat.yazi
Preview markdown files in [yazi](https://github.com/sxyazi/yazi) with [mdcat](https://github.com/swsnr/mdcat).
Install this plugin with:
```bash
ya pack --add GrzegorzKozub/mdcat
```
Then set it up in your `yazi.toml` file by adding:
```toml
[plugin]
prepend_previewers = [
{ name = "*.md", run = "mdcat" },
]
```

View file

@ -0,0 +1,47 @@
local M = {}
function M:peek(job)
local child = Command('mdcat')
:args({
'--columns',
tostring(job.area.w),
tostring(job.file.url),
})
:stdout(Command.PIPED)
:stderr(Command.PIPED)
:spawn()
local count, lines = 0, ''
repeat
local line, event = child:read_line()
if event ~= 0 then
break
else
count = count + 1
if count > job.skip then
lines = lines .. line
end
end
until count >= job.skip + job.area.h
child:start_kill()
if job.skip > 0 and count < job.skip + job.area.h then
ya.manager_emit('peek', {
tostring(math.max(0, count - job.area.h)),
only_if = job.file.url,
upper_bound = '',
})
else
ya.preview_widgets(job, { ui.Text.parse(lines):area(job.area) })
end
end
function M:seek(job)
local h = cx.active.current.hovered
if h and h.url == job.file.url then
ya.manager_emit('peek', {
math.max(0, cx.active.preview.skip + job.units),
only_if = job.file.url,
})
end
end
return M