diff options
Diffstat (limited to 'fnl/plugins')
| -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 |
7 files changed, 83 insertions, 165 deletions
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} |