start of move to lazy.nvim for plugin management

This commit is contained in:
proctor committed 2026-03-10 11:10:03 -05:00
1 parent f9510ce4c4
commit f2dbbdf779
39 files changed
+1269 -182

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@
;; (require-all)
(require :dotfiles.core)
(require :dotfiles.plugins)
;; (require :dotfiles.plugins)
(require :dotfiles.mapping)
(require :dotfiles.conceal)
(require :dotfiles.zoom-toggle)
@@ -1,5 +1,5 @@
(local a (require :nfnl.core))
(local treesitter (require :dotfiles.plugin.treesitter))
;; (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))
+151 -150
View File
@@ -1,150 +1,151 @@
(local packer (require :packer))
(local core (require :nfnl.core))
(fn safe-require-plugin-config [name]
(let [(ok? val-or-err) (pcall require (.. :dotfiles.plugin. name))]
(when (not ok?)
(print (.. "dotfiles error: " val-or-err)))))
(fn use [pkgs]
"Iterates through the arguments as pairs and calls packer's use function for
each of them. Works around Fennel not liking mixed associative and sequential
tables as well."
(packer.startup (fn [use]
(each [name opts (pairs pkgs)]
(-?> (. opts :mod) (safe-require-plugin-config))
(use (core.assoc opts 1 name))))))
(local packages {:Olical/nfnl {}
:Olical/conjure {:mod :conjure}
:Olical/fennel.vim {}
:ahmedkhalf/project.nvim {}
:airblade/vim-gitgutter {}
:akinsho/toggleterm.nvim {:mod :toggleterm}
:clojure-vim/vim-jack-in {}
:christianrondeau/vim-base64 {}
:dhruvasagar/vim-table-mode {}
:folke/lsp-colors.nvim {}
:folke/which-key.nvim {:mod :whichkey}
:gbprod/yanky.nvim {:mod :yanky}
:hashivim/vim-terraform {}
:HiPhish/rainbow-delimiters.nvim {}
:hrsh7th/nvim-cmp {:requires [:hrsh7th/cmp-buffer
:hrsh7th/cmp-emoji
:hrsh7th/cmp-nvim-lsp
:hrsh7th/cmp-nvim-lua
:hrsh7th/cmp-path
:hrsh7th/cmp-vsnip
:hrsh7th/vim-vsnip-integ
:L3MON4D3/LuaSnip
:PaterJason/cmp-conjure
:saadparwaiz1/cmp_luasnip]
:mod :cmp}
:hrsh7th/vim-vsnip {}
:hrsh7th/vim-vsnip-integ {}
:Iron-E/nvim-soluarized {}
:jiangmiao/auto-pairs {}
:nvimtools/none-ls.nvim {:mod :null-ls
:requires [:nvim-lua/plenary.nvim]}
:junegunn/vim-easy-align {:mod :easyalign}
:kovisoft/paredit {:mod :paredit
:require [:nvim-treesitter/nvim-treesitter]}
:kristijanhusak/vim-dadbod-completion {}
:kristijanhusak/vim-dadbod-ui {}
:L3MON4D3/LuaSnip {:mod :luasnip}
:lifepillar/vim-solarized8 {}
:lukas-reineke/headlines.nvim {:mod :headlines}
; :michaelb/sniprun {:run "bash ./install.sh" :mod :sniprun}
:mrjones2014/smart-splits.nvim {:mod :smartsplits}
:mechatroner/rainbow_csv {}
:MunifTanjim/nui.nvim {}
:neovim/nvim-lspconfig {:mod :lspconfig}
:norcalli/nvim-colorizer.lua {:mod :colorizer}
:nvim-neo-tree/neo-tree.nvim {:branch :v3.x
:require [:nvim-lua/plenary.nvim
:nvim-tree/nvim-web-devicons
; not strictly required, but recommended
:MunifTanjim/nui.nvim
; :3rd/image.nvim, ; Optional image support in preview window: See `# Preview Mode` for more information
]}
:nvim-orgmode/orgmode {:mod :orgmode}
:nvim-telescope/telescope.nvim {:requires [[:nvim-lua/popup.nvim]
[:nvim-lua/plenary.nvim]]
:mod :telescope}
:nvim-tree/nvim-web-devicons {}
:nvim-treesitter/nvim-treesitter {:run ":TSUpdate"
:mod :treesitter}
:nvim-treesitter/playground {}
:radenling/vim-dispatch-neovim {}
:RaafatTurki/hex.nvim {:mod :hex}
:rafamadriz/friendly-snippets {}
:skywind3000/asyncrun.vim {}
;; :tjdevries/sg.nvim {:run "cargo build --workspace"
;; :dependencies [:nvim-lua/plenary.nvim]}
;; :tpope/vim-classpath {}
:tpope/vim-dadbod {}
:tpope/vim-dispatch {}
:tpope/vim-fugitive {:mod :fugitive}
:tpope/vim-git {}
:tpope/vim-pathogen {}
:tpope/vim-rails {}
:tpope/vim-repeat {}
:tpope/vim-rhubarb {}
:tpope/vim-surround {}
:tpope/vim-unimpaired {}
:tpope/vim-vinegar {}
:wbthomason/packer.nvim {:mod :packer}
;; :williamboman/nvim-lsp-installbuilder {}
:williamboman/mason.nvim {:mod :mason
:requires [:williamboman/mason-lspconfig.nvim
:neovim/nvim-lspconfig]}
; NeoVim lsp server installs
; :p00f/nvim-ts-rainbow {}
; :luochen1990/rainbow {}
; :thecontinium/asyncomplete-conjure.vim {}
; :jose-elias-alvarez/null-ls.nvim {:mod :null-ls
; :requires [:nvim-lua/plenary.nvim]}
}
; :tpope/vim-fireplace {} ; Clojure ; :tpope/vim-sexp-mappings-for-regular-people {}
)
(use packages)
;; call minpac#add('dense-analysis/ale') " Linting
;; call minpac#add('editorconfig/editorconfig-vim')
;; call minpac#add('elixir-lang/vim-elixir') " Elixir
;; call minpac#add('ElmCast/elm-vim') " Elm
;; call minpac#add('jgdavey/tslime.vim', {'branch': 'main'}) " Send to Tmux
;; call minpac#add('leafgarland/typescript-vim') " TypeScript
;; call minpac#add('idris-hackers/idris-vim') " Idris
;; call minpac#add('mxw/vim-jsx') " React JSX support
;; call minpac#add('neomake/neomake') " Linting/Make
;; call minpac#add('nvie/vim-flake8') " Python
;; call minpac#add('pangloss/vim-javascript') " JavaScript
;; call minpac#add('prabirshrestha/async.vim') " Vim/NeoVim async normalization
;; call minpac#add('prabirshrestha/asyncomplete.vim') " Language Server Protocol
;; call minpac#add('raichoo/purescript-vim') " PureScript
;; call minpac#add('reasonml-editor/vim-reason') " ReasonML
;; call minpac#add('thoughtbot/vim-rspec')
;; call minpac#add('vim-erlang/erlang-motions.vim') " Erlang
;; call minpac#add('vim-erlang/vim-erlang-runtime') " Erlang
;; call minpac#add('vim-erlang/vim-erlang-compiler') " Erlang
;; call minpac#add('vim-erlang/vim-erlang-omnicomplete') " Erlang
;; call minpac#add('vim-erlang/vim-erlang-tags') " Erlang
;; call minpac#add('vim-erlang/vim-erlang-skeletons') " Erlang
;; call minpac#add('vim-ruby/vim-ruby') " Ruby
;; call minpac#add('vim-syntastic/syntastic')
;; call minpac#add('vim-jp/syntax-vim-ex')
;; call minpac#add('tsandall/vim-rego') " Rego
;;
;; " call minpac#add('guns/vim-clojure-static') " Clojure
;; "" call minpac#add('guns/vim-sexp') " Lisps
;; " call minpac#add('ncm2/float-preview.nvim') " autocomplete with preview
;; " call minpac#add('Shougo/deoplete.nvim') " async completion
;; " call minpac#add('prabirshrestha/vim-lsp') " Language Server Protocol
;; " call minpac#add('rhysd/vim-lsp-ale') " vim-lsp + ALE
;; " call minpac#add('mattn/vim-lsp-settings') " Generic LSP Server install and settings for all languages
;; " call minpac#add('prabirshrestha/asyncomplete-lsp.vim') " Language Server Protocol
;; " call minpac#add('prabirshrestha/vim-lsp') " Language Server Protocol
;; " call minpac#add('rhysd/vim-lsp-ale') " vim-lsp + ALE
;; (local packer (require :packer))
;; (local core (require :nfnl.core))
;;
;; (fn safe-require-plugin-config [name]
;; (let [(ok? val-or-err) (pcall require (.. :dotfiles.plugin. name))]
;; (when (not ok?)
;; (print (.. "dotfiles error: " val-or-err)))))
;;
;; (fn use [pkgs]
;; "Iterates through the arguments as pairs and calls packer's use function for
;; each of them. Works around Fennel not liking mixed associative and sequential
;; tables as well."
;; (packer.startup (fn [use]
;; (each [name opts (pairs pkgs)]
;; (-?> (. opts :mod) (safe-require-plugin-config))
;; (use (core.assoc opts 1 name))))))
;;
;; (local packages {
;; :Olical/nfnl {}
;; :Olical/conjure {:mod :conjure}
;; :Olical/fennel.vim {}
;; :ahmedkhalf/project.nvim {}
;; :airblade/vim-gitgutter {}
;; :akinsho/toggleterm.nvim {:mod :toggleterm}
;; :clojure-vim/vim-jack-in {}
;; :christianrondeau/vim-base64 {}
;; :dhruvasagar/vim-table-mode {}
;; :folke/lsp-colors.nvim {}
;; :folke/which-key.nvim {:mod :whichkey}
;; :gbprod/yanky.nvim {:mod :yanky}
;; :hashivim/vim-terraform {}
;; :HiPhish/rainbow-delimiters.nvim {}
;; :hrsh7th/nvim-cmp {:requires [:hrsh7th/cmp-buffer
;; :hrsh7th/cmp-emoji
;; :hrsh7th/cmp-nvim-lsp
;; :hrsh7th/cmp-nvim-lua
;; :hrsh7th/cmp-path
;; :hrsh7th/cmp-vsnip
;; :hrsh7th/vim-vsnip-integ
;; :L3MON4D3/LuaSnip
;; :PaterJason/cmp-conjure
;; :saadparwaiz1/cmp_luasnip]
;; :mod :cmp}
;; :hrsh7th/vim-vsnip {}
;; :hrsh7th/vim-vsnip-integ {}
;; :Iron-E/nvim-soluarized {}
;; :jiangmiao/auto-pairs {}
;; :nvimtools/none-ls.nvim {:mod :null-ls
;; :requires [:nvim-lua/plenary.nvim]}
;; :junegunn/vim-easy-align {:mod :easyalign}
;; :kovisoft/paredit {:mod :paredit
;; :require [:nvim-treesitter/nvim-treesitter]}
;; :kristijanhusak/vim-dadbod-completion {}
;; :kristijanhusak/vim-dadbod-ui {}
;; :L3MON4D3/LuaSnip {:mod :luasnip}
;; :lifepillar/vim-solarized8 {}
;; :lukas-reineke/headlines.nvim {:mod :headlines}
;; ; :michaelb/sniprun {:run "bash ./install.sh" :mod :sniprun}
;; :mrjones2014/smart-splits.nvim {:mod :smartsplits}
;; :mechatroner/rainbow_csv {}
;; :MunifTanjim/nui.nvim {}
;; :neovim/nvim-lspconfig {:mod :lspconfig}
;; :norcalli/nvim-colorizer.lua {:mod :colorizer}
;; :nvim-neo-tree/neo-tree.nvim {:branch :v3.x
;; :require [:nvim-lua/plenary.nvim
;; :nvim-tree/nvim-web-devicons
;; ; not strictly required, but recommended
;; :MunifTanjim/nui.nvim
;; ; :3rd/image.nvim, ; Optional image support in preview window: See `# Preview Mode` for more information
;; ]}
;; :nvim-orgmode/orgmode {:mod :orgmode}
;; :nvim-telescope/telescope.nvim {:requires [[:nvim-lua/popup.nvim]
;; [:nvim-lua/plenary.nvim]]
;; :mod :telescope}
;; :nvim-tree/nvim-web-devicons {}
;; :nvim-treesitter/nvim-treesitter {:run ":TSUpdate"
;; :mod :treesitter}
;; :nvim-treesitter/playground {}
;; :radenling/vim-dispatch-neovim {}
;; :RaafatTurki/hex.nvim {:mod :hex}
;; :rafamadriz/friendly-snippets {}
;; :skywind3000/asyncrun.vim {}
;; ;; :tjdevries/sg.nvim {:run "cargo build --workspace"
;; ;; :dependencies [:nvim-lua/plenary.nvim]}
;; ;; :tpope/vim-classpath {}
;; :tpope/vim-dadbod {}
;; :tpope/vim-dispatch {}
;; :tpope/vim-fugitive {:mod :fugitive}
;; :tpope/vim-git {}
;; :tpope/vim-pathogen {}
;; :tpope/vim-rails {}
;; :tpope/vim-repeat {}
;; :tpope/vim-rhubarb {}
;; :tpope/vim-surround {}
;; :tpope/vim-unimpaired {}
;; :tpope/vim-vinegar {}
;; :wbthomason/packer.nvim {:mod :packer}
;; ;; :williamboman/nvim-lsp-installbuilder {}
;; :williamboman/mason.nvim {:mod :mason
;; :requires [:williamboman/mason-lspconfig.nvim
;; :neovim/nvim-lspconfig]}
;; ; NeoVim lsp server installs
;; ; :p00f/nvim-ts-rainbow {}
;; ; :luochen1990/rainbow {}
;; ; :thecontinium/asyncomplete-conjure.vim {}
;; ; :jose-elias-alvarez/null-ls.nvim {:mod :null-ls
;; ; :requires [:nvim-lua/plenary.nvim]}
;; }
;; ; :tpope/vim-fireplace {} ; Clojure ; :tpope/vim-sexp-mappings-for-regular-people {}
;; )
;;
;; (use packages)
;;
;; ;; call minpac#add('dense-analysis/ale') " Linting
;; ;; call minpac#add('editorconfig/editorconfig-vim')
;; ;; call minpac#add('elixir-lang/vim-elixir') " Elixir
;; ;; call minpac#add('ElmCast/elm-vim') " Elm
;; ;; call minpac#add('jgdavey/tslime.vim', {'branch': 'main'}) " Send to Tmux
;; ;; call minpac#add('leafgarland/typescript-vim') " TypeScript
;; ;; call minpac#add('idris-hackers/idris-vim') " Idris
;; ;; call minpac#add('mxw/vim-jsx') " React JSX support
;; ;; call minpac#add('neomake/neomake') " Linting/Make
;; ;; call minpac#add('nvie/vim-flake8') " Python
;; ;; call minpac#add('pangloss/vim-javascript') " JavaScript
;; ;; call minpac#add('prabirshrestha/async.vim') " Vim/NeoVim async normalization
;; ;; call minpac#add('prabirshrestha/asyncomplete.vim') " Language Server Protocol
;; ;; call minpac#add('raichoo/purescript-vim') " PureScript
;; ;; call minpac#add('reasonml-editor/vim-reason') " ReasonML
;; ;; call minpac#add('thoughtbot/vim-rspec')
;; ;; call minpac#add('vim-erlang/erlang-motions.vim') " Erlang
;; ;; call minpac#add('vim-erlang/vim-erlang-runtime') " Erlang
;; ;; call minpac#add('vim-erlang/vim-erlang-compiler') " Erlang
;; ;; call minpac#add('vim-erlang/vim-erlang-omnicomplete') " Erlang
;; ;; call minpac#add('vim-erlang/vim-erlang-tags') " Erlang
;; ;; call minpac#add('vim-erlang/vim-erlang-skeletons') " Erlang
;; ;; call minpac#add('vim-ruby/vim-ruby') " Ruby
;; ;; call minpac#add('vim-syntastic/syntastic')
;; ;; call minpac#add('vim-jp/syntax-vim-ex')
;; ;; call minpac#add('tsandall/vim-rego') " Rego
;; ;;
;;
;; ;; " call minpac#add('guns/vim-clojure-static') " Clojure
;; ;; "" call minpac#add('guns/vim-sexp') " Lisps
;; ;; " call minpac#add('ncm2/float-preview.nvim') " autocomplete with preview
;; ;; " call minpac#add('Shougo/deoplete.nvim') " async completion
;; ;; " call minpac#add('prabirshrestha/vim-lsp') " Language Server Protocol
;; ;; " call minpac#add('rhysd/vim-lsp-ale') " vim-lsp + ALE
;; ;; " call minpac#add('mattn/vim-lsp-settings') " Generic LSP Server install and settings for all languages
;; ;; " call minpac#add('prabirshrestha/asyncomplete-lsp.vim') " Language Server Protocol
;; ;; " call minpac#add('prabirshrestha/vim-lsp') " Language Server Protocol
;; ;; " call minpac#add('rhysd/vim-lsp-ale') " vim-lsp + ALE
+60
View File
@@ -0,0 +1,60 @@
(import-macros {: tx} :config.macros)
(tx "hrsh7th/nvim-cmp"
{:event "VeryLazy"
:main "cmp"
:dependencies ["hrsh7th/cmp-nvim-lsp"
"hrsh7th/cmp-buffer"
"hrsh7th/cmp-path"
"hrsh7th/cmp-cmdline"
:hrsh7th/vim-vsnip
:hrsh7th/vim-vsnip-integ
"PaterJason/cmp-conjure"
"Olical/conjure"
"nvim-lua/plenary.nvim"]
:config
(fn []
(let [cmp (require :cmp)]
(cmp.setup
{:sources (cmp.config.sources
[{:name "nvim_lsp" :group_index 2}
{:name "nvim_lua" :group_index 2}
{:name "vsnip" :group_index 2}
{:name "conjure" :group_index 2}
{:name "buffer" :group_index 2}
{:name :orgmode :group_index 2}
{:name :emoji :group_index 2 :max_item_count 8}])
:sorting {:priority_weight 2
:comparators [;; Below is the default comparator list and order for nvim-cmp
cmp.config.compare.offset
;; cmp.config.compare.scopes --this is commented in nvim-cmp too
cmp.config.compare.exact
cmp.config.compare.score
cmp.config.compare.recently_used
cmp.config.compare.locality
cmp.config.compare.kind
cmp.config.compare.sort_text
cmp.config.compare.length
cmp.config.compare.order]}
:window {:completion (cmp.config.window.bordered)
:documentation (cmp.config.window.bordered)}
:mapping (cmp.mapping.preset.insert
{:<C-p> (cmp.mapping.select_prev_item)
:<C-n> (cmp.mapping.select_next_item)
"<C-b>" (cmp.mapping.scroll_docs -4)
"<C-f>" (cmp.mapping.scroll_docs 4)
"<C-Space>" (cmp.mapping.complete)
"<C-e>" (cmp.mapping.abort)
"<C-y>" (cmp.mapping.confirm {:select true})})})
; (cmp.setup.cmdline
; ["/" "?"]
; {:mapping (cmp.mapping.preset.cmdline)
; :sources [{:name "buffer"}]})
(cmp.setup.cmdline
":"
{:mapping (cmp.mapping.preset.cmdline)
:sources (cmp.config.sources [{:name "path"} {:name "cmdline"}])
:matching {:disallow_symbol_nonprefix_matching false}})))})
@@ -0,0 +1,3 @@
(import-macros {: tx} :config.macros)
(tx :lifepillar/vim-solarized8 {})
+17
View File
@@ -0,0 +1,17 @@
(import-macros {: tx} :config.macros)
;; (local conjure-config (require :conjure.config))
; (set nvim.g.conjure#eval#result_register "*")
; (set nvim.g.conjure#log#botright true)
(set vim.g.conjure#mapping#doc_word :gk)
(set vim.g.conjure#client#clojure#nrepl#mapping#session_clone :sC)
(set vim.g.conjure#extract#tree_sitter#enabled true)
(set vim.g.conjure#filetype#fennel "conjure.client.fennel.nfnl")
;; (conjure-config.assoc-in [:filetypes]
;; (core.concat (conjure-config.filetypes) [:markdown]))
;; (conjure-config.assoc-in [:filetype :markdown] :conjure.client.clojure.nrepl)
(tx "Olical/conjure"
{:event "VeryLazy"})
+3
View File
@@ -0,0 +1,3 @@
(import-macros {: tx} :config.macros)
(tx "micampe/fennel.vim")
+343
View File
@@ -0,0 +1,343 @@
(import-macros {: tx} :config.macros)
;
;
(vim.diagnostic.config {:signs {:text {vim.diagnostic.severity.ERROR "☢️"
vim.diagnostic.severity.WARN "⚠️"
vim.diagnostic.severity.INFO "ℹ️"
vim.diagnostic.severity.HINT "🔎"}
;; :linehl {vim.diagnostic.severity.ERROR :ErrorMsg}
;; :numhl {vim.diagnostic.severity.WARN :WarningMsg}
}})
(local client-nmappings {:clojure_lsp {;;:<leader>cn "call LspExecuteCommand('clean-ns')"
;; :<leader>ref "call LspExecuteCommand('extract-function', input('Function name: '))"
;; :<leader>id "call LspExecuteCommand('inline-symbol')"
;; :<leader>il "call LspExecuteCommand('introduce-let', input('Binding name: '))"
;;:<leader>m2l "call LspExecuteCommand('move-to-let', input('Binding name: '))"
}})
(local client-command-lnmappings
{:clojure_lsp {:ai [:add-import-to-namespace
[(lambda [] (vim.fn.input "Namespace name: "))]]
:am [:add-missing-libspec []]
:as [:add-require-suggestion
[(lambda [] (vim.fn.input "Namespace name: "))
(lambda [] (vim.fn.input "Namespace as: "))
(lambda [] (vim.fn.input "Namespace name: "))]]
:cc [:cycle-coll []]
:cn [:clean-ns []]
:cp [:cycle-privacy []]
:ct [:create-test []]
:df [:drag-forward []]
:db [:drag-backward []]
:df [:drag-forward []]
:dk [:destructure-keys []]
:ed [:extract-to-def
[(lambda [] (vim.fn.input "Definition name: "))]]
:ref [:extract-function
[(lambda [] (vim.fn.input "Function name: "))]]
:el [:expand-let []]
:fe [:create-function []]
:il [:introduce-let
[(lambda [] (vim.fn.input "Binding name: "))]]
:is [:inline-symbol []]
:ma [:resolve-macro-as []]
:mf [:move-form
[(lambda [] (vim.fn.input "File name: "))]]
:ml [:move-to-let
[(lambda [] (vim.fn.input "Binding name: "))]]
:pf [:promote-fn
[(lambda [] (vim.fn.input "Function name: "))]]
:sc [:change-collection
[(lambda [] (vim.fn.input ""))
"input('Collection type: ')"]]
:sm [:sort-map []]
:tf [:thread-first-all []]
:tF [:thread-first []]
:tl [:thread-last-all []]
:tL [:thread-last []]
:ua [:unwind-all []]
:uw [:unwind-thread []]}})
;
; (local server-specific-opts {})
;
; (local base-server-opts
; (let [capabilities (cmp_nvim_lsp.default_capabilities (lsp.protocol.make_client_capabilities))]
; {: on_attach : capabilities :flags {:debounce_text_changes 150}}))
; (vim.api.nvim_create_user_command :LspExecuteCommand lsp-execute-command
; {:nargs "+"})
(local vim _G.vim)
(local lsps [:clojure_lsp
; "fennel_ls"
:lua_ls
:jsonls
:yamlls
:marksman
:html
:basedpyright
:ts_ls
:terraformls
; "tailwindcss"
:dockerls
:docker_compose_language_service
:bashls
:taplo
:sqlls])
(local filetype->formatters
{:lua [:stylua]
:sh [:shfmt]
:python [:ruff_organize_imports :ruff_format]
:rust [:rustfmt]
:toml [:taplo]
:clojure [:cljfmt]
:json [:prettierd]
:javascript [:prettierd]
:typescript [:prettierd]
:jsx [:prettierd]
:html [:prettierd]
:css [:prettierd]
:yaml [:prettierd]
:markdown [:prettierd]
:fennel [:fnlfmt]
:sql [:sqlfmt]
:gleam [:gleam]
:* [:trim_whitespace :trim_newlines]})
(local formatter->package {:ruff_organize_imports :ruff :ruff_format :ruff})
(local disable-formatter-on-save
;; These mess with the buffer, so we keep them available for manual invocation but never automatic.
{:fennel true :sql true})
(local disable-formatter-auto-install
;; These need to be installed outside of Mason.
{:cljfmt true
:fnlfmt true
:rustfmt true
:trim_whitespace true
:trim_newlines true
:gleam true})
(vim.lsp.enable [:clojure :fennel-ls :typedclojure])
[(tx :folke/lsp-colors.nvim {})
(tx :williamboman/mason.nvim {:tag :v1.11.0 :opts {}})
; (tx :stevearc/conform.nvim
; {:dependencies [:rcarriga/nvim-notify]
; :opts {:default_format_opts {:lsp_format :fallback}
; :formatters_by_ft filetype->formatters
; :format_on_save (fn [_buf]
; (when (and vim.g.dotfiles_format_on_save
; (or (= nil
; vim.b.dotfiles_format_on_save)
; vim.b.dotfiles_format_on_save)
; (not (. disable-formatter-on-save
; vim.bo.filetype)))
; {:timeout_ms 500 :lsp_format :fallback}))}
; :config (fn [_ opts]
; (let [conform (require :conform)
; registry (require :mason-registry)
; formatters-for-mason {}]
; (set conform.formatters.shfmt {:prepend_args [:-i :2 :-ci]})
; (vim.schedule (fn []
; (each [_ft formatters (pairs filetype->formatters)]
; (each [_idx formatter (ipairs formatters)]
; (when (not (. disable-formatter-auto-install
; formatter))
; (tset formatters-for-mason
; (or (. formatter->package
; formatter)
; formatter)
; true))))
; (each [formatter _true (pairs formatters-for-mason)]
; (let [pkg (registry.get_package formatter)]
; (when (not (pkg:is_installed))
; (vim.notify (.. "Automatically installing "
; formatter " with Mason."))
; (pkg:install))))))
; (set vim.g.dotfiles_format_on_save true)
; (conform.setup opts)
; (set vim.o.formatexpr "v:lua.require'conform'.formatexpr()")))
; :keys [(tx :<leader>tf
; (fn []
; (set vim.b.dotfiles_format_on_save
; (if (= nil vim.b.dotfiles_format_on_save) false
; (not vim.b.dotfiles_format_on_save)))
; (vim.notify (.. "Set vim.b.dotfiles_format_on_save to "
; (tostring vim.b.dotfiles_format_on_save))))
; {:desc "Toggle buffer formatting"})
; (tx :<leader>tF
; (fn []
; (set vim.g.dotfiles_format_on_save
; (not vim.g.dotfiles_format_on_save))
; (vim.notify (.. "Set vim.g.dotfiles_format_on_save to "
; (tostring vim.g.dotfiles_format_on_save))))
; {:desc "Toggle global formatting"})]})
(tx :williamboman/mason-lspconfig.nvim
{:tag :v1.32.0
:dependencies [:williamboman/mason.nvim]
:opts {:ensure_installed lsps :automatic_installation true}})
(tx :neovim/nvim-lspconfig
{:lazy false
:dependencies [:williamboman/mason-lspconfig.nvim
:hrsh7th/cmp-nvim-lsp
:stevearc/conform.nvim
:Olical/nfnl]
:keys [(tx :<leader>ca #(vim.lsp.buf.code_action)
{:desc "Invoke code_action, prompting for an action to take at the cursor"})
(tx :<leader>fa vim.lsp.buf.format
; (fn [] ((. (require :conform) :format)))
{:desc "LSP format"})
(tx :<leader>rn vim.lsp.buf.rename {:desc "LSP rename"})
(tx :gd vim.lsp.buf.definition {:desc "Go to Definition"})
(tx :gD vim.lsp.buf.declaration {:desc "Go to Declaration"})
(tx :gi vim.lsp.buf.implementation {:desc "Go to Implementation"})
(tx :gr vim.lsp.buf.references {:desc "Show References"})
(tx :K vim.lsp.buf.hover {:desc "LSP Hover"})
(tx "[g" vim.lsp.diagnostic.goto_prev
{:desc "Previous Diagnostic"})
(tx "]g" vim.lsp.diagnostic.goto_next {:desc "Next Diagnostic"})
(tx :<c-k> vim.lsp.buf.signature_help {:desc "Signature Help"})
; :<leader>cl "lua vim.lsp.codelens.run()"
; :<leader>ic "lua vim.lsp.buf.incoming_calls()"
; ;; TODO: think of new mapping; conficts with org mode
; ;; :<leader>oc "lua vim.lsp.buf.outgoing_calls()"
; :<leader>sld "lua vim.diagnostic.open_float(nil, {source = 'always'})"
; :<leader>rn "lua vim.lsp.buf.rename()"
; :<leader>fa "lua vim.lsp.buf.format()"}
]
:config (fn []
(let [caps ((. (require :cmp_nvim_lsp) :default_capabilities))
mlsp (require :mason-lspconfig)
a (require :nfnl.core)
u (require :dotfiles.util)
lsp (require :vim.lsp)
lspconfig (require :lspconfig)
cmp_nvim_lsp (require :cmp_nvim_lsp)]
(vim.lsp.enable :gleam)
(fn bufmap [mode from to opts]
(u.noremap mode from to (a.merge {:local? true} opts)))
(fn nbufmap [from to opts] (bufmap :n from to opts))
(fn xbufmap [from to opts] (bufmap :x from to opts))
(u.nnoremap :<leader>li :LspInfo)
(fn lsp-execute-command [client cmd ...]
(let [buf-uri (vim.uri_from_bufnr 0)
cursor (vim.api.nvim_win_get_cursor 0)
r (- (a.first cursor) 1)
c (a.second cursor)
opts [buf-uri r c]
args (a.concat opts [...])]
;;(client.exec_cmd {:command cmd :arguments args} {:bufnr 0})
(client.request_sync :workspace/executeCommand
{:command cmd :arguments args} nil 0)))
(fn bind-client-mappings [client]
(let [client-name (a.get client :name)
mappings (a.get client-nmappings client-name)
command-lnmappings (a.get client-command-lnmappings
client-name)]
(when mappings
(each [mapping cmd (pairs mappings)]
(nbufmap mapping cmd {})))
(when command-lnmappings
(each [lnmapping command-mapping (pairs command-lnmappings)]
(let [lsp-cmd (a.first command-mapping)
;;lsp-cmd (.. client-name "." (a.first command-mapping))
;;opts (a.second command-mapping)
mapping (.. :<leader> lnmapping)
cmd (lambda []
(let [opts (accumulate [s "" _i opt (ipairs (a.second command-mapping))]
(.. s
(if (= :function
(type opt))
(opt)
opt)))]
(lsp-execute-command client lsp-cmd
opts)))]
(nbufmap mapping cmd
{:desc (.. "LSP command `" lsp-cmd "`")}))))))
(fn on_attach [client bufnr]
;(each [mapping cmd (pairs core-nmappings)] ; (nbufmap mapping cmd {})) ; x mode mappings
;(xbufmap :<leader>fa "lua vim.lsp.buf.format()"
; {:desc "Format buffer"}) ; -- buf_set_keymap('n', 'gs', '<Cmd>lua vim.lsp.buf.document_symbol()<CR>', opts)
; -- buf_set_keymap('n', 'gS', '<Cmd>lua vim.lsp.buf.workspace_symbol()<CR>', opts)
; -- buf_set_keymap('n', 'gt', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
; -- buf_set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
; -- buf_set_keymap('n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
; -- buf_set_keymap('n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
; -- buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
; -- buf_set_keymap('n', '<leader>ic', "<cmd>lua vim.lsp.buf.incoming_calls()<CR>", opts)
; -- buf_set_keymap('x', '<leader>ic', "<cmd>lua vim.lsp.buf.incoming_calls()<CR>", opts)
(vim.api.nvim_set_option_value :omnifunc
"v:lua.vim.lsp.omnifunc"
{:buf 0})
(bind-client-mappings client)
(when client.server_capabilities.documentHighlightProvider
(each [hlgroup base-group (pairs {:LspReferenceRead :SpecialKey
:LspReferenceText :SpecialKey
:LspReferenceWrite :SpecialKey})]
(vim.api.nvim_set_hl 0 hlgroup
(a.merge (vim.api.nvim_get_hl_by_name base-group
true)
{:italic true
:foreground "#6c71c4"
:background :NONE})))
(let [group (vim.api.nvim_create_augroup :LspDocumentHighlight
{:clear true})]
(vim.api.nvim_create_autocmd [:CursorHold :CursorHoldI]
{: group
:pattern :<buffer>
:callback (lambda []
(vim.lsp.buf.document_highlight))})
(vim.api.nvim_create_autocmd [:CursorMoved]
{: group
:pattern :<buffer>
:callback (lambda []
(vim.lsp.buf.clear_references))})))
(if client.server_capabilities.documentFormattingProvider
(vim.api.nvim_create_autocmd [:BufWritePre]
{:pattern :<buffer>
:callback vim.lsp.buf.format}))
(print "LSP Client Attached."))
(mlsp.setup_handlers (tx (fn [server-name]
(vim.lsp.config server-name
{:capabilities caps
: on_attach})
(vim.lsp.enable server-name))
{; :tailwindcss
; (fn []
; ;; https://github.com/tailwindlabs/tailwindcss/discussions/7554#discussioncomment-12991596
; ;; https://github.com/tailwindlabs/tailwindcss-intellisense/issues/401#issuecomment-2336568169
; ;; https://github.com/tailwindlabs/tailwindcss-intellisense/issues/400#issuecomment-2664427180
; (vim.lsp.config "tailwindcss"
; {:settings
; {:tailwindCSS
; {:experimental
; {:classRegex [["\\[:[^.\\s]*((?:\\.[^.\\s\\]]*)+)[\\s\\]]" "\\.([^.]*)"]
; ["\\:(\\.[^\\s#]+(?:\\.[^\\s#]+)*)" "\\.([^\\.\\s#]+)"]
; ["class\\s+(\\:[^\\s\\}]*)[\\s\\}]" "[\\:.]([^.]*)"]
; ["class\\s+(\"[^\\}\"]*)\"" "[\"\\s]([^\\s\"]*)"]
; ["class\\s+\\[([\\s\\S]*)\\]" "[\"\\:]([^\\s\"]*)[\"]?"]
; ["class\\s+'\\[([\\s\\S]*)\\]" "([^\\s]*)?"]]}
; :includeLanguages {:clojure "html"
; :clojurescript "html"}}}})
; (vim.lsp.enable "tailwindcss"))
}))))})
(tx :RubixDev/mason-update-all {:cmd :MasonUpdateAll
:dependencies [:williamboman/mason.nvim
:Olical/nfnl]
:main :mason-update-all
:opts {}})]
+5
View File
@@ -0,0 +1,5 @@
(import-macros {: tx} :config.macros)
(tx "Olical/nfnl" {:lazy false
;;:ft "fennel"
})
@@ -0,0 +1,10 @@
(import-macros {: tx} :config.macros)
(tx :nvim-neo-tree/neo-tree.nvim
{:branch :v3.x
:dependencies [:nvim-tree/nvim-web-devicons
; not strictly required, but recommended
:MunifTanjim/nui.nvim
; :3rd/image.nvim, ; Optional image support in preview window: See `# Preview Mode` for more information
]
:lazy false})
+88
View File
@@ -0,0 +1,88 @@
(import-macros {: tx} :config.macros)
(set vim.g.paredit_smartjump 1)
(fn list-member? [xs x]
(a.some #(= x $1) (a.vals xs)))
(fn bool->int [bool] (if bool 1 0))
(fn int->bool [x] (if (= 0 x) false true))
(fn toggle-global! [x]
(->> (a.get vim.g x)
(int->bool)
(not)
(bool->int)
(tset vim.g x)))
(local paredit-langs [:clojure
:fennel
:hy
:janet
:julia
:lfe
:lisp
:racket
:scheme
:shen])
(local paredit-host-langs [:org :markdown :asciidoc])
(fn paredit-lang? [lang] (list-member? paredit-langs lang))
(vim.api.nvim_create_autocmd [:FileType]
{:pattern :ruby
:callback (lambda []
(vim.fn.PareditInitBalancingAllBracketsBuffer))})
(vim.api.nvim_create_autocmd [:FileType]
{:pattern :javascript
:callback (lambda []
(vim.fn.PareditInitBalancingAllBracketsBuffer))})
(vim.api.nvim_create_autocmd [:FileType]
{:pattern :terraform
:callback (lambda []
(vim.fn.PareditInitBalancingAllBracketsBuffer))})
(tx :kovisoft/paredit
{:dependencies [:nvim-treesitter/nvim-treesitter]
:config (fn []
(let [a (require :nfnl.core)
;; treesitter (require :dotfiles.plugin.treesitter)
ts-parsers (require :nvim-treesitter.parsers)
;; ts-utils (require :nvim-treesitter.utils)
languagetree (require :vim.treesitter.languagetree)]
(fn language-at-cursor []
(let [parser (ts-parsers.get_parser)
current-node (vim.treesitter.get_node {:bufnr 0})
range (if current-node [(current-node:range)])
lang (if range
(languagetree.language_for_range parser range))]
(if lang
(lang:lang))))
(fn parser-language []
(let [parser (ts-parsers.get_parser)]
(when parser
(parser:lang))))
(fn host-lang-in? [langs] (list-member? langs (parser-language)))
(fn TreeSitterLangParedit []
(when (host-lang-in? paredit-host-langs)
(let [cursor-lang (language-at-cursor)]
(when cursor-lang
(->> cursor-lang
(paredit-lang?)
(bool->int)
(set vim.g.paredit_mode))
(vim.fn.PareditInitBuffer)))))
))})
@@ -0,0 +1,3 @@
(import-macros {: tx} :config.macros)
(tx :nvim-lua/plenary.nvim {})
@@ -0,0 +1,3 @@
(import-macros {: tx} :config.macros)
(tx :HiPhish/rainbow-delimiters.nvim {:verion "*"})
@@ -0,0 +1,23 @@
(import-macros {: tx} :config.macros)
(let [smart-splits (require :smart-splits)]
(when smart-splits
;; recommended mappings
;; resizing splits
;; these keymaps will also accept a range,
;; for example `10<A-h>` will `resize_left` by `(10 * config.default_amount)`
(vim.keymap.set :n :<M-S-h> smart-splits.resize_left)
(vim.keymap.set :n :<M-S-j> smart-splits.resize_down)
(vim.keymap.set :n :<M-S-k> smart-splits.resize_up)
(vim.keymap.set :n :<M-S-l> smart-splits.resize_right) ; ; moving between splits
(vim.keymap.set :n :<M-h> smart-splits.move_cursor_left)
(vim.keymap.set :n :<M-j> smart-splits.move_cursor_down)
(vim.keymap.set :n :<M-k> smart-splits.move_cursor_up)
(vim.keymap.set :n :<M-l> smart-splits.move_cursor_right) ; ; swapping buffers between windows
(vim.keymap.set :n :<leader><leader>h smart-splits.swap_buf_left)
(vim.keymap.set :n :<leader><leader>j smart-splits.swap_buf_down)
(vim.keymap.set :n :<leader><leader>k smart-splits.swap_buf_up)
(vim.keymap.set :n :<leader><leader>l smart-splits.swap_buf_right)))
(tx :mrjones2014/smart-splits.nvim {:lazy false})
@@ -0,0 +1,50 @@
(import-macros {: tx} :config.macros)
(local util (require :dotfiles.util))
(local vimgrep_arguments [:ag
:--nocolor
:--noheading
:--number
:--column
:--nobreak
:--smart-case
:--hidden
; "--skip-vcs-ignores"
; "-g" "!.git/"
:--ignore
:.git
:--follow])
(util.lnnoremap :fc "Telescope commands")
(util.lnnoremap :fC "Telescope command_history")
(util.lnnoremap :ff "Telescope git_files hidden=true")
(util.lnnoremap :f- "Telescope find_files")
(util.lnnoremap :fg "Telescope live_grep")
(util.lnnoremap "*" "Telescope grep_string")
(util.lnnoremap :fb "Telescope buffers")
(util.lnnoremap :fd "Telescope diagnostics")
(util.lnnoremap :fH "Telescope help_tags")
(util.lnnoremap :fh "Telescope oldfiles")
(util.lnnoremap :fp "Telescope projects")
(util.lnnoremap :fm "Telescope keymaps")
(util.lnnoremap :fM "Telescope marks")
(util.lnnoremap :ft "Telescope filetypes")
(util.lnnoremap :fq "Telescope quickfix")
(util.lnnoremap :fl "Telescope loclist")
(util.lnnoremap :fsi "Telescope lsp_implementations")
(util.lnnoremap :fsr "Telescope lsp_references")
(util.lnnoremap :fsS "Telescope lsp_document_symbols")
(util.lnnoremap :fss "Telescope lsp_workspace_symbols")
(util.lnnoremap :fy "Telescope yank_history")
(tx :nvim-telescope/telescope.nvim
{
"version" "*"
:dependencies [[:nvim-lua/popup.nvim]
[:nvim-lua/plenary.nvim]]
:pickers {:buffers {:mappings {:n {:d :delete_buffer}}}}
:extensions {:projects {:projects {}}
:yank_history {}}})
+28
View File
@@ -0,0 +1,28 @@
(import-macros {: tx} :config.macros)
(local util (require :dotfiles.util))
;; Determine load time of fugitive
;; (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 :<leader>gp ":Git pull<CR>")
(bufmap :n :<leader>gP ":Git push<CR>")
(bufmap :n :<leader>gF ":Git push -f<CR>"))
(vim.api.nvim_create_autocmd [:FileType]
{:pattern :fugitive :callback map-fugitive-keys})
[(tx :tpope/vim-dadbod {})
(tx :tpope/vim-dispatch {})
(tx :tpope/vim-fugitive {})
(tx :tpope/vim-git {:lazy false})
(tx :tpope/vim-pathogen {})
(tx :tpope/vim-rails {})
(tx :tpope/vim-repeat {})
(tx :tpope/vim-rhubarb {})
(tx :tpope/vim-surround {})
(tx :tpope/vim-unimpaired {})
(tx :tpope/vim-vinegar {:lazy false})]
@@ -0,0 +1,45 @@
(import-macros {: tx} :config.macros)
(vim.api.nvim_create_autocmd
"FileType"
{:pattern ["*"]
:callback #(vim.schedule #(pcall #(vim.treesitter.start)))})
(tx
"nvim-treesitter/nvim-treesitter"
{:main :nvim-treesitter.configs
:branch "main"
:build ":TSUpdate"
:config (fn []
(let [ treesitter-configs (require :nvim-treesitter.config)]
(treesitter-configs.setup {:highlight {:enable true
;; :additional_vim_regex_highlighting false
:additional_vim_regex_highlighting [:org]}
:ensure_installed :all
; [:org]
:rainbow {:enable true
:extended_mode true
; Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
:max_file_lines 10000
; Do not enable for files with more than 1000 lines, int
:colors ["#dc322f"
; red
"#b58900"
; yellow
"#d33682"
; magenta
"#859900"
; green
"#2aa198"
; cyan
"#268bd2"
; blue
"#6c71c4"
; violet / brmagenta
]
; table of hex strings
}}))
)
})