diff --git a/.config/nvim/lua/plugins/accelerated-jk.lua b/.config/nvim/lua/plugins/accelerated-jk.lua index 7e02387..9af1ab9 100644 --- a/.config/nvim/lua/plugins/accelerated-jk.lua +++ b/.config/nvim/lua/plugins/accelerated-jk.lua @@ -1,7 +1,7 @@ -- speeds up vertical navigation with j and k return { { - "rhysd/accelerated-jk", + "rainbowhxch/accelerated-jk.nvim", keys = { { "j", "(accelerated_jk_gj)" }, { "k", "(accelerated_jk_gk)" }, diff --git a/.config/nvim/lua/plugins/conform.lua b/.config/nvim/lua/plugins/conform.lua index 3657262..4a9330b 100644 --- a/.config/nvim/lua/plugins/conform.lua +++ b/.config/nvim/lua/plugins/conform.lua @@ -20,6 +20,8 @@ return { python = { "ruff", "black" }, bash = { "shfmt" }, sh = { "shfmt" }, + snakemake = { "snakefmt" }, + markdown = { "markdownlint" }, }, formatters = { shfmt = { diff --git a/.config/nvim/lua/plugins/nvim-tree.lua b/.config/nvim/lua/plugins/nvim-tree.lua index 286adca..65959b9 100644 --- a/.config/nvim/lua/plugins/nvim-tree.lua +++ b/.config/nvim/lua/plugins/nvim-tree.lua @@ -6,7 +6,32 @@ return { -- don't lazy load; otherwise, opening a directory as first buffer doesn't trigger it. lazy = false, - config = true, + config = function() + require("nvim-tree").setup({ + on_attach = function(bufnr) + local api = require("nvim-tree.api") + + api.config.mappings.default_on_attach(bufnr) + + local function git_add() + local node = api.tree.get_node_under_cursor() + if node and node.absolute_path then + vim.cmd("Git add " .. vim.fn.fnameescape(node.absolute_path)) + api.tree.reload() + end + end + local function git_unstage() + local node = api.tree.get_node_under_cursor() + if node and node.absolute_path then + vim.cmd("Git restore --staged " .. vim.fn.fnameescape(node.absolute_path)) + api.tree.reload() + end + end + vim.keymap.set("n", "ga", git_add, { buffer = bufnr, desc = "Git Add" }) + vim.keymap.set("n", "gu", git_unstage, { buffer = bufnr, desc = "Git Unstage" }) + end, + }) + end, keys = { { "fb", "NvimTreeToggle", desc = "[f]ile [b]rowser toggle" }, }, diff --git a/.config/nvim/lua/plugins/snakemake.lua b/.config/nvim/lua/plugins/snakemake.lua new file mode 100644 index 0000000..faa601d --- /dev/null +++ b/.config/nvim/lua/plugins/snakemake.lua @@ -0,0 +1,12 @@ +return { + { + "snakemake/snakemake", + ft = "snakemake", + config = function(plugin) + vim.opt.rtp:append(plugin.dir .. "/misc/vim") + end, + init = function(plugin) + require("lazy.core.loader").ftdetect(plugin.dir .. "/misc/vim") + end, + }, +} diff --git a/docs/changelog.rst b/docs/changelog.rst index 031d27f..a0bc08b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,18 @@ Changelog ========= +2026-01-17 +---------- + +**vim** + +- Add snakemake formatter +- Add snakemake filetype plugin +- Add markdown linter +- Use updated accelerated-jk repo +- Support adding files to git from within nvim-tree (:kbd:`ga`) or unstaging (:kbd:`gu`) + + 2025-11-21 ---------- diff --git a/docs/nvim-plugins.rst b/docs/nvim-plugins.rst index e9baac0..d74c3f4 100644 --- a/docs/nvim-plugins.rst +++ b/docs/nvim-plugins.rst @@ -50,9 +50,10 @@ load plugins when they're needed. See :ref:`nvim-lua` for my rationale on that. Because of how frequently nvim changes, each plugin section below has a changelog. Since I have reorganized files over the years, the changelogs show the *mention* of a plugin in a commit message, in a filename, or as part of the -changeset of a commit in an attempt to catch all of the changes. This may be -a little overzealous (for example the ``trouble`` plugin picks up commits -related to troubleshooting) but I've opted to err on the side of completeness. +changeset of a commit. Checking all of these things is an attempt to catch all +of the changes. This may be a little overzealous (for example the ``trouble`` +plugin picks up commits related to troubleshooting) but I've opted to err on +the side of completeness. Plugin list ----------- @@ -633,6 +634,13 @@ Other useful things you can do with Telescope: - Opens file in editor, expands directory to show contents, or collapses open directory + * - :kbd:`ga` (within browser) + - Add file to git. Useful when you have fugitive also open, and want to + add a file from an as-yet-untracked directory + + * - :kbd:`gu` (within browser) + - Unstage file to git. Useful when you have fugitive also open + The window-switching shortcuts :kbd:`w` and :kbd:`q` (move to windows left and right respectively; see :ref:`toggleterm_ref`) also work.