chodak166 2 weeks ago
parent
commit
0e1551dc61
  1. 8
      .config/nvim/lua/plugins/notify-config.lua
  2. 29
      .config/nvim/lua/plugins/snacks.lua
  3. 26
      .local/bin/cat-md

8
.config/nvim/lua/plugins/notify-config.lua

@ -0,0 +1,8 @@
return {
"folke/snacks.nvim",
opts = {
notifier = {
timeout = 10000,
},
},
}

29
.config/nvim/lua/plugins/snacks.lua

@ -18,6 +18,35 @@ return {
"**/.git", "**/.git",
"**/.DS_Store", "**/.DS_Store",
}, },
-- Yang paths from explorer - Y for relative, gy for absolute
win = {
list = {
keys = {
["Y"] = "copy_relative",
["gy"] = "copy_absolute",
},
},
},
actions = {
copy_absolute = function(_, item)
local path = item.file
vim.fn.setreg('"', path)
vim.fn.setreg("+", path)
Snacks.notify.info("Copied absolute path: " .. path)
end,
copy_relative = function(_, item)
local path = vim.fn.fnamemodify(item.file, ":.")
vim.fn.setreg('"', path)
vim.fn.setreg("+", path)
Snacks.notify.info("Copied relative path: " .. path)
end,
copy_filename = function(_, item)
local filename = vim.fn.fnamemodify(item.file, ":t")
vim.fn.setreg("+", filename)
vim.fn.setreg('"', filename)
vim.notify("Copied filename: " .. filename)
end,
},
}, },
files = { files = {
hidden = true, hidden = true,

26
.local/bin/cat-md

@ -0,0 +1,26 @@
#!/bin/bash
# Usage examples:
# ./cat-md file1.txt file2.txt # Output multiple files as markdown
# ./cat-md directory/ # Output all files in a directory
# ./cat-md file.txt | xclip -selection clipboard # Copy output to X11 clipboard
# ./cat-md file.txt | xsel --clipboard --input # Alternative using xsel
for path in "$@"; do
if [ -d "$path" ]; then
# If it's a directory, call ourselves with each file in it (non-recursively)
for file in "$path"/*; do
if [ -f "$file" ]; then
"$0" "$file"
fi
done
elif [ -f "$path" ]; then
# If it's a file, output the path and content
echo "$path:"
echo '```'
cat "$path"
echo
echo '```'
echo
fi
done
Loading…
Cancel
Save