From 0903f1234fbcdfe01b2fa5384aa1187a87316d16 Mon Sep 17 00:00:00 2001 From: Proctor Date: Fri, 2 May 2025 16:14:38 -0500 Subject: [PATCH] nvim - more migration to pure fennel away from aniseed --- nvim/.config/nvim/fnl/dotfiles/conceal.fnl | 2 +- .../nvim/fnl/dotfiles/plugin/fugitive.fnl | 21 ++++---- .../nvim/fnl/dotfiles/plugin/lspconfig.fnl | 28 ++++++---- .../nvim/fnl/dotfiles/plugin/mason.fnl | 18 ++++--- .../nvim/fnl/dotfiles/plugin/orgbullets.fnl | 19 +++---- .../nvim/fnl/dotfiles/plugin/paredit.fnl | 54 +++++-------------- nvim/.config/nvim/fnl/dotfiles/plugins.fnl | 6 ++- .../nvim/fnl/dotfiles/terraform-helpers.fnl | 16 +++--- 8 files changed, 71 insertions(+), 93 deletions(-) diff --git a/nvim/.config/nvim/fnl/dotfiles/conceal.fnl b/nvim/.config/nvim/fnl/dotfiles/conceal.fnl index 8e04427..3312dc3 100644 --- a/nvim/.config/nvim/fnl/dotfiles/conceal.fnl +++ b/nvim/.config/nvim/fnl/dotfiles/conceal.fnl @@ -55,4 +55,4 @@ (vim.api.nvim_create_autocmd [:FileType] {:pattern ftype :callback setup-conceals})) -{} +{: setup-conceals} diff --git a/nvim/.config/nvim/fnl/dotfiles/plugin/fugitive.fnl b/nvim/.config/nvim/fnl/dotfiles/plugin/fugitive.fnl index c3f3cd7..7335109 100644 --- a/nvim/.config/nvim/fnl/dotfiles/plugin/fugitive.fnl +++ b/nvim/.config/nvim/fnl/dotfiles/plugin/fugitive.fnl @@ -1,10 +1,13 @@ -(module dotfiles.plugin.fugitive - {autoload {nvim aniseed.nvim - nu aniseed.nvim.util - core aniseed.core - util dotfiles.util}}) - +(local util (require :dotfiles.util)) ;; Determine load time of fugitive -(nvim.ex.autocmd :FileType :fugitive :nmap : :gp ":Git pull") -(nvim.ex.autocmd :FileType :fugitive :nmap : :gP ":Git push" ) -(nvim.ex.autocmd :FileType :fugitive :nmap : :gF ":Git push -f" ) +;; (vim.api.nvim_create_autocmd [:FileType] {:pattern ftype :callback setup-conceals}) + +(fn bufmap [mode from to] (util.noremap mode from to {:local? true})) + +(fn map-fugitive-keys [] + (bufmap :n :gp ":Git pull" ) + (bufmap :n :gP ":Git push") + (bufmap :n :gF ":Git push -f")) + +(vim.api.nvim_create_autocmd [:FileType] + {:pattern :fugitive :callback map-fugitive-keys}) diff --git a/nvim/.config/nvim/fnl/dotfiles/plugin/lspconfig.fnl b/nvim/.config/nvim/fnl/dotfiles/plugin/lspconfig.fnl index fcad18d..7ad30d0 100644 --- a/nvim/.config/nvim/fnl/dotfiles/plugin/lspconfig.fnl +++ b/nvim/.config/nvim/fnl/dotfiles/plugin/lspconfig.fnl @@ -1,10 +1,8 @@ -(module dotfiles.plugin.lspconfig - {autoload {a aniseed.core - u dotfiles.util - nvim aniseed.nvim - lsp vim.lsp - lspconfig lspconfig - cmp_nvim_lsp cmp_nvim_lsp}}) +(local a (require :aniseed.core)) +(local u (require :dotfiles.util)) +(local lsp (require :vim.lsp)) +(local lspconfig (require :lspconfig)) +(local cmp_nvim_lsp (require :cmp_nvim_lsp)) (fn bufmap [mode from to] (u.noremap mode from to {:local? true})) @@ -110,11 +108,12 @@ ; -- buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) ; -- buf_set_keymap('n', 'ic', "lua vim.lsp.buf.incoming_calls()", opts) ; -- buf_set_keymap('x', 'ic', "lua vim.lsp.buf.incoming_calls()", opts) - (nvim.buf_set_option 0 :omnifunc "v:lua.vim.lsp.omnifunc") + (vim.api.nvim_set_option_value :omnifunc "v:lua.vim.lsp.omnifunc" {:buf 0}) (bind-client-mappings client) (if client.server_capabilities.documentFormattingProvider - (nvim.ex.autocmd :BufWritePre : ":lua vim.lsp.buf.format()")) ; (nvim.ex.autocmd "BufEnter,CursorHold,InsertLeave" : :lua "vim.lsp.codelens.refresh()") - ; client autocmds ; -- vim.api.nvim_command[[autocmd BufWritePre lua vim.lsp.buf_request_sync(vim.api.nvim_get_current_buf(), 'workspace/executeCommand', {command = 'clean-ns', arguments = {vim.uri_from_bufnr(1), vim.api.nvim_win_get_cursor(0)[1], vim.api.nvim_win_get_cursor(0)[2]}, title = 'Clean Namespace'})]] + (vim.api.nvim_create_autocmd [:BufWritePre] + {:pattern : + :callback (lambda [] (vim.lsp.buf.format))})) (print "LSP Client Attached.")) (local base-server-opts @@ -124,7 +123,7 @@ (fn default-server-handler [server-name] (let [specific-opts (a.get server-specific-opts server-name {}) server (a.get lspconfig server-name) - server-opts (a.merge base-server-opts server-opts)] + server-opts (a.merge base-server-opts specific-opts)] (server.setup server-opts))) (fn lsp-execute-command [cmd ...] @@ -139,3 +138,10 @@ (u.nnoremap :li :LspInfo) (vim.api.nvim_create_user_command :LspExecuteCommand lsp-execute-command {}) + +; (let [mason-lspconfig (require :mason-lspconfig)] +; (when mason-lspconfig +; (mason-lspconfig.setup) +; (mason-lspconfig.setup_handlers [default-server-handler]))) + +{: on_attach : default-server-handler} diff --git a/nvim/.config/nvim/fnl/dotfiles/plugin/mason.fnl b/nvim/.config/nvim/fnl/dotfiles/plugin/mason.fnl index ee60442..de435ba 100644 --- a/nvim/.config/nvim/fnl/dotfiles/plugin/mason.fnl +++ b/nvim/.config/nvim/fnl/dotfiles/plugin/mason.fnl @@ -1,12 +1,14 @@ +(local mason (require :mason)) +(local mason-lspconf (require :mason-lspconfig) ) +(local lspconfig (require :dotfiles.plugin.lspconfig)) + +(local a (require :aniseed.core)) + (fn setup [] - (let [mason (require :mason) - mason-lspconf (require :mason-lspconfig) - lspconfig (require :dotfiles.plugin.lspconfig)] - (when mason - (mason.setup {:ui {:icons {:package_installed "✓"}}}) - (when mason-lspconf - (mason-lspconf.setup {:ensure_installed [:lua_ls]}) - (mason-lspconf.setup_handlers {1 lspconfig.default-server-handler}))))) + (mason.setup {:ui {:icons {:package_installed "✓"}}}) + (when mason-lspconf + (mason-lspconf.setup {:ensure_installed [:lua_ls]}) + (mason-lspconf.setup_handlers [lspconfig.default-server-handler]))) (setup) ;; (mason.setup) diff --git a/nvim/.config/nvim/fnl/dotfiles/plugin/orgbullets.fnl b/nvim/.config/nvim/fnl/dotfiles/plugin/orgbullets.fnl index c83d4d9..c2829bd 100644 --- a/nvim/.config/nvim/fnl/dotfiles/plugin/orgbullets.fnl +++ b/nvim/.config/nvim/fnl/dotfiles/plugin/orgbullets.fnl @@ -1,6 +1,5 @@ -(module dotfiles.plugin.orgbullets {autoload {nvim aniseed.nvim}}) - (local core (require :aniseed.core)) +(local conceal (require :dotfiles.conceal)) (local ts-utils (require :dotfiles.ts-utils)) (local stars ["◉" "⦾" "○" "✸" "✿" "✶" "•" "‣"]) @@ -37,12 +36,10 @@ :virt_text_pos :overlay :hl_mode :combine})))))) -(let [group (nvim.create_augroup :HeaderStars {:clear true})] - (nvim.create_autocmd [:FileChangedShellPost - :Syntax - :TextChanged - :InsertLeave - :WinScrolled] - {: group - ;; :pattern [:*.org] - :callback gen-star-extmarks})) +(let [group (vim.api.nvim_create_augroup :HeaderStars {:clear true})] + (vim.api.nvim_create_autocmd [:FileChangedShellPost + :Syntax + :TextChanged + :InsertLeave + :WinScrolled] + {: group :callback conceal.setup-conceals})) diff --git a/nvim/.config/nvim/fnl/dotfiles/plugin/paredit.fnl b/nvim/.config/nvim/fnl/dotfiles/plugin/paredit.fnl index f9a485e..96b3a9e 100644 --- a/nvim/.config/nvim/fnl/dotfiles/plugin/paredit.fnl +++ b/nvim/.config/nvim/fnl/dotfiles/plugin/paredit.fnl @@ -1,11 +1,8 @@ -(module dotfiles.plugin.paredit - {autoload {nvim aniseed.nvim - paredit paredit - ts-parsers nvim-treesitter.parsers - ts-utils nvim-treesitter.ts_utils - languagetree vim.treesitter.languagetree}}) - (local a (require :aniseed.core)) +(local treesitter (require :dotfiles.plugin.treesitter)) +(local ts-parsers (require :nvim-treesitter.parsers)) +(local ts-utils (require :nvim-treesitter.ts_utils)) +(local languagetree (require :vim.treesitter.languagetree)) (set vim.g.paredit_smartjump 1) @@ -60,42 +57,15 @@ (->> cursor-lang (paredit-lang?) (bool->int) - (set nvim.g.paredit_mode)) - (nvim.fn.PareditInitBuffer)))) + (set vim.g.paredit_mode)) + (vim.fn.PareditInitBuffer)))) -(nvim.ex.autocmd :FileType :ruby :call - "PareditInitBalancingAllBracketsBuffer()") +(vim.api.nvim_create_autocmd [:FileType] + {:pattern :ruby :callback (lambda [] (vim.fn.PareditInitBalancingAllBracketsBuffer))}) -(nvim.ex.autocmd :FileType :javascript :call - "PareditInitBalancingAllBracketsBuffer()") +(vim.api.nvim_create_autocmd [:FileType] + {:pattern :javascript :callback (lambda [] (vim.fn.PareditInitBalancingAllBracketsBuffer))}) -(nvim.ex.autocmd :FileType :terraform :call - "PareditInitBalancingAllBracketsBuffer()") +(vim.api.nvim_create_autocmd [:FileType] + {:pattern terraform :callback (lambda [] ( vim.fn.PareditInitBalancingAllBracketsBuffer))}) -; (nvim.del_augroup_by_name "BabeliteParedit") -; (nvim.get_autocmds {:group "BabeliteParedit"}) - -;;(let [group (nvim.create_augroup :BabeliteParedit {:clear true})] -;; (nvim.create_autocmd [:CursorHold :CursorMoved] -;; {: group -;; ;:pattern ["*.org" "*.md"] -;; :callback TreeSitterLangParedit})) -;; - -;; (fn paredit-toggle! [] (toggle-global :paredit_mode) -;; (nvim.fn.PareditInitBuffer) -;; nvim.g.paredit_mode -;; ) -;; -;; \ -;; (int->bool 0) -;; (fn test [x] (a.get nvim.g x)) -;; -;; (test :pareditmode) -;; (a.get nvim.g :paredit_mode) -;; (comment ; -;; nvim.g.paredit_mode -;; ; -;; -;; (paredit-toggle!) -;; ) diff --git a/nvim/.config/nvim/fnl/dotfiles/plugins.fnl b/nvim/.config/nvim/fnl/dotfiles/plugins.fnl index b22df7f..94c3a2d 100644 --- a/nvim/.config/nvim/fnl/dotfiles/plugins.fnl +++ b/nvim/.config/nvim/fnl/dotfiles/plugins.fnl @@ -47,7 +47,8 @@ :nvimtools/none-ls.nvim {:mod :null-ls :requires [:nvim-lua/plenary.nvim]} :junegunn/vim-easy-align {:mod :easyalign} - :kovisoft/paredit {:mod :paredit} + :kovisoft/paredit {:mod :paredit + :require [:nvim-treesitter/nvim-treesitter] } :kristijanhusak/vim-dadbod-completion {} :kristijanhusak/vim-dadbod-ui {} :L3MON4D3/LuaSnip {:mod :luasnip} @@ -86,7 +87,8 @@ :wbthomason/packer.nvim {:mod :packer} ;; :williamboman/nvim-lsp-installbuilder {} :williamboman/mason.nvim {:mod :mason - :requires [:williamboman/mason-lspconfig.nvim]} + :requires [:williamboman/mason-lspconfig.nvim + :neovim/nvim-lspconfig]} ; NeoVim lsp server installs ; :p00f/nvim-ts-rainbow {} ; :luochen1990/rainbow {} diff --git a/nvim/.config/nvim/fnl/dotfiles/terraform-helpers.fnl b/nvim/.config/nvim/fnl/dotfiles/terraform-helpers.fnl index 2f6e65d..26486b2 100644 --- a/nvim/.config/nvim/fnl/dotfiles/terraform-helpers.fnl +++ b/nvim/.config/nvim/fnl/dotfiles/terraform-helpers.fnl @@ -1,16 +1,14 @@ -(module dotfiles.terraform-helpers {require {nvim aniseed.nvim}}) - (fn append-to-buf [bufno lines] (when lines - (nvim.buf_set_lines buffno -1 -1 false lines))) + (vim.aip.nvim_buf_set_lines bufno -1 -1 false lines))) (var tf-log-bufno nil) -(fn terraform-import [] - (vim.fn.jobstart [:terraform :import :-no-color address id] - {:stdout_buffered true - :on_stdout (fn [_ data] - (append-to-buf bufno data))})) - +;; (fn terraform-import [] +;; (vim.fn.jobstart [:terraform :import :-no-color address id] +;; {:stdout_buffered true +;; :on_stdout (fn [_ data] +;; (append-to-buf tf-log-bufno data))})) +;; ; (nu.fn-bridge :ZoomToggle :dotfiles.zoom-toggle :zoom-toggle {:return false}) ; (u.nnoremap :z ":call ZoomToggle()")