diff --git a/.config/nvim/lua/plugins/notify-config.lua b/.config/nvim/lua/plugins/notify-config.lua new file mode 100644 index 0000000..2c044a5 --- /dev/null +++ b/.config/nvim/lua/plugins/notify-config.lua @@ -0,0 +1,8 @@ +return { + "folke/snacks.nvim", + opts = { + notifier = { + timeout = 10000, + }, + }, +} diff --git a/.config/nvim/lua/plugins/snacks.lua b/.config/nvim/lua/plugins/snacks.lua index 813a2de..9e894d0 100644 --- a/.config/nvim/lua/plugins/snacks.lua +++ b/.config/nvim/lua/plugins/snacks.lua @@ -18,6 +18,35 @@ return { "**/.git", "**/.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 = { hidden = true, diff --git a/.local/bin/cat-md b/.local/bin/cat-md new file mode 100755 index 0000000..8e99e55 --- /dev/null +++ b/.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 \ No newline at end of file