diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore index cc5457a..6e87121 100644 --- a/.config/nvim/.gitignore +++ b/.config/nvim/.gitignore @@ -6,3 +6,4 @@ debug foo.* *.log data +zz_disabled.lua diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 93c9d87..992cba3 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,6 +1,6 @@ { - "LazyVim": { "branch": "main", "commit": "c10948c50b18fae7f256433afdef09e432410480" }, - "avante.nvim": { "branch": "main", "commit": "98bfe1c2a41d645e8d1cbc882aa1067e5f1b6cb0" }, + "LazyVim": { "branch": "main", "commit": "999700997f72227187d49d8b92667183dc7fc809" }, + "avante.nvim": { "branch": "main", "commit": "4f49656657d0e1b55a03c23510ccc1ef1eeaa9e9" }, "blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, "catppuccin": { "branch": "main", "commit": "edefef779ab08ce1a4a404713e3012b0d202bd35" }, @@ -9,34 +9,34 @@ "conform.nvim": { "branch": "master", "commit": "016802de402556da54c36bd7359b441266b01cdd" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "dotenv.nvim": { "branch": "main", "commit": "7d516e9293c6e3ac21830fb10a4e8674c02747c6" }, - "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "flash.nvim": { "branch": "main", "commit": "5f0f270fdc7c5b0c21d903ee85b9cb06f2ac636a" }, - "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, - "gitsigns.nvim": { "branch": "main", "commit": "5be654f2232c10ddcad19c1607a67b6b4b78fc29" }, + "friendly-snippets": { "branch": "main", "commit": "b4d01b0fdf3c9a549961c2f9ffe8dc09be166219" }, + "gitsigns.nvim": { "branch": "main", "commit": "851a051e2bd2caba97e23314c68d69f1b1cf5d19" }, "grug-far.nvim": { "branch": "main", "commit": "11595bf747edc270bce2069d1020502ad4ae56cf" }, "hybrid-theme": { "branch": "main", "commit": "626ae5426a7c8f21dfccce286c690d9cf4195b46" }, - "indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" }, + "image.nvim": { "branch": "master", "commit": "365e2ace0f619164ae6fd2f6f1d2807775dd6849" }, + "indent-blankline.nvim": { "branch": "master", "commit": "f1e186e44d3b7f9ae918008e2c28ce37c6023d2d" }, "just-runner.nvim": { "branch": "main", "commit": "f29d405aa828900df242600720a2b0e57261489f" }, "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, "lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" }, "lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "9d28935aa95fa6c1dc7c4d6747f101a72a8a4bec" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "e17625cdc8c2650787467398e02c5d63a2cde966" }, "mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" }, - "mini.ai": { "branch": "main", "commit": "25248c6aa002391936a6200f12d1466015987133" }, - "mini.files": { "branch": "main", "commit": "a249438d15fa6f64085ba83a9d1794d726aaf5ad" }, - "mini.icons": { "branch": "main", "commit": "98faae31e9be1cc054ae63485e58ceb185efcad0" }, + "mini.ai": { "branch": "main", "commit": "c2c4278beb759aa24b9506f56a67186a6cc2209c" }, + "mini.icons": { "branch": "main", "commit": "f642e3ba8c12afbc8f32f6d77ef6597eac56786f" }, "mini.pairs": { "branch": "main", "commit": "b1c5a726921b7a8c9321e9a7a208aa0571de5810" }, "noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" }, "nui.nvim": { "branch": "main", "commit": "10fc361835c856ba4233ef5ea135b919bf3dce97" }, "nvim-dev-container": { "branch": "main", "commit": "365b4c815339d42133829006dce3e5f8b182b771" }, - "nvim-lint": { "branch": "master", "commit": "0370fe965697aa8f04252a1562441bdc13723cd1" }, - "nvim-lspconfig": { "branch": "master", "commit": "221c43884319e791519f0d6c94a7f2fbcd653278" }, - "nvim-treesitter": { "branch": "main", "commit": "8b98b4470eb326f1c7b50dae79f8c963568e5720" }, - "nvim-treesitter-textobjects": { "branch": "main", "commit": "898ee307df58f854d11cd7edd06472574d48014e" }, - "nvim-ts-autotag": { "branch": "main", "commit": "88c1453db4ba7dd24131086fe51fdf74e587d275" }, + "nvim-lint": { "branch": "master", "commit": "f6230a5c06ba59e6059c14637f1dbe29a7978b9b" }, + "nvim-lspconfig": { "branch": "master", "commit": "c59fc922f718fa055f69f5f3bc888f23211571eb" }, + "nvim-navic": { "branch": "master", "commit": "455808fd0fae06e6d70fadfd61432275db8f34ce" }, + "nvim-treesitter": { "branch": "main", "commit": "1a4f47b03dfe92d28de7d5654c67327ef008c9e6" }, + "nvim-treesitter-textobjects": { "branch": "main", "commit": "5c7b0263797dfd1bd6202f2b219f3b53a80b2187" }, + "nvim-ts-autotag": { "branch": "main", "commit": "d7220b55e16ed3c04e88086256def5d282429493" }, "persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" }, "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, - "render-markdown.nvim": { "branch": "main", "commit": "4663eb3ecd538bd5062628fb6d95bbe6bdca78f6" }, + "render-markdown.nvim": { "branch": "main", "commit": "8e8795368391036643b622875a6da6a51bcd33f4" }, "snacks-terminal-ctl.nvim": { "branch": "master", "commit": "97727421c8d0ffa33d893f22e38cda93e9010742" }, "snacks.nvim": { "branch": "main", "commit": "882c996cf28183f4d63640de0b4c02ec886d01f2" }, "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, diff --git a/.config/nvim/lazyvim.json b/.config/nvim/lazyvim.json index d95a9a3..8005820 100644 --- a/.config/nvim/lazyvim.json +++ b/.config/nvim/lazyvim.json @@ -1,6 +1,5 @@ { "extras": [ - "lazyvim.plugins.extras.editor.mini-files" ], "install_version": 8, "news": { diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua index e7d69e0..140a120 100644 --- a/.config/nvim/lua/config/options.lua +++ b/.config/nvim/lua/config/options.lua @@ -25,6 +25,9 @@ vim.g.lazyvim_no_inlay_hints = true -- -- Enable list mode to show whitespace -- vim.opt.list = true +-- disable autoformatting not to generate large diffs: +vim.g.autoformat = false + -- Configure listchars to use dots (·) for spaces and tabs vim.opt.listchars = { tab = "· ", -- Dot for the first part of a tab, followed by space @@ -35,4 +38,5 @@ vim.opt.listchars = { -- eol = "↲", -- Symbol for end of line (optional) } - +-- Do not hide syntax makers (**, ``` etc) +vim.opt.conceallevel = 0 diff --git a/.config/nvim/lua/plugins/diffview.lua b/.config/nvim/lua/plugins/diffview.lua index 72f3109..e25df87 100644 --- a/.config/nvim/lua/plugins/diffview.lua +++ b/.config/nvim/lua/plugins/diffview.lua @@ -1 +1,35 @@ -return { "sindrets/diffview.nvim" } +return { + "sindrets/diffview.nvim", + cmd = { "DiffviewOpen", "DiffviewClose", "DiffviewToggleFiles", "DiffviewFocusFiles", "DiffviewFileHistory" }, + keys = { + { "gvv", "DiffviewOpen", desc = "Diffview Open" }, + { "gvq", "DiffviewClose", desc = "Diffview Close" }, + { "gvf", "DiffviewFileHistory %", desc = "Browse current file history" }, + { "gvr", "DiffviewFileHistory", desc = "Browse repo history" }, + { "gvh", "DiffviewOpen HEAD~1", desc = "Diff vs last commit" }, + { "gvm", "DiffviewOpen master...HEAD", desc = "Diff branch vs master" }, + }, + opts = { + enhanced_diff_hl = true, + view = { + merge_tool = { + layout = "diff3_mixed", + }, + }, + file_history_panel = { + log_options = { + git = { + all = false, + }, + }, + win_config = { + position = "bottom", + height = 16, + }, + }, + file_panel = { + listing_style = "tree", + win_config = { width = 35 }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/image.lua b/.config/nvim/lua/plugins/image.lua new file mode 100644 index 0000000..fb31b3f --- /dev/null +++ b/.config/nvim/lua/plugins/image.lua @@ -0,0 +1,7 @@ +return { + "3rd/image.nvim", + build = false, -- so that it doesn't build the rock https://github.com/3rd/image.nvim/issues/91#issuecomment-2453430239 + opts = { + processor = "magick_cli", + }, +} diff --git a/.config/nvim/lua/plugins/zz_disabled.lua b/.config/nvim/lua/plugins/zz_disabled.lua index a8ece32..bb2943b 100644 --- a/.config/nvim/lua/plugins/zz_disabled.lua +++ b/.config/nvim/lua/plugins/zz_disabled.lua @@ -6,6 +6,6 @@ -- config update-index --skip-worktree .config/nvim/lua/plugins/zz_disabled.lua return { - { "yetone/avante.nvim", enabled = true }, - { "p00f/clangd_extensions.nvim", enabled = true }, + { "yetone/avante.nvim", enabled = false }, + { "p00f/clangd_extensions.nvim", enabled = false }, } diff --git a/.local/bin/cat-md b/.local/bin/cat-md index 8e99e55..7ed7301 100755 --- a/.local/bin/cat-md +++ b/.local/bin/cat-md @@ -1,26 +1,130 @@ #!/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 +set -euo pipefail + +# --- Defaults --- +COPY=true +CLIP_CMD=() + +# --- Detect clipboard tool --- +detect_clipboard() { + # Pick the right tool for the session: + # wl-copy on Wayland, xclip/xsel on X11. Fall back to whatever exists. + if [[ "${XDG_SESSION_TYPE:-}" == "wayland" || -n "${WAYLAND_DISPLAY:-}" ]]; then + if command -v wl-copy &> /dev/null; then + CLIP_CMD=(wl-copy) + elif command -v xclip &> /dev/null; then + CLIP_CMD=(xclip -selection clipboard) + elif command -v xsel &> /dev/null; then + CLIP_CMD=(xsel --clipboard --input) + fi + else + if command -v xclip &> /dev/null; then + CLIP_CMD=(xclip -selection clipboard) + elif command -v xsel &> /dev/null; then + CLIP_CMD=(xsel --clipboard --input) + elif command -v wl-copy &> /dev/null; then + CLIP_CMD=(wl-copy) fi -done \ No newline at end of file + fi +} + +# --- Help --- +usage() { + cat << 'EOF' +cat-md — concatenate files as a Markdown code block, copy to clipboard. + +Usage: + cat-md [OPTIONS] [FILE|DIR]... + + Each file is printed as: + path/to/file: + ``` + + ``` + + Directories are expanded non-recursively (all files inside). + +Options: + -n, --no-copy Print to stdout only, skip clipboard copy + -h, --help Show this help and exit + +Examples: + cat-md file1.txt file2.txt + cat-md src/ + cat-md -n file.txt # no clipboard + cat-md -n file.txt | less # pipe manually + +Requirements (one of): + wl-copy — Wayland clipboard (from wl-clipboard) + xclip — X11 clipboard (preferred on X11) + xsel — alternative X11 clipboard tool +EOF + exit 0 +} + +# --- Parse arguments --- +ARGS=() +while [[ $# -gt 0 ]]; do + case "$1" in + -n | --no-copy) + COPY=false + shift + ;; + -h | --help) usage ;; + --) + shift + ARGS+=("$@") + break + ;; + -*) + echo "Unknown option: $1" >&2 + echo "Try -h for help." >&2 + exit 1 + ;; + *) + ARGS+=("$1") + shift + ;; + esac +done + +# --- Validate --- +if [[ ${#ARGS[@]} -eq 0 ]]; then + echo "Error: no files or directories provided. Try -h for help." >&2 + exit 1 +fi + +detect_clipboard + +if $COPY && [[ ${#CLIP_CMD[@]} -eq 0 ]]; then + echo "Warning: no clipboard tool found (tried wl-copy, xclip, xsel). Output will go to stdout only." >&2 + COPY=false +fi + +# --- Generate output --- +generate() { + for path in "$@"; do + if [[ -d "$path" ]]; then + for file in "$path"/*; do + if [[ -f "$file" ]]; then + generate "$file" + fi + done + elif [[ -f "$path" ]]; then + echo "$path:" + echo '```' + cat "$path" + echo + echo '```' + echo + fi + done +} + +if $COPY; then + generate "${ARGS[@]}" | "${CLIP_CMD[@]}" + echo "Copied to clipboard." >&2 +else + generate "${ARGS[@]}" +fi