diff options
| author | aktersnurra <gustaf@gustafrydholm.xyz> | 2026-04-18 00:52:28 +0200 |
|---|---|---|
| committer | aktersnurra <gustaf@gustafrydholm.xyz> | 2026-04-20 22:58:39 +0200 |
| commit | 11d50dc8934a5b9e9be73d0445789e005843dfc2 (patch) | |
| tree | c87c84806ab5fcd48f191c765650b91e1e52ce6f | |
| parent | 0f3690bd084ba3b47b4c356089b03a6df763572c (diff) | |
| -rw-r--r-- | .pre-commit-config.yaml | 8 | ||||
| -rw-r--r-- | fnl/config.fnl | 3 | ||||
| -rw-r--r-- | fnl/macros.fnlm | 41 | ||||
| -rw-r--r-- | fnl/plugins/leap.fnl | 11 | ||||
| -rw-r--r-- | fnl/plugins/lsp.fnl | 12 | ||||
| -rw-r--r-- | fnl/plugins/nvim-lint.fnl | 6 | ||||
| -rw-r--r-- | fnl/plugins/octo.fnl | 15 | ||||
| -rw-r--r-- | fnl/plugins/snippets.fnl | 33 | ||||
| -rw-r--r-- | fnl/plugins/treesitter.fnl | 166 | ||||
| -rw-r--r-- | fnl/plugins/window-picker.fnl | 5 | ||||
| -rw-r--r-- | lazy-lock.json | 13 | ||||
| -rw-r--r-- | nvim.log | 2 |
12 files changed, 140 insertions, 175 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 572aabe..f920d24 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,3 +3,11 @@ repos: rev: v0.11.3 hooks: - id: stylua + - repo: local + hooks: + - id: fnlfmt + name: fnlfmt + entry: fnlfmt --fix + language: system + files: '\.fnl$' + exclude: '\.fnlm$' diff --git a/fnl/config.fnl b/fnl/config.fnl index 657c954..4e0eb0a 100644 --- a/fnl/config.fnl +++ b/fnl/config.fnl @@ -1,4 +1,5 @@ ;; Load plugins with lazy. +(import-macros {: keymap} :macros) (λ load-plugin [tbl name] (table.insert tbl (require (.. :plugins. name)))) @@ -51,7 +52,7 @@ (each [fname type (vim.fs.dir (.. (vim.fn.stdpath :config) :/fnl/plugins))] (when (= type :file) (load-plugin plugins (fname:match "^(.*)%.fnl$")))) - (vim.keymap.set :n :<leader>y "<cmd>Lazy home<cr>" {:desc :Home}) + (keymap :n :<leader>y "<cmd>Lazy home<cr>" {:desc :Home}) (lazy.setup plugins opts))) (init) diff --git a/fnl/macros.fnlm b/fnl/macros.fnlm index 8267518..edfca30 100644 --- a/fnl/macros.fnlm +++ b/fnl/macros.fnlm @@ -33,4 +33,43 @@ (table.insert out `(tset vim.opt ,k ,v))) out)) -{: autocmd : autocmds : user-cmd : user-cmds : keymap : keymaps : set-opts} +(fn ts-selects [...] + "Generate treesitter select keymaps. Each entry: [key query ?group]. + Modes are always [:x :o]. Assumes `select` is in scope." + (let [out `(do)] + (each [_ entry (ipairs [...])] + (let [key (. entry 1) + query (. entry 2) + group (or (. entry 3) :textobjects)] + (table.insert out + `(vim.keymap.set [:x :o] ,key + (λ [] (select.select_textobject ,query ,group)) {})))) + out)) + +(fn ts-swaps [...] + "Generate treesitter swap keymaps. Each entry: [key method query]. + Mode is always :n. method is a symbol like swap.swap_next." + (let [out `(do)] + (each [_ entry (ipairs [...])] + (let [key (. entry 1) + method (. entry 2) + query (. entry 3)] + (table.insert out + `(vim.keymap.set :n ,key (λ [] (,method ,query)) {})))) + out)) + +(fn ts-moves [...] + "Generate treesitter move keymaps. Each entry: [key method query ?group]. + Modes are always [:n :x :o]. method is a symbol like move.goto_next_start." + (let [out `(do)] + (each [_ entry (ipairs [...])] + (let [key (. entry 1) + method (. entry 2) + query (. entry 3) + group (or (. entry 4) :textobjects)] + (table.insert out + `(vim.keymap.set [:n :x :o] ,key (λ [] (,method ,query ,group)) {})))) + out)) + +{: autocmd : autocmds : user-cmd : user-cmds : keymap : keymaps : set-opts + : ts-selects : ts-swaps : ts-moves} diff --git a/fnl/plugins/leap.fnl b/fnl/plugins/leap.fnl index d6ec18e..8f49390 100644 --- a/fnl/plugins/leap.fnl +++ b/fnl/plugins/leap.fnl @@ -1,4 +1,5 @@ ;; Leap through text. +(import-macros {: keymaps} :macros) (local dependencies [{1 :tpope/vim-repeat :event :VeryLazy} {1 :aktersnurra/leap-spooky.nvim @@ -27,11 +28,11 @@ (λ config [] (let [leap (require :leap)] (tset leap.opts.vim_opts :go.ignorecase false) - (vim.keymap.set [:n :x :o] :s "<Plug>(leap-forward)") - (vim.keymap.set [:n :x :o] :S "<Plug>(leap-backward)") - (vim.keymap.set [:x :o] :x "<Plug>(leap-forward-till)") - (vim.keymap.set [:x :o] :X "<Plug>(leap-backward-till)") - (vim.keymap.set [:n] :gs "<Plug>(leap-from-window)"))) + (keymaps [[:n :x :o] :s "<Plug>(leap-forward)" {}] + [[:n :x :o] :S "<Plug>(leap-backward)" {}] + [[:x :o] :x "<Plug>(leap-forward-till)" {}] + [[:x :o] :X "<Plug>(leap-backward-till)" {}] + [[:n] :gs "<Plug>(leap-from-window)" {}]))) {:url "https://codeberg.org/andyg/leap.nvim" : dependencies diff --git a/fnl/plugins/lsp.fnl b/fnl/plugins/lsp.fnl index 482916a..2ac3683 100644 --- a/fnl/plugins/lsp.fnl +++ b/fnl/plugins/lsp.fnl @@ -1,10 +1,12 @@ ;; LSP configuration. +(import-macros {: autocmd} :macros) + (λ config [] - (vim.api.nvim_create_autocmd :LspAttach - {:callback (λ [args] - (let [{: on-attach} (require :plugins.lsp.keymaps)] - (on-attach args.buf)))}) + (autocmd :LspAttach + {:callback (λ [args] + (let [{: on-attach} (require :plugins.lsp.keymaps)] + (on-attach args.buf)))}) (let [diagnostics (require :plugins.lsp.diagnostics) mason-lspconfig (require :plugins.lsp.mason-lspconfig)] (diagnostics.setup) @@ -13,7 +15,7 @@ (local icons (require :settings.icons)) [{1 :neovim/nvim-lspconfig - :event :BufNew + :event [:BufReadPre :BufNewFile] :dependencies [:mason.nvim :williamboman/mason-lspconfig.nvim :b0o/schemastore.nvim diff --git a/fnl/plugins/nvim-lint.fnl b/fnl/plugins/nvim-lint.fnl index 040bcc4..604b8ab 100644 --- a/fnl/plugins/nvim-lint.fnl +++ b/fnl/plugins/nvim-lint.fnl @@ -7,9 +7,9 @@ (lint.try_lint))) (λ init [] - (let [lint-augroup (vim.api.nvim_create_augroup :lint {:clear true})] - (autocmd [:BufEnter :BufWritePost :InsertLeave :TextChangedI] - {:group lint-augroup : callback}))) + (autocmd [:BufEnter :BufWritePost :InsertLeave :TextChangedI] + {:group (vim.api.nvim_create_augroup :lint {:clear true}) + : callback})) (λ config [] (let [lint (require :lint)] diff --git a/fnl/plugins/octo.fnl b/fnl/plugins/octo.fnl new file mode 100644 index 0000000..b97afe6 --- /dev/null +++ b/fnl/plugins/octo.fnl @@ -0,0 +1,15 @@ +;; GitHub PR and issue management. + +{1 :pwntester/octo.nvim + :dependencies [:nvim-lua/plenary.nvim + :nvim-telescope/telescope.nvim + :nvim-tree/nvim-web-devicons] + :cmd :Octo + :keys [{1 :<leader>Ol 2 "<cmd>Octo pr list<cr>" :desc "List PRs"} + {1 :<leader>Os 2 "<cmd>Octo review start<cr>" :desc "Review Start"} + {1 :<leader>Or 2 "<cmd>Octo review resume<cr>" :desc "Review Resume"} + {1 :<leader>Od 2 "<cmd>Octo review discard<cr>" :desc "Review Discard"} + {1 :<leader>Om 2 "<cmd>Octo review submit<cr>" :desc "Review Submit"} + {1 :<leader>Oc 2 "<cmd>Octo review comments<cr>" :desc "Review Comments"} + {1 :<leader>Oi 2 "<cmd>Octo issue list<cr>" :desc "List Issues"}] + :opts {}} diff --git a/fnl/plugins/snippets.fnl b/fnl/plugins/snippets.fnl index 70917ba..6dd317e 100644 --- a/fnl/plugins/snippets.fnl +++ b/fnl/plugins/snippets.fnl @@ -1,4 +1,5 @@ ;; Snippets functionality. +(import-macros {: keymaps} :macros) (local dependencies [:rafamadriz/friendly-snippets]) @@ -16,19 +17,23 @@ (add-snippets (fname:match "^(.*)%.fnl$")))) (ls.config.set_config {:history true :updateevents "TextChanged,TextChangedI"}) - (vim.keymap.set [:i :s] :<c-u> - (λ [] - (when (ls.expand_or_jumpable) - (ls.expand_or_jump))) {:silent true}) - (vim.keymap.set [:i :s] :<c-l> - (λ [] - (when (ls.jumpable -1) - (ls.jump -1)) - {:silent true})) - (vim.keymap.set [:i] :<c-j> - (λ [] - (when (ls.choice_active) - (ls.change_choice 1))) - {:silent true}))) + (keymaps [[:i :s] + :<c-u> + (λ [] + (when (ls.expand_or_jumpable) + (ls.expand_or_jump))) + {:silent true}] + [[:i :s] + :<c-l> + (λ [] + (when (ls.jumpable -1) + (ls.jump -1))) + {:silent true}] + [[:i] + :<c-j> + (λ [] + (when (ls.choice_active) + (ls.change_choice 1))) + {:silent true}]))) {1 :L3MON4D3/LuaSnip :event :InsertEnter : config : dependencies} diff --git a/fnl/plugins/treesitter.fnl b/fnl/plugins/treesitter.fnl index cc0b6cc..300bdfd 100644 --- a/fnl/plugins/treesitter.fnl +++ b/fnl/plugins/treesitter.fnl @@ -1,6 +1,6 @@ ;; Treesitter parser installation and built-in feature configuration. -(import-macros {: autocmd : keymaps} :macros) +(import-macros {: autocmd : ts-selects : ts-swaps : ts-moves} :macros) (local parsers [:bash :c @@ -32,151 +32,45 @@ :xml :yaml]) +;; fnlfmt: skip (λ setup-textobjects [] (let [textobjects (require :nvim-treesitter-textobjects) select (require :nvim-treesitter-textobjects.select) swap (require :nvim-treesitter-textobjects.swap) move (require :nvim-treesitter-textobjects.move)] (textobjects.setup {:select {:lookahead true - :selection_modes {"@parameter.outer" :v + :selection_modes {"@parameter.outer" :v "@function.outer" :V "@class.outer" :<c-v>} :include_surrounding_whitespace true} :move {:set_jumps true}}) - (keymaps [[:x :o] - :aa - (λ [] - (select.select_textobject "@parameter.outer" :textobjects)) - {}] [[:x :o] - :ia - (λ [] - (select.select_textobject "@parameter.inner" - :textobjects)) - {}] - [[:x :o] - :af - (λ [] - (select.select_textobject "@function.outer" :textobjects)) - {}] [[:x :o] - :if - (λ [] - (select.select_textobject "@function.inner" - :textobjects)) - {}] - [[:x :o] - :ii - (λ [] - (select.select_textobject "@conditional.outer" :textobjects)) - {}] [[:x :o] - :ai - (λ [] - (select.select_textobject "@conditional.inner" - :textobjects)) - {}] - [[:x :o] - :il - (λ [] - (select.select_textobject "@loop.outer" :textobjects)) - {}] [[:x :o] - :al - (λ [] - (select.select_textobject "@loop.inner" - :textobjects)) - {}] - [[:x :o] - :ac - (λ [] - (select.select_textobject "@class.outer" :textobjects)) - {}] [[:x :o] - :at - (λ [] - (select.select_textobject "@comment.outer" - :textobjects)) - {}] - [[:x :o] - :ic - (λ [] - (select.select_textobject "@class.inner" :textobjects)) - {}] [[:x :o] - :as - (λ [] - (select.select_textobject "@local.scope" - :locals)) - {}] ;; Swap - [:n - :<leader>a - (λ [] - (swap.swap_next "@parameter.inner")) - {}] [:n - :<leader>A - (λ [] - (swap.swap_previous "@parameter.inner")) - {}] ;; Move - [[:n :x :o] - "]m" - (λ [] - (move.goto_next_start "@function.outer" :textobjects)) - {}] [[:n :x :o] - "]]" - (λ [] - (move.goto_next_start "@class.outer" - :textobjects)) - {}] - [[:n :x :o] - "]o" - (λ [] - (move.goto_next_start ["@loop.inner" "@loop.outer"] - :textobjects)) - {}] [[:n :x :o] - "]s" - (λ [] - (move.goto_next_start "@local.scope" :locals)) - {}] - [[:n :x :o] - "]z" - (λ [] - (move.goto_next_start "@fold" :folds)) - {}] [[:n :x :o] - "]M" - (λ [] - (move.goto_next_end "@function.outer" - :textobjects)) - {}] - [[:n :x :o] - "][" - (λ [] - (move.goto_next_end "@class.outer" :textobjects)) - {}] [[:n :x :o] - "[m" - (λ [] - (move.goto_previous_start "@function.outer" - :textobjects)) - {}] - [[:n :x :o] - "[[" - (λ [] - (move.goto_previous_start "@class.outer" :textobjects)) - {}] [[:n :x :o] - "[M" - (λ [] - (move.goto_previous_end "@function.outer" - :textobjects)) - {}] - [[:n :x :o] - "[]" - (λ [] - (move.goto_previous_end "@class.outer" :textobjects)) - {}] [[:n :x :o] - "]i" - (λ [] - (move.goto_next "@conditional.outer" - :textobjects)) - {}] - [[:n :x :o] - "[i" - (λ [] - (move.goto_previous "@conditional.outer" :textobjects)) - {}]))) + (ts-selects [:aa "@parameter.outer"] [:ia "@parameter.inner"] + [:af "@function.outer"] [:if "@function.inner"] + [:ii "@conditional.outer"] [:ai "@conditional.inner"] + [:il "@loop.outer"] [:al "@loop.inner"] [:ac "@class.outer"] + [:at "@comment.outer"] [:ic "@class.inner"] + [:as "@local.scope" :locals] + [:ar "@return.outer"] + [:ir "@return.inner"] + [:a= "@assignment.outer"] + [:i= "@assignment.inner"]) + (ts-swaps [:<leader>a swap.swap_next "@parameter.inner"] + [:<leader>A swap.swap_previous "@parameter.inner"]) + (ts-moves ["]m" move.goto_next_start "@function.outer"] + ["]]" move.goto_next_start "@class.outer"] + ["]o" move.goto_next_start ["@loop.inner" "@loop.outer"]] + ["]s" move.goto_next_start "@local.scope" :locals] + ["]z" move.goto_next_start "@fold" :folds] + ["]M" move.goto_next_end "@function.outer"] + ["][" move.goto_next_end "@class.outer"] + ["[m" move.goto_previous_start "@function.outer"] + ["[[" move.goto_previous_start "@class.outer"] + ["[M" move.goto_previous_end "@function.outer"] + ["[]" move.goto_previous_end "@class.outer"] + ["]i" move.goto_next "@conditional.outer"] + ["[i" move.goto_previous "@conditional.outer"] + ["]a" move.goto_next_start "@parameter.outer"] + ["[a" move.goto_previous_start "@parameter.outer"]))) (λ config [] (let [treesitter (require :nvim-treesitter)] diff --git a/fnl/plugins/window-picker.fnl b/fnl/plugins/window-picker.fnl index fa03722..7ddafa5 100644 --- a/fnl/plugins/window-picker.fnl +++ b/fnl/plugins/window-picker.fnl @@ -1,4 +1,5 @@ ;; Select buffer +(import-macros {: keymap} :macros) (local opts {:other_win_hl_color "#171717" :fg_color "#E1E1E1" @@ -13,7 +14,7 @@ (λ config [] (let [window-picker (require :window-picker)] (window-picker.setup opts) - (vim.keymap.set :n :mw (λ [] - (pick-window)) {}))) + (keymap :n :mw (λ [] + (pick-window)) {}))) {1 :s1n7ax/nvim-window-picker :event :VeryLazy :version :2.0.0 : config} diff --git a/lazy-lock.json b/lazy-lock.json index d3a5476..af68845 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -6,25 +6,25 @@ "dial.nvim": { "branch": "master", "commit": "f2634758455cfa52a8acea6f142dcd6271a1bf57" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "easyread.nvim": { "branch": "main", "commit": "0b07e315a4cd7d700c4a794bdddbec79fdc2628b" }, - "fff.nvim": { "branch": "main", "commit": "c450a8d346fec507286c4e3e564f3da89d051838" }, + "fff.nvim": { "branch": "main", "commit": "4daf8bbc50e5876b9e212c37d4b01f0b999a3539" }, "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, "git-worktree.nvim": { "branch": "master", "commit": "666f84ba8dd9172f0a7b45c9f7c24bc5e55f6fc2" }, - "gitsigns.nvim": { "branch": "main", "commit": "8d82c240f190fc33723d48c308ccc1ed8baad69d" }, + "gitsigns.nvim": { "branch": "main", "commit": "6d808f99bd63303646794406e270bd553ad7792e" }, "grug-far.nvim": { "branch": "main", "commit": "21604255d0e8f9968322f61f2b6c09e5efe1285a" }, "harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" }, "hotpot.nvim": { "branch": "main", "commit": "b24f6a1d5b97018aeb8cca7d227b60308d6e1887" }, "kulala.nvim": { "branch": "main", "commit": "6656c9d332735ca6a27725e0fb45a1715c4372d9" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, "leap-spooky.nvim": { "branch": "main", "commit": "2d48433a81164aa102cc2c3fcbdb4d998be05570" }, - "leap.nvim": { "branch": "main", "commit": "b960d5038c5c505c52e56a54490f9bbb1f0e6ef6" }, + "leap.nvim": { "branch": "main", "commit": "ce3cf75200ae148d75563088f435389f9e4100fd" }, "lualine.nvim": { "branch": "master", "commit": "a905eeebc4e63fdc48b5135d3bf8aea5618fb21c" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "0a3b42c3e503df87aef6d6513e13148381495c3a" }, "mason.nvim": { "branch": "main", "commit": "b03fb0f20bc1d43daf558cda981a2be22e73ac42" }, - "neogit": { "branch": "master", "commit": "e906fce7e44ae562f06345be99a7db02f8315236" }, + "neogit": { "branch": "master", "commit": "d1cfc4986195239cac55700b675cea7a9578d430" }, "nvim-bqf": { "branch": "main", "commit": "c282a62bec6c0621a1ef5132aa3f4c9fc4dcc2c7" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-lint": { "branch": "master", "commit": "eab58b48eb11d7745c11c505e0f3057165902461" }, - "nvim-lspconfig": { "branch": "master", "commit": "4b7fbaa239c5db6b36f424a4521ca9f1a401be33" }, + "nvim-lspconfig": { "branch": "master", "commit": "e05fb8c3bd61d909dacff24f77f23beb644daf54" }, "nvim-surround": { "branch": "main", "commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1" }, "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" }, "nvim-treesitter-context": { "branch": "master", "commit": "b0c45cefe2c8f7b55fc46f34e563bc428ef99636" }, @@ -32,6 +32,7 @@ "nvim-various-textobjs": { "branch": "main", "commit": "ad78e9d925c95d675b32dd7ba6d253f96ce063fe" }, "nvim-web-devicons": { "branch": "master", "commit": "c72328a5494b4502947a022fe69c0c47e53b6aa6" }, "nvim-window-picker": { "branch": "main", "commit": "2c8200c5cbcdaac01dfe2c049997a1ca178506d8" }, + "octo.nvim": { "branch": "master", "commit": "0384ae6b308725d29e735b02c5797e46edee52d0" }, "oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" }, "org-bullets.nvim": { "branch": "main", "commit": "503fe053550879cc202086a40454e46a87c41ddb" }, "org-roam.nvim": { "branch": "main", "commit": "6c21c867b178a80fb4ad243c445545e5583d8232" }, @@ -41,7 +42,7 @@ "render-markdown.nvim": { "branch": "main", "commit": "0fd43fb4b1f073931c4b481f5f3b7cea3749e190" }, "schemastore.nvim": { "branch": "main", "commit": "250aed7415ddd6cb3ea321490c7b35094ed9148d" }, "telescope-orgmode.nvim": { "branch": "main", "commit": "0a9872f7932bcf4d08a8278b1493119ffcdc83c6" }, - "telescope.nvim": { "branch": "master", "commit": "471eebb1037899fd942cc0f52c012f8773505da1" }, + "telescope.nvim": { "branch": "master", "commit": "028d9a0695a0cc4cfa893889f8c408ed7ccc8adc" }, "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, "ts-comments.nvim": { "branch": "main", "commit": "123a9fb12e7229342f807ec9e6de478b1102b041" }, "undotree": { "branch": "master", "commit": "6fa6b57cda8459e1e4b2ca34df702f55242f4e4d" }, diff --git a/nvim.log b/nvim.log deleted file mode 100644 index c46974d..0000000 --- a/nvim.log +++ /dev/null @@ -1,2 +0,0 @@ -WRN 2026-04-17T00:07:07.654 ui.434 tui_handle_term_mode:239: TUI: terminal mode 2031 detected, state 2 -WRN 2026-04-17T00:07:25.334 ui.854 tui_handle_term_mode:239: TUI: terminal mode 2031 detected, state 2 |