completions

This commit is contained in:
Talon 2023-07-27 22:50:12 -06:00
parent e3a5f4c260
commit 66874c59b4
2 changed files with 65 additions and 12 deletions

View file

@ -28,7 +28,20 @@
{:url "https://github.com/j-hui/fidget.nvim" {:url "https://github.com/j-hui/fidget.nvim"
:tag "legacy" :tag "legacy"
:opts {}} :opts {}}
"folke/neodev.nvim"]} "folke/neodev.nvim"
]}
{:url "https://github.com/hrsh7th/nvim-cmp"
:dependencies
["https://github.com/hrsh7th/cmp-nvim-lsp"
"https://github.com/hrsh7th/cmp-buffer"
"https://github.com/hrsh7th/cmp-path"
"https://github.com/hrsh7th/cmp-cmdline"
"https://github.com/hrsh7th/cmp-cmdline"
]}
{:url "https://github.com/L3MON4D3/LuaSnip"
:dependencies
[{:url "https://github.com/saadparwaiz1/cmp_luasnip"}
]}
])) ]))
(let [telescope (require :telescope)] (let [telescope (require :telescope)]
@ -64,11 +77,11 @@
]}} ]}}
:fennel_language_server :fennel_language_server
{:filetypes [:fennel] {:filetypes [:fennel]
:fennel :fennel
{:workspace {:library (vim.api.nvim_list_runtime_paths)} {:workspace {:library (vim.api.nvim_list_runtime_paths)}
:diagnostics {:globals :diagnostics {:globals
[:vim [:vim
]}}} ]}}}
:bashls {:filetypes [:bash]} :bashls {:filetypes [:bash]}
} }
on_attach (fn [_ bufnr] on_attach (fn [_ bufnr]
@ -87,10 +100,43 @@
(mason.setup) (mason.setup)
(mason-lspconfig.setup {:ensure_installed (vim.tbl_keys servers)}) (mason-lspconfig.setup {:ensure_installed (vim.tbl_keys servers)})
(mason-lspconfig.setup_handlers (mason-lspconfig.setup_handlers
[(fn [server_name] (let [server (. (require :lspconfig) server_name)] [(fn [server_name] (let
(server.setup [server (. (require :lspconfig) server_name)
{:capabilities (vim.lsp.protocol.make_client_capabilities) cmp-nvim-lsp (require :cmp_nvim_lsp)
:on_attach on_attach settings (. servers server_name)
:settings (. servers server_name) ]
:filetypes (or (. servers server_name :filetypes) []) }))) (server.setup
{:capabilities (cmp-nvim-lsp.default_capabilities)
:on_attach on_attach
:settings settings
:filetypes (or settings.filetypes [])})))
])) ]))
;; Autocompletion and Snippets with nvim-cmp
(let
[cmp (require :cmp)
luasnip (require :luasnip)
]
(cmp.setup
{:snippet {:expand #(luasnip $1)}
:sources (cmp.config.sources
[{:name :nvim_lsp}
{:name :luasnip}
{:name :buffer}
])})
(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}])})
(cmp.setup.filetype [:gitcommit]
{:mapping (cmp.mapping.preset.cmdline)
:sources (cmp.config.sources
[{:name :git}
{:name :buffer}])
}))

View file

@ -1,10 +1,17 @@
{ {
"LuaSnip": { "branch": "master", "commit": "e81cbe6004051c390721d8570a4a0541ceb0df10" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
"hotpot.nvim": { "branch": "master", "commit": "026eba9596b506ab6f807fd4aa93cd5f76255725" }, "hotpot.nvim": { "branch": "master", "commit": "026eba9596b506ab6f807fd4aa93cd5f76255725" },
"lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" }, "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" },
"mason.nvim": { "branch": "main", "commit": "fe9e34a9ab4d64321cdc3ecab4ea1809239bb73f" }, "mason.nvim": { "branch": "main", "commit": "fe9e34a9ab4d64321cdc3ecab4ea1809239bb73f" },
"neodev.nvim": { "branch": "main", "commit": "f57e5210d450b47aa02ea6d9e50a37414f570b4c" }, "neodev.nvim": { "branch": "main", "commit": "f57e5210d450b47aa02ea6d9e50a37414f570b4c" },
"nvim-cmp": { "branch": "main", "commit": "c4e491a87eeacf0408902c32f031d802c7eafce8" },
"nvim-lspconfig": { "branch": "master", "commit": "b6091272422bb0fbd729f7f5d17a56d37499c54f" }, "nvim-lspconfig": { "branch": "master", "commit": "b6091272422bb0fbd729f7f5d17a56d37499c54f" },
"nvim-treesitter": { "branch": "master", "commit": "6aababfca4e3d72cb1e8fbbdac4115a5f88107d0" }, "nvim-treesitter": { "branch": "master", "commit": "6aababfca4e3d72cb1e8fbbdac4115a5f88107d0" },
"plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" }, "plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" },