diff --git a/nvim/.config/nvim/after/ftplugin/markdown.lua b/nvim/.config/nvim/after/ftplugin/markdown.lua index 19696ba..7f2c06f 100644 --- a/nvim/.config/nvim/after/ftplugin/markdown.lua +++ b/nvim/.config/nvim/after/ftplugin/markdown.lua @@ -5,7 +5,7 @@ if require("core.util").is_available("which-key") then require("which-key").register({ ["e"] = { name = "+criticmarkup" } }) end -if require("zk.util").notebook_root(vim.fn.expand("%:p")) ~= nil then +if require("core.util").is_available("zk") and require("zk.util").notebook_root(vim.fn.expand("%:p")) ~= nil then map("n", "", "lua vim.lsp.buf.definition()", { silent = true }) end @@ -22,11 +22,26 @@ map("n", "[c", "?^```n}:nohl", { desc = "previous code cell" }) map("n", "co", "o```python```k", { desc = "Insert quarto cell below" }) map("n", "cO", "O```python```k", { desc = "Insert quarto cell above" }) +if require("core.util").is_available("which-key") then + require("which-key").register({ ["p"] = { name = "+prose" } }) +end -- show nice md preview in browser (auto-syncs scrolling) -map("n", "cp", "MarkdownPreviewToggle", { desc = "show md preview" }) +if require("core.util").is_available("peek") then + local peek = require("peek") + local function togglePeek() + if peek.is_open() then + peek.close() + else + peek.open() + end + end + map("n", "pp", togglePeek, { desc = "show md preview" }) +else + map("n", "pp", "MarkdownPreviewToggle", { desc = "show md preview" }) +end -- create mindmaps directly from markdown! requires external executable if vim.fn.executable("markmap") then - map("n", "cm", "MarkmapOpen", { desc = "open md mindmap" }) - map("n", "cM", "MarkmapWatch", { desc = "watch for md mindmap" }) + map("n", "pm", "MarkmapOpen", { desc = "open md mindmap" }) + map("n", "pM", "MarkmapWatch", { desc = "watch for md mindmap" }) end diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 3b080d2..38cfcf4 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -35,10 +35,9 @@ "glance.nvim": { "branch": "master", "commit": "51059bcf21016387b6233c89eed220cf47fca752" }, "headlines.nvim": { "branch": "master", "commit": "618ef1b2502c565c82254ef7d5b04402194d9ce3" }, "image.nvim": { "branch": "master", "commit": "da64ce69598875c9af028afe129f916b02ccc42e" }, - "lazy.nvim": { "branch": "main", "commit": "b0ba3f9399bf48c86abaa4db1a40bd0b681d5018" }, + "lazy.nvim": { "branch": "main", "commit": "70f2c090d3ffb14f8702d468e05beb240b768881" }, "lsp-setup.nvim": { "branch": "main", "commit": "6e4e977512ce426d8b52c27f3b6e6aefc73e1452" }, "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, - "markdown-preview.nvim": { "branch": "master", "commit": "9becceee5740b7db6914da87358a183ad11b2049" }, "markmap.nvim": { "branch": "main", "commit": "5fb6755cf5434511cc23a4936c9eb76b9142fba5" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, @@ -54,7 +53,7 @@ "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, "nvim-coverage": { "branch": "main", "commit": "aa4b4400588e2259e87e372b1e4e90ae13cf5a39" }, "nvim-lint": { "branch": "master", "commit": "1a3a8d047bc01f1760ae4a0f5e80f111ea222e67" }, - "nvim-lspconfig": { "branch": "master", "commit": "d1ab6b6051976b04948e127b0f302a465b1394d6" }, + "nvim-lspconfig": { "branch": "master", "commit": "92166b89ab4b3d60f24e58170cac53b7141fd032" }, "nvim-nio": { "branch": "master", "commit": "8765cbc4d0c629c8158a5341e1b4305fd93c3a90" }, "nvim-surround": { "branch": "main", "commit": "f1f0699a1d49f28e607ffa4361f1bbe757ac5ebc" }, "nvim-toggleterm.lua": { "branch": "main", "commit": "066cccf48a43553a80a210eb3be89a15d789d6e6" }, @@ -67,6 +66,7 @@ "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" }, "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, "otter.nvim": { "branch": "main", "commit": "5cd161f28835fada50d99c89dc05041565a27bdb" }, + "peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" }, "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "quarto-nvim": { "branch": "main", "commit": "67e09027b5d8bd948907734fc6fb15028ffdcd28" }, @@ -75,7 +75,7 @@ "stickybuf.nvim": { "branch": "master", "commit": "2160fcd536d81f5fa43f7167dba6634e814e3154" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "trouble.nvim": { "branch": "main", "commit": "46a19388d3507f4c4bebb9994bf821a79b3bc342" }, + "trouble.nvim": { "branch": "main", "commit": "7a9c235806d4d9e2e74889f7e359f183a6d0e20d" }, "twilight.nvim": { "branch": "main", "commit": "8bb7fa7b918baab1ca81b977102ddb54afa63512" }, "undotree": { "branch": "main", "commit": "eab459ab87dd249617b5f7187bb69e614a083047" }, "vifm.vim": { "branch": "master", "commit": "a8130c37d144b51d84bee19f0532abcd3583383f" }, @@ -85,7 +85,7 @@ "vim-pandoc-syntax": { "branch": "master", "commit": "16939cda184ff555938cc895cc62477c172997f9" }, "vim-scimark": { "branch": "master", "commit": "9b66a88fa4bb87b8baab3c4aecc43b985b32e7fd" }, "vim-spellsync": { "branch": "master", "commit": "3d6dd50de9c4d953cc16638112a6ae196df41463" }, - "which-key.nvim": { "branch": "main", "commit": "4b7167f8fb2dba3d01980735e3509e172c024c29" }, + "which-key.nvim": { "branch": "main", "commit": "0539da005b98b02cf730c1d9da82b8e8edb1c2d2" }, "wrapping.nvim": { "branch": "master", "commit": "3a823200c297885b70515fa8d974e1763c578e26" }, "zen-mode.nvim": { "branch": "main", "commit": "cb73b8bd0ef9d765b942db09dc762c603a89ae44" }, "zk-nvim": { "branch": "main", "commit": "66b9b490e930fb77f93a2a0c64e0da9a5144fd0a" } diff --git a/nvim/.config/nvim/lua/plugins/config/lsp.lua b/nvim/.config/nvim/lua/plugins/config/lsp.lua index aa63460..e84244e 100644 --- a/nvim/.config/nvim/lua/plugins/config/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/config/lsp.lua @@ -70,7 +70,9 @@ local function on_attach(client, bufnr) { buffer = bufnr, desc = "Next error" } ) - require("which-key").register({ ["l"] = { name = "+language" } }) + if require("core.util").is_available("which-key") then + require("which-key").register({ ["l"] = { name = "+language" } }) + end map( "n", "ld", diff --git a/nvim/.config/nvim/lua/plugins/core.lua b/nvim/.config/nvim/lua/plugins/core.lua index 92414dc..5579dbd 100644 --- a/nvim/.config/nvim/lua/plugins/core.lua +++ b/nvim/.config/nvim/lua/plugins/core.lua @@ -107,6 +107,27 @@ return { }) require("mini.ai").setup() + -- Align tables and other alignable things + require("mini.align").setup({}) + + require("mini.bracketed").setup({ + { + buffer = { suffix = "b", options = {} }, + comment = { suffix = "c", options = {} }, + conflict = { suffix = "", options = {} }, + diagnostic = { suffix = "d", options = {} }, + file = { suffix = "f", options = {} }, + indent = { suffix = "", options = {} }, -- disable since we use indentscope above + jump = { suffix = "j", options = {} }, + location = { suffix = "l", options = {} }, + oldfile = { suffix = "o", options = {} }, + quickfix = { suffix = "q", options = {} }, + treesitter = { suffix = "t", options = {} }, + undo = { suffix = "", options = {} }, -- disable since I don't need it + window = { suffix = "w", options = {} }, + yank = { suffix = "y", options = {} }, + }, + }) require("mini.comment").setup({ hooks = { pre = function() @@ -117,9 +138,19 @@ return { end, }, }) + require("mini.cursorword").setup({ delay = 500 }) vim.api.nvim_set_hl(0, "MiniCursorword", { bold = true, underline = false }) vim.api.nvim_set_hl(0, "MiniCursorwordCurrent", { bold = true, underline = false }) + + require("mini.files").setup() + vim.api.nvim_create_autocmd("User", { + pattern = "MiniFilesWindowUpdate", + callback = function(args) + vim.wo[args.data.win_id].number = true + end, + }) + require("mini.fuzzy").setup() require("mini.indentscope").setup({ symbol = "│", @@ -148,24 +179,6 @@ return { starter.gen_hook.aligning("center", "center"), }, }) - require("mini.bracketed").setup({ - { - buffer = { suffix = "b", options = {} }, - comment = { suffix = "c", options = {} }, - conflict = { suffix = "", options = {} }, - diagnostic = { suffix = "d", options = {} }, - file = { suffix = "f", options = {} }, - indent = { suffix = "", options = {} }, -- disable since we use indentscope above - jump = { suffix = "j", options = {} }, - location = { suffix = "l", options = {} }, - oldfile = { suffix = "o", options = {} }, - quickfix = { suffix = "q", options = {} }, - treesitter = { suffix = "t", options = {} }, - undo = { suffix = "", options = {} }, -- disable since I don't need it - window = { suffix = "w", options = {} }, - yank = { suffix = "y", options = {} }, - }, - }) end, event = "VimEnter", -- need to load pretty soon for Starter screen keys = { @@ -174,14 +187,16 @@ return { function() require("mini.map").toggle() end, - silent = true, desc = "minimap" , + silent = true, + desc = "minimap", }, { "ss", function() require("mini.starter").open() end, - silent = true, desc = "startpage" , + silent = true, + desc = "startpage", }, { "w", @@ -190,6 +205,16 @@ return { end, desc = "Trim trailing whitespace", }, + { + "e", + function() + local mf = require("mini.files") + if not mf.close() then + mf.open() + end + end, + desc = "floating file browser", + }, }, }, -- try to avoid putting files in util buffers, e.g. filetree, aerial, undotree, .. diff --git a/nvim/.config/nvim/lua/plugins/editing.lua b/nvim/.config/nvim/lua/plugins/editing.lua index 6c41211..d926dc0 100644 --- a/nvim/.config/nvim/lua/plugins/editing.lua +++ b/nvim/.config/nvim/lua/plugins/editing.lua @@ -1,15 +1,6 @@ return { - -- Align tables and other alignable things - { - "junegunn/vim-easy-align", - event = "InsertEnter", - keys = { - { "ga", "(EasyAlign)", mode = "n" }, - { "ga", "(EasyAlign)", mode = "x" }, - }, - }, -- surround things with other things using ys/cs/ds - { "kylechui/nvim-surround", config = true, event = "InsertEnter" }, + { "kylechui/nvim-surround", config = true, event = "VeryLazy" }, -- extend the ^a / ^x possibilities to dates, hex, alphabets, markdown headers { diff --git a/nvim/.config/nvim/lua/plugins/filebrowsers.lua b/nvim/.config/nvim/lua/plugins/filebrowsers.lua index 411f81b..b26f4c8 100644 --- a/nvim/.config/nvim/lua/plugins/filebrowsers.lua +++ b/nvim/.config/nvim/lua/plugins/filebrowsers.lua @@ -9,9 +9,8 @@ return { end, cmd = "Vifm", keys = { - { "e", "Vifm", desc = "browse files" }, - { "E", ":Vifm getcwd()", desc = "browse project" }, - { "vc", ":Vifm " .. vim.fn.stdpath("config") .. "/lua", desc = "open config" }, + { "E", "Vifm", desc = "buffer file browser" }, + { "vc", ":Vifm " .. vim.fn.stdpath("config") .. "", desc = "open config" }, }, event = { "BufEnter" }, }, -- integrate file manager diff --git a/nvim/.config/nvim/lua/plugins/git.lua b/nvim/.config/nvim/lua/plugins/git.lua index b5414d1..cc24131 100644 --- a/nvim/.config/nvim/lua/plugins/git.lua +++ b/nvim/.config/nvim/lua/plugins/git.lua @@ -55,7 +55,9 @@ return { end, { expr = true, desc = "Previous git hunk" }) -- Actions - require("which-key").register({ ["h"] = { name = "+git" } }) + if require("core.util").is_available("which-key") then + require("which-key").register({ ["h"] = { name = "+git" } }) + end map({ "n", "v" }, "hs", ":Gitsigns stage_hunk", { desc = "stage hunk" }) map({ "n", "v" }, "hr", ":Gitsigns reset_hunk", { desc = "reset hunk" }) map("n", "hS", gs.stage_buffer, { desc = "stage buffer" }) diff --git a/nvim/.config/nvim/lua/plugins/ide.lua b/nvim/.config/nvim/lua/plugins/ide.lua index c13ff31..21dec00 100644 --- a/nvim/.config/nvim/lua/plugins/ide.lua +++ b/nvim/.config/nvim/lua/plugins/ide.lua @@ -235,13 +235,10 @@ return { opts = {}, cmd = { "Trouble", - "TroubleRefresh", - "TroubleToggle", - "TroubleClose", }, keys = { - { "sd", "Trouble workspace_diagnostics", silent = true, desc = "diagnostics workspace" }, - { "sD", "Trouble document_diagnostics", silent = true, desc = "diagnostics document" }, + { "sd", "Trouble diagnostics toggle", silent = true, desc = "diagnostics workspace" }, + { "sD", "Trouble diagnostics toggle filter.buf=0", silent = true, desc = "diagnostics document" }, }, }, diff --git a/nvim/.config/nvim/lua/plugins/prose.lua b/nvim/.config/nvim/lua/plugins/prose.lua index 29b60c6..7caadba 100644 --- a/nvim/.config/nvim/lua/plugins/prose.lua +++ b/nvim/.config/nvim/lua/plugins/prose.lua @@ -8,7 +8,7 @@ local prose_plugs = { config = true, cmd = { "ZenMode" }, dependencies = { "folke/twilight.nvim" }, - keys = { { "sz", ":ZenMode", { silent = true } } }, + keys = { { "sz", ":ZenMode", silent = true, desc = "toggle zen mode" } }, }, { "andrewferrier/wrapping.nvim", @@ -48,8 +48,21 @@ local prose_plugs = { ft = writing_ft, }, -- generate an auto-updating html preview for md files + -- uses the very nice peek if deno is available, otherwise falls back to markdown-preview + { + "toppair/peek.nvim", + event = { "VeryLazy" }, + cond = vim.fn.executable("deno") == 1, + build = "deno task --quiet build:fast", + config = function() + require("peek").setup() + vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {}) + vim.api.nvim_create_user_command("PeekClose", require("peek").close, {}) + end, + }, { "iamcco/markdown-preview.nvim", + cond = vim.fn.executable("deno") == 0, build = function() vim.fn["mkdp#util#install"]() end, diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua index 08fa63c..a32bf82 100644 --- a/nvim/.config/nvim/lua/plugins/telescope.lua +++ b/nvim/.config/nvim/lua/plugins/telescope.lua @@ -36,6 +36,11 @@ return { prompt_prefix = "󰍉 ", selection_caret = "󰳟 ", color_devicons = true, + mappings = { + -- FIXME Find way to only invoke this *IF* trouble plugin is found + i = { [""] = require("trouble.sources.telescope").open }, + n = { [""] = require("trouble.sources.telescope").open }, + } }, pickers = { buffers = { theme = "ivy" },