Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nvim, i3): cmp-git works in gh's files, plus more
- Fix monitor and mouse annoyances in i3wm - Fix i3lock setup - Get cmp-git working in markdown files created by `gh`. - Disable cmp-git in markdown files not created by `gh`. - Resolve treesitter-text-objects lazy loading issue - Add back the treesitter query for line length in git commit buffers - Various other small improvements diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index eae3dcbd..1948ec58 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,7 +1,7 @@ { "CopilotChat.nvim": { "branch": "canary", "commit": "92bc7b5e564c23b12b2ed41dd7657fdafe39d95f" }, "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, - "SchemaStore.nvim": { "branch": "main", "commit": "623df28bf9a2661d9d5a0f391bf30bdd8f8de62b" }, + "SchemaStore.nvim": { "branch": "main", "commit": "4abc1ab13ad5031049864cba0bfaec06a908e7e5" }, "cellular-automaton.nvim": { "branch": "main", "commit": "11aea08aa084f9d523b0142c2cd9441b8ede09ed" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-dictionary": { "branch": "main", "commit": "7144ce4bb2abc61a474cfdb3bb652a9ae82079e4" }, @@ -18,7 +18,7 @@ "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, "gitsigns.nvim": { "branch": "main", "commit": "f4928ba14eb6c667786ac7d69927f6aee6719f1e" }, - "gp.nvim": { "branch": "main", "commit": "25ef1e5839669c3cf4c15b12646c54afbaff1aea" }, + "gp.nvim": { "branch": "main", "commit": "827d5e32ff7b7108cf8e476b4d7d16a72ec5f293" }, "harpoon": { "branch": "harpoon2", "commit": "e76cb03c420bb74a5900a5b3e1dde776156af45f" }, "lazy.nvim": { "branch": "main", "commit": "839f9e78e78dc935b1188fb16583365991739c51" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, @@ -38,7 +38,7 @@ "nvim-lspconfig": { "branch": "master", "commit": "fa6c2a64100c6f692bbec29bbbc8ec2663c9e869" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-rulebook": { "branch": "main", "commit": "a962cc98bf1a5ba564358396b386f1d938b53366" }, - "nvim-treesitter": { "branch": "master", "commit": "debf5816eee21b7d51025ef17ba0647386226cb5" }, + "nvim-treesitter": { "branch": "master", "commit": "9d252d00210ed8d43197ef048daa94e6dc821bd6" }, "nvim-treesitter-context": { "branch": "master", "commit": "8198ad4b01ca64b6f5c7a7253f52df3fe329be46" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, "nvim-web-devicons": { "branch": "master", "commit": "e612de3d3a41a6b7be47f51e956dddabcbf419d9" }, @@ -51,7 +51,7 @@ "telescope.nvim": { "branch": "master", "commit": "79552ef8488cb492e0f9d2bf3b4e808f57515e35" }, "treesj": { "branch": "main", "commit": "275f83c81a5a1f5ae23c1eac30c4ac28beebbca2" }, "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, - "ts-comments.nvim": { "branch": "main", "commit": "8c21ae09c34ef8b82f2c6d2a87f57c3da33bb5e5" }, + "ts-comments.nvim": { "branch": "main", "commit": "0090cacf89bc52e4eddb911bc6c33b12411b95f7" }, "typescript-tools.nvim": { "branch": "master", "commit": "f8c2e0b36b651c85f52ad5c5373ff8b07adc15a7" }, "vim-dirtytalk": { "branch": "master", "commit": "aa57ba902b04341a04ff97214360f56856493583" }, "vim-flog": { "branch": "master", "commit": "36c60cbdb69c169ee44c085ce8d3f2f035a8658e" }, diff --git a/.config/nvim/lua/jamin/plugins/completion.lua b/.config/nvim/lua/jamin/plugins/completion.lua index 83585fab..26de4611 100644 --- a/.config/nvim/lua/jamin/plugins/completion.lua +++ b/.config/nvim/lua/jamin/plugins/completion.lua @@ -30,10 +30,21 @@ return { { "petertriho/cmp-git", ft = { "markdown", "gitcommit", "octo" }, - opts = { - filetypes = { "markdown", "gitcommit", "octo" }, - github = { issues = { state = "all" }, pull_requests = { state = "all" } }, - }, + opts = { filetypes = { "markdown", "gitcommit", "octo" } }, + config = function(_, opts) + require("cmp_git").setup(opts) + + -- The gh cli creates markdown files in `/tmp` when creating/editing issues/prs/comments. Not + -- sure why, but cwd ends up being `/tmp` when gh opens the editor. That prevents cmp-git from + -- working, since it doesn't know the repo to query for completion items. + vim.api.nvim_create_autocmd("FileType", { + pattern = { "markdown" }, + group = vim.api.nvim_create_augroup("jamin_git_cmp_gh_hack", {}), + callback = function(ev) + if string.match(ev.file, "/tmp/%d+%.md") then vim.cmd.cd("-") end + end, + }) + end, }, ----------------------------------------------------------------------------- @@ -228,7 +239,16 @@ return { { name = "luasnip", group_index = 1 }, { name = "nvim_lsp", group_index = 1 }, { name = "path", group_index = 1 }, - { name = "git", group_index = 1 }, + { + name = "git", + entry_filter = function(_, ctx) + return not ( + ctx.filetype == "markdown" + and not string.match(vim.api.nvim_buf_get_name(ctx.bufnr), "/tmp/%d+%.md") + ) + end, + group_index = 1, + }, { name = "buffer", group_index = 1, keyword_length = 2 }, { name = "tmux", group_index = 1, keyword_length = 2 }, -- only show ripgrep/spell/dictionary if there are no results from other sources diff --git a/.config/nvim/lua/jamin/plugins/git.lua b/.config/nvim/lua/jamin/plugins/git.lua index 6243cf12..301157b7 100644 --- a/.config/nvim/lua/jamin/plugins/git.lua +++ b/.config/nvim/lua/jamin/plugins/git.lua @@ -231,6 +231,11 @@ return { function() require("gitsigns").blame_line({ full = true }) end, desc = "Git blame line (gitsigns)", }, + { + "<leader>hB", + function() require("gitsigns").blame() end, + desc = "Git blame buffer (gitsigns)", + }, { "<leader>htb", function() require("gitsigns").toggle_current_line_blame() end, diff --git a/.config/nvim/lua/jamin/plugins/notes.lua b/.config/nvim/lua/jamin/plugins/notes.lua index 7cd5522e..d409dd5e 100644 --- a/.config/nvim/lua/jamin/plugins/notes.lua +++ b/.config/nvim/lua/jamin/plugins/notes.lua @@ -27,6 +27,7 @@ return { return { filetypes = { md = true, rmd = true, mdx = true, markdown = true }, to_do = { symbols = { " ", "x" } }, + silent = true, links = { style = link_style, transform_explicit = function(text) return text:gsub(" ", "-"):lower() end, @@ -45,7 +46,7 @@ return { MkdnCreateLinkFromClipboard = { { "n", "v" }, "<leader>P" }, MkdnToggleToDo = { { "n", "v" }, "<leader>m<Tab>" }, MkdnUpdateNumbering = { "n", "<leader>mn" }, - MkdnMoveSource = { "n", "<leader>mR" }, + MkdnMoveSource = { "n", "<leader>mrn" }, MkdnTableNewRowBelow = { "n", "<leader>mir" }, MkdnTableNewRowAbove = { "n", "<leader>miR" }, MkdnTableNewColAfter = { "n", "<leader>mic" }, diff --git a/.config/nvim/lua/jamin/plugins/treesitter.lua b/.config/nvim/lua/jamin/plugins/treesitter.lua index 71534a28..5929d82b 100644 --- a/.config/nvim/lua/jamin/plugins/treesitter.lua +++ b/.config/nvim/lua/jamin/plugins/treesitter.lua @@ -10,10 +10,6 @@ return { opts = { use_default_keymaps = false, max_join_length = 500 }, }, - ----------------------------------------------------------------------------- - -- more text objects - { "nvim-treesitter/nvim-treesitter-textobjects", lazy = true }, - ----------------------------------------------------------------------------- -- set commentstring based on treesitter node { "folke/ts-comments.nvim", event = "VeryLazy", opts = {} }, @@ -29,8 +25,6 @@ return { opts = { multiline_threshold = 1, max_lines = 6, - mode = "cursor", - -- separator = "─", }, config = function(_, opts) @@ -58,6 +52,9 @@ return { -- syntax tree parser/highlighter engine { "nvim-treesitter/nvim-treesitter", + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", -- more text objects + }, build = ":TSUpdate", cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" }, event = "BufReadPost", @@ -89,7 +86,6 @@ return { return { ensure_installed = res.treesitter_parsers, indent = { enable = true }, - autotag = { enable = true }, query_linter = { enable = true }, highlight = { @@ -185,13 +181,7 @@ return { config = function(_, opts) require("nvim-treesitter.configs").setup(opts) - vim.schedule( - function() - require("lazy").load({ - plugins = { "nvim-treesitter-textobjects", "nvim-treesitter-context" }, - }) - end - ) + vim.schedule(function() require("lazy").load({ plugins = { "nvim-treesitter-context" } }) end) end, }, } diff --git a/.config/nvim/lua/jamin/resources.lua b/.config/nvim/lua/jamin/resources.lua index 192e8539..8bbc00d0 100644 --- a/.config/nvim/lua/jamin/resources.lua +++ b/.config/nvim/lua/jamin/resources.lua @@ -123,7 +123,9 @@ M.mason_packages = { M.treesitter_parsers = { "astro", "bash", + "comment", "css", + -- "csv", "diff", "dockerfile", "git_rebase", @@ -134,13 +136,14 @@ M.treesitter_parsers = { -- "gowork", "graphql", "html", - "http", + -- "http", -- "ini", "javascript", "jsdoc", "json", "json5", "jsonc", + -- "jq", -- "latex", "lua", "luadoc", diff --git a/.config/nvim/queries/gitcommit/highlights.scm b/.config/nvim/queries/gitcommit/highlights.scm new file mode 100644 index 00000000..fdc5247a --- /dev/null +++ b/.config/nvim/queries/gitcommit/highlights.scm @@ -0,0 +1,10 @@ +; extends +; gbprod/tree-sitter-gitcommit#68 + +((subject) @comment.warning + (#vim-match? @comment.warning ".\{50,}") + (#offset! @comment.warning 0 50 0 0)) + +((message_line) @comment.warning + (#vim-match? @comment.warning ".\{72,}") + (#offset! @comment.warning 0 72 0 0)) diff --git a/.dotfiles/shell/exports.sh b/.dotfiles/shell/exports.sh index 26a5bd14..d41ca39e 100644 --- a/.dotfiles/shell/exports.sh +++ b/.dotfiles/shell/exports.sh @@ -210,13 +210,14 @@ if supports fff; then fi # https://github.com/meiji163/gh-notify -export GH_NOTIFY_MARK_READ_KEY="alt-backspace" -export GH_NOTIFY_MARK_ALL_READ_KEY="ctrl-delete" -export GH_NOTIFY_OPEN_BROWSER_KEY="ctrl-o" export GH_NOTIFY_COMMENT_KEY="alt-c" export GH_NOTIFY_VIEW_DIFF_KEY="alt-d" export GH_NOTIFY_VIEW_PATCH_KEY="alt-D" +export GH_NOTIFY_TOGGLE_PREVIEW_KEY="alt-p" export GH_NOTIFY_RESIZE_PREVIEW_KEY="alt-P" +export GH_NOTIFY_MARK_READ_KEY="alt-x" +export GH_NOTIFY_MARK_ALL_READ_KEY="alt-backspace" +export GH_NOTIFY_OPEN_BROWSER_KEY="ctrl-o" # my tools {{{1 supports matpat && export MATPAT_OPEN_CMD="$BROWSER"
- Loading branch information