From 366799025afd6d5fc481249b784e593f7cad4d6e Mon Sep 17 00:00:00 2001 From: punkfairie Date: Mon, 17 Mar 2025 19:44:42 -0700 Subject: [PATCH 1/5] fix: Apply alex to prose types only --- lua/plugins/nvim-lint.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lua/plugins/nvim-lint.lua b/lua/plugins/nvim-lint.lua index 52f35e8..f248e2c 100644 --- a/lua/plugins/nvim-lint.lua +++ b/lua/plugins/nvim-lint.lua @@ -3,21 +3,23 @@ return { 'mfussenegger/nvim-lint', opts = { linters_by_ft = { - ['*'] = { 'codespell', 'editorconfig-checker', 'alex' }, + ['*'] = { 'codespell', 'editorconfig-checker' }, bash = { 'shellcheck' }, css = { 'stylelint' }, - django = { 'djlint' }, + django = { 'djlint', 'alex' }, env = { 'dotenv-linter' }, ghaction = { 'zizmor' }, - handlebars = { 'djlint' }, - html = { 'htmlhint' }, - jinja = { 'djlint' }, - mustache = { 'djlint' }, + handlebars = { 'djlint', 'alex' }, + html = { 'htmlhint', 'alex' }, + jinja = { 'djlint', 'alex' }, + markdown = { 'alex' }, + mustache = { 'djlint', 'alex' }, nix = { 'deadnix', 'statix' }, - nunjucks = { 'djlint' }, + nunjucks = { 'djlint', 'alex' }, scss = { 'stylelint' }, sh = { 'shellcheck' }, twig = { 'djlint' }, + txt = { 'alex' }, yaml = { 'yamllint' }, zsh = { 'zsh' }, }, From adaf322077e5ce5098e8272a1a98a98b0055c2a1 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Mon, 17 Mar 2025 19:45:38 -0700 Subject: [PATCH 2/5] ci: Turn down alex's profanity filter --- .alexrc | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .alexrc diff --git a/.alexrc b/.alexrc new file mode 100644 index 0000000..6fd0f5a --- /dev/null +++ b/.alexrc @@ -0,0 +1,3 @@ +{ + "profanitySureness": 2 +} From 09b326bc2f737ec7c84b1871fb8d95a24355f9da Mon Sep 17 00:00:00 2001 From: punkfairie Date: Tue, 18 Mar 2025 19:56:57 -0700 Subject: [PATCH 3/5] build: Add testNvim to dev shell --- flake.nix | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index e84c38e..84c4985 100644 --- a/flake.nix +++ b/flake.nix @@ -371,7 +371,25 @@ categories = { general = true; - test = false; + }; + extra = { + vue-ls-path = "${pkgs.lib.getExe pkgs.vue-language-server}"; + }; + }; + + testNvim = { + pkgs, + # mkNvimPlugin, + ... + }: { + settings = { + wrapRc = false; + unwrappedCfgPath = "/home/marley/hackin/marleyvim"; + neovim-unwrapped = inputs.neovim-nightly-overlay.packages.${pkgs.system}.neovim; + }; + + categories = { + general = true; }; extra = { vue-ls-path = "${pkgs.lib.getExe pkgs.vue-language-server}"; @@ -390,11 +408,11 @@ categoryDefinitions packageDefinitions; - defaultPackage = nixCatsBuilder defaultPackageName; + nvimPackage = nixCatsBuilder "testNvim"; pkgs = import nixpkgs {inherit system;}; in { packages = - (utils.mkAllWithDefault defaultPackage) + (utils.mkAllWithDefault nvimPackage) // { devenv-up = self.devShells.${system}.default.config.procfileScript; devenv-test = self.devShells.${system}.default.config.test; @@ -411,7 +429,7 @@ # }: _: { packages = [ - defaultPackage + nvimPackage ]; pre-commit.hooks = { From 276193aad2a57519908322008944c995407483a7 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Tue, 18 Mar 2025 20:29:00 -0700 Subject: [PATCH 4/5] feat: keymaps --- lua/plugins/edgy-nvim.lua | 129 ++++++++++++++++++ lua/plugins/treesj.lua | 26 +++- lua/plugins/which-key-nvim.lua | 239 +++++++++++++++++++++++++++++++++ 3 files changed, 393 insertions(+), 1 deletion(-) create mode 100644 lua/plugins/edgy-nvim.lua create mode 100644 lua/plugins/which-key-nvim.lua diff --git a/lua/plugins/edgy-nvim.lua b/lua/plugins/edgy-nvim.lua new file mode 100644 index 0000000..9b39f5a --- /dev/null +++ b/lua/plugins/edgy-nvim.lua @@ -0,0 +1,129 @@ +return { + { + 'folke/edgy.nvim', + opts = function() + local opts = { + bottom = { + { + ft = 'toggleterm', + size = { height = 0.4 }, + filter = function(_, win) + return vim.api.nvim_win_get_config(win).relative == '' + end, + }, + { + ft = 'noice', + size = { height = 0.4 }, + filter = function(_, win) + return vim.api.nvim_win_get_config(win).relative == '' + end, + }, + 'Trouble', + { ft = 'qf', title = 'QuickFix' }, + { title = 'Spectre', ft = 'spectre_panel', size = { height = 0.4 } }, + { + title = 'Neotest Output', + ft = 'neotest-output-panel', + size = { height = 15 }, + }, + }, + left = { + { title = 'Neotest Summary', ft = 'neotest-summary' }, + -- "neo-tree", + }, + right = { + { title = 'Grug Far', ft = 'grug-far', size = { width = 0.4 } }, + { + ft = 'help', + size = { width = 0.4 }, + -- don't open help files in edgy that we're editing + filter = function(buf) + return vim.bo[buf].buftype == 'help' + end, + }, + }, + keys = { + -- increase width + [''] = function(win) + win:resize('width', 2) + end, + -- decrease width + [''] = function(win) + win:resize('width', -2) + end, + -- increase height + [''] = function(win) + win:resize('height', 2) + end, + -- decrease height + [''] = function(win) + win:resize('height', -2) + end, + }, + } + + if LazyVim.has('neo-tree.nvim') then + local pos = { + filesystem = 'left', + buffers = 'top', + git_status = 'right', + document_symbols = 'bottom', + diagnostics = 'bottom', + } + local sources = LazyVim.opts('neo-tree.nvim').sources or {} + for i, v in ipairs(sources) do + table.insert(opts.left, i, { + title = 'Neo-Tree ' .. v:gsub('_', ' '):gsub('^%l', string.upper), + ft = 'neo-tree', + filter = function(buf) + return vim.b[buf].neo_tree_source == v + end, + pinned = true, + open = function() + vim.cmd( + ('Neotree show position=%s %s dir=%s'):format( + pos[v] or 'bottom', + v, + LazyVim.root() + ) + ) + end, + }) + end + end + + -- trouble + for _, pos in ipairs({ 'top', 'bottom', 'left', 'right' }) do + opts[pos] = opts[pos] or {} + table.insert(opts[pos], { + ft = 'trouble', + filter = function(_, win) + return vim.w[win].trouble + and vim.w[win].trouble.position == pos + and vim.w[win].trouble.type == 'split' + and vim.w[win].trouble.relative == 'editor' + and not vim.w[win].trouble_preview + end, + }) + end + + -- snacks terminal + for _, pos in ipairs({ 'top', 'bottom', 'left', 'right' }) do + opts[pos] = opts[pos] or {} + table.insert(opts[pos], { + ft = 'snacks_terminal', + size = { height = 0.3 }, + title = '%{b:snacks_terminal.id}: %{b:term_title}', + filter = function(_, win) + return vim.w[win].snacks_win + and vim.w[win].snacks_win.position == pos + and vim.w[win].snacks_win.relative == 'editor' + and not vim.w[win].trouble_preview + end, + }) + end + + return opts + end, + }, +} diff --git a/lua/plugins/treesj.lua b/lua/plugins/treesj.lua index e37171f..e1b33e6 100644 --- a/lua/plugins/treesj.lua +++ b/lua/plugins/treesj.lua @@ -1,10 +1,34 @@ return { { 'Wansmer/treesj', - keys = { 'm', 'j', 's' }, + keys = { + { 'm', require('treesj').toggle, desc = 'toggle join/split' }, + { 'j', require('treesj').join, desc = 'join code block' }, + { 'p', require('treesj').split, desc = 'split code block' }, + }, dependencies = { 'nvim-treesitter/nvim-treesitter' }, opts = { + use_default_keymaps = false, max_join_length = vim.o.textwidth, }, }, + + -- Remap key so it doesn't conflict with treesj. + { + 'gbprod/yanky.nvim', + keys = { + { + 'y', + function() + if LazyVim.pick.picker.name == 'telescope' then + require('telescope').extensions.yank_history.yank_history({}) + else + vim.cmd([[YankyRingHistory]]) + end + end, + mode = { 'n', 'x' }, + desc = 'Open Yank History', + }, + }, + }, } diff --git a/lua/plugins/which-key-nvim.lua b/lua/plugins/which-key-nvim.lua new file mode 100644 index 0000000..d174741 --- /dev/null +++ b/lua/plugins/which-key-nvim.lua @@ -0,0 +1,239 @@ +return { + { + 'folke/which-key.nvim', + opts = { + spec = { + { + mode = { 'n', 'v' }, + { + '', + group = 'leader', + icon = { icon = '', color = 'green' }, + }, + { 'K', desc = 'keyword program' }, + + { '', desc = 'cut' }, + + { 'c', desc = 'change' }, + { 'C', desc = 'change to end of line' }, + { 'd', desc = 'delete' }, + + { 'D', desc = 'delete to end of line' }, + + { 'g', group = 'goto' }, + { 'gd', desc = 'definition' }, + { 'gD', desc = 'declaration' }, + { 'gI', desc = 'implementation' }, + { 'gy', desc = 't[y]pe definition' }, + { 'ge', desc = 'previous end of word', icon = '' }, + { 'gf', desc = 'file under cursor' }, + { 'gg', desc = 'first line', icon = '󰘀' }, + { 'gi', desc = 'last insert' }, + { 'gO', desc = 'document symbols', icon = '󰊕' }, + { 'gt', desc = 'next tab page' }, + { 'gT', desc = 'previous tab page' }, + { 'gu', desc = 'make lowercase', icon = '󰬵' }, + { 'gU', desc = 'make uppercase', icon = '󰬶' }, + { 'gx', desc = 'open with system app', icon = '󰏋' }, + { 'g,', desc = 'newer position in change list' }, + { 'g;', desc = 'older position in change list' }, + { 'g[', desc = 'left "around"' }, + { 'g]', desc = 'right "around"' }, + { + 'gs', + group = 'surround', + icon = { icon = '󰅲', color = 'purple' }, + }, + + { 'K', desc = 'keyword program' }, + + { 'M', desc = 'middle line of window', icon = '󰘢' }, + { 'x', desc = 'cut' }, + { 'X', desc = 'cut to end of line' }, + { 'Y', desc = 'yank to end of line' }, + + { 'z', group = 'fold/scroll/spell', icon = '' }, + { 'zb', desc = 'bottom this line', icon = '' }, + { 'ze', desc = 'right this line', icon = '' }, + { 'zH', desc = 'half screen to the left', icon = '' }, + { 'zL', desc = 'half screen to the right', icon = '' }, + { 'zs', desc = 'left this line', icon = '' }, + { 'zt', desc = 'top this line', icon = '' }, + { 'zz', desc = 'center this line', icon = '󰘢' }, + { 'z', desc = 'top this line', icon = '' }, + + { '[', group = 'previous', icon = '' }, + { '[h', desc = 'hunk' }, + { '[[', desc = 'reference' }, + { '[b', desc = 'buffer' }, + { '[B', desc = 'move buffer backwards' }, + { '[d', desc = 'diagnostic' }, + { '[D', desc = 'first diagnostic' }, + { '[e', desc = 'error' }, + { '[i', desc = 'top edge of scope' }, + { '[l', desc = 'location list item' }, + { '[L', desc = 'prev or first location list item' }, + { '[m', desc = 'method start' }, + { '[M', desc = 'method end' }, + { '[p', desc = 'put & indent before' }, + { '[P', desc = 'put & indent before' }, + { '[q', desc = 'trouble/quickfix item' }, + { '[Q', desc = 'prev or first trouble/quickfix item' }, + { '[s', desc = 'misspelled word' }, + { '[t', desc = 'todo comment' }, + { '[T', desc = 'matching tag' }, + { '[w', desc = 'warning' }, + { '[%', desc = 'unmatched group' }, + { '[(', desc = '(' }, + { '[<', desc = '<' }, + { '[{', desc = '{' }, + { '[', desc = 'location list item in prev file' }, + { '[', desc = 'trouble/quickfix item in prev file' }, + { '[', desc = 'tag in preview window' }, + { '[', desc = 'add empty line above' }, + + { ']', group = 'next', icon = '' }, + { ']h', desc = 'hunk' }, + { ']]', desc = 'reference' }, + { ']b', desc = 'buffer' }, + { ']B', desc = 'move buffer forwards' }, + { ']d', desc = 'diagnostic' }, + { ']D', desc = 'last diagnostic' }, + { ']e', desc = 'error' }, + { ']i', desc = 'bottom edge of scope' }, + { ']l', desc = 'location list item' }, + { ']L', desc = 'prev or last location list item' }, + { ']m', desc = 'method start' }, + { ']M', desc = 'method end' }, + { ']p', desc = 'put & indent after' }, + { ']P', desc = 'put & indent after' }, + { ']q', desc = 'trouble/quickfix item' }, + { ']Q', desc = 'prev or last trouble/quickfix item' }, + { ']s', desc = 'misspelled word' }, + { ']t', desc = 'todo comment' }, + { ']T', desc = 'matching tag' }, + { ']w', desc = 'warning' }, + { ']%', desc = 'unmatched group' }, + { '](', desc = '(' }, + { ']<', desc = '<' }, + { ']{', desc = '{' }, + { ']', desc = 'location list item in next file' }, + { ']', desc = 'trouble/quickfix item in next file' }, + { ']', desc = 'tag in preview window' }, + { ']', desc = 'add empty line below' }, + + { '!', desc = 'run program', icon = '' }, + { '&', desc = 'repeat last :subsitute', icon = '󰛔' }, + { '<', desc = 'indent decrease', icon = '󰘀' }, + { '=', group = 'fmt with indentexpr', icon = '' }, + { '>', desc = 'indent increase', icon = '󰘁' }, + { '_', desc = 'first character of line', icon = '󰘀' }, + + { '', desc = 'move line up', icon = '' }, + { '', desc = 'move line down', icon = '' }, + + { '', desc = 'increment (dial)', icon = '󰆵' }, + { + '', + desc = 'clear & redraw', + icon = { icon = '', color = 'red' }, + }, + { '', desc = 'decrement (dial)', icon = '󰆶' }, + + { '', desc = 'clear search highlight' }, + }, + + { + mode = { 'n', 'i', 'o' }, + hidden = true, + { '' }, + { '' }, + { '' }, + { '' }, + { '' }, + { '' }, + }, + { + mode = { 'n', 'x', 'o' }, + hidden = true, + { 'j' }, + { 'k' }, + { 'h' }, + { 'l' }, + { '' }, + { 'xx' }, + }, + }, + + icons = { + rules = { + { pattern = 'start of line', icon = '󰘀' }, + { pattern = 'end of line', icon = '󰘁' }, + { pattern = 'prev[i]?[o]?[u]?[s]? word', icon = '' }, + { pattern = 'next word', icon = '' }, + { pattern = 'next end of word', icon = '' }, + { pattern = 'move to next char', icon = '', color = 'green' }, + { pattern = 'move to prev char', icon = '', color = 'green' }, + { pattern = 'last line', icon = '󰘁' }, + { pattern = 'move before next char', icon = '󰘀' }, + { pattern = 'move before prev char', icon = '󰘁' }, + { pattern = 'matching %(%){}%[%]', icon = '󰅪' }, + { pattern = 'start of line %(non ws%)', icon = '󰘀' }, + { pattern = 'prev empty line', icon = '' }, + { pattern = 'next empty line', icon = '' }, + + { pattern = 'around', icon = '󰅪' }, + { pattern = 'buffer', color = 'cyan' }, + { pattern = 'change', icon = '', color = 'cyan' }, + { pattern = 'comment', icon = '' }, + { pattern = 'cut', icon = '', color = 'red' }, + { pattern = 'delete', icon = '󰆴', color = 'red' }, + { pattern = 'diagnostic', icon = '', hl = 'DiagnosticInfo' }, + { pattern = 'error', icon = '', hl = 'DiagnosticError' }, + { pattern = 'explorer', icon = '󰙅', color = 'yellow' }, + { pattern = 'find', icon = '', color = 'green' }, + { pattern = 'flash', icon = '󱐋', color = 'green' }, + { pattern = 'fold', icon = '', color = 'purple' }, + { pattern = 'format', icon = '󰉼', color = 'purple' }, + { pattern = 'goto', icon = '', color = 'cyan' }, + { pattern = 'hunk', color = 'orange' }, + { pattern = 'inside', icon = '󰅩' }, + { pattern = 'lazygit', icon = '', color = 'orange' }, + { pattern = 'message', icon = '󰈸', color = 'orange' }, + { pattern = 'notification', icon = '󰈸', color = 'orange' }, + { pattern = 'registers', icon = '󰅍', color = 'yellow' }, + { pattern = 'replace', icon = '', colors = 'blue' }, + { pattern = 'session', icon = '', color = 'azure' }, + { pattern = 'spell', icon = '', color = 'red' }, + { pattern = 'subsitute', icon = '', color = 'green' }, + { pattern = 'visual', icon = '', color = 'purple' }, + { pattern = 'warning', icon = '', hl = 'DiagnosticWarn' }, + { pattern = 'yank', icon = '', color = 'yellow' }, + { pattern = 'prev ftFT', icon = '' }, + { pattern = 'next ftFT', icon = '' }, + }, + }, + + replace = { + desc = { + { '%u%l', string.lower }, + { 'prev ([wW][oO][rR][dD])', 'previous %1' }, + { 'move to next char', 'find next character' }, + { 'move to prev char', 'find previous character' }, + { 'move before next char', 'move before character backwards' }, + { 'move before prev char', 'move before character fowards' }, + { 'prev ftFT', 'previous character match' }, + { 'next ftFT', 'next character match' }, + { 'start of line %(non ws%)', 'first character of line' }, + { 'prev empty line', 'previous empty line' }, + { 'goto %S+ start @parameter.inner', 'parameter start (inner)' }, + { 'goto %S+ end @parameter.inner', 'parameter end (inner)' }, + { 'goto %S+ start @class.outer', 'class start (outer)' }, + { 'goto %S+ end @class.outer', 'class end (outer)' }, + { 'goto %S+ start @function.outer', 'function start (outer)' }, + { 'goto %S+ end @function.outer', 'function end (outer)' }, + }, + }, + }, + }, +} From 3c1e83572defb9604f5f8bb17ac06cffb64040d7 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Tue, 18 Mar 2025 20:32:49 -0700 Subject: [PATCH 5/5] chore: update --- flake.lock | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/flake.lock b/flake.lock index 4666f6e..e85b37f 100644 --- a/flake.lock +++ b/flake.lock @@ -37,11 +37,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1742147141, - "narHash": "sha256-pTgorBdmI0rMrFirATgMIye65/jL72De8Kxh7rBT/58=", + "lastModified": 1742320965, + "narHash": "sha256-jGAhz2VD/TR8RQS5cUU2Jh8T0yyP50bw75dmHByLZpE=", "owner": "cachix", "repo": "devenv", - "rev": "e1eb23d427a3a0871c277268a28163898fd37266", + "rev": "6bde92766ddd3ee1630029a03d36baddd51934e2", "type": "github" }, "original": { @@ -303,11 +303,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1742083911, - "narHash": "sha256-JcfIoi4M5npWC3oBKGdv11Mjj8CJ8LDGU7rcD+zjlC0=", + "lastModified": 1742278753, + "narHash": "sha256-/PaeiSHDZ2vrToGwnBaY9Pzi1dZe89QpIinQnFO12xU=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "66163e5d352d915caabc9826c8f2f6b5429e331f", + "rev": "8b3c5da082e4102467fe347183c4aff7c28db920", "type": "github" }, "original": { @@ -319,11 +319,11 @@ "neovim-src": { "flake": false, "locked": { - "lastModified": 1742057093, - "narHash": "sha256-yUPhXa2hOQ9vdHLPvXA3vPwAzv99TVJkISsJoBkCuhA=", + "lastModified": 1742251389, + "narHash": "sha256-X0tTZ07s549yGg9q8Nwf+75745T8gtxFLbPs0WMo4TU=", "owner": "neovim", "repo": "neovim", - "rev": "f5714994bc4fc578b5f07bca403e7067e6d9b5a0", + "rev": "3b1d0e7f701b53d72e4fdf5a721d2684d055cc1d", "type": "github" }, "original": { @@ -351,11 +351,11 @@ ] }, "locked": { - "lastModified": 1734114420, - "narHash": "sha256-n52PUzub5jZWc8nI/sR7UICOheU8rNA+YZ73YaHeCBg=", + "lastModified": 1741798497, + "narHash": "sha256-E3j+3MoY8Y96mG1dUIiLFm2tZmNbRvSiyN7CrSKuAVg=", "owner": "domenkozar", "repo": "nix", - "rev": "bde6a1a0d1f2af86caa4d20d23eca019f3d57eee", + "rev": "f3f44b2baaf6c4c6e179de8cbb1cc6db031083cd", "type": "github" }, "original": { @@ -367,11 +367,11 @@ }, "nixCats": { "locked": { - "lastModified": 1742124230, - "narHash": "sha256-jrRa54JiOfGoRjPtppaisCe/hDNhyPTLq6j0I88wMtw=", + "lastModified": 1742353104, + "narHash": "sha256-qQJCCPGzLoM8JuG0LPn2jpGp5Uo3HpGR/Nwb3v5B3EU=", "owner": "BirdeeHub", "repo": "nixCats-nvim", - "rev": "32fbe1471e58b9bc3f98e34aee422fc04bb0d624", + "rev": "a456b6c59d6567b9d853ead909db218d4824c18c", "type": "github" }, "original": { @@ -430,11 +430,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1741865919, - "narHash": "sha256-4thdbnP6dlbdq+qZWTsm4ffAwoS8Tiq1YResB+RP6WE=", + "lastModified": 1742206328, + "narHash": "sha256-q+AQ///oMnyyFzzF4H9ShSRENt3Zsx37jTiRkLkXXE0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "573c650e8a14b2faa0041645ab18aed7e60f0c9a", + "rev": "096478927c360bc18ea80c8274f013709cf7bdcd", "type": "github" }, "original": { @@ -446,11 +446,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1741865919, - "narHash": "sha256-4thdbnP6dlbdq+qZWTsm4ffAwoS8Tiq1YResB+RP6WE=", + "lastModified": 1742237028, + "narHash": "sha256-xlpHmgBxUnvHo8FNnju0sgnEyasb4gC607b+keqjmX8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "573c650e8a14b2faa0041645ab18aed7e60f0c9a", + "rev": "9bc8a90931262245919a26f995c1f24c6c70d3fe", "type": "github" }, "original": {