commit 866694e15f9a807f567c6e53bd668c69648e54ff
parent 9f705cc1c723ca717eab343bcf272edc4f11adff
Author: FIGBERT <figbert@figbert.com>
Date: Fri, 26 Nov 2021 00:58:41 -0800
Replace completion.nvim with nvim-cmp
Diffstat:
1 file changed, 48 insertions(+), 16 deletions(-)
diff --git a/dot_config/nvim/init.lua.tmpl b/dot_config/nvim/init.lua.tmpl
@@ -50,13 +50,21 @@ vim.g.python3_host_prog = "{{ .chezmoi.homeDir }}/.pyenv/versions/py3nvim/bin/py
{{- end }}
----- PLUGINS -----
-require "paq-nvim" {
+require "paq" {
"savq/paq-nvim";
- { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" };
"neovim/nvim-lspconfig";
+ { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" };
+
+ "hrsh7th/cmp-nvim-lsp";
+ "hrsh7th/cmp-buffer";
+ "hrsh7th/cmp-path";
+ "hrsh7th/cmp-cmdline";
+ "hrsh7th/nvim-cmp";
+ "dcampos/nvim-snippy";
+ "dcampos/cmp-snippy";
+
"nvim-lua/plenary.nvim";
"nvim-lua/popup.nvim";
- "nvim-lua/completion-nvim";
"TimUntersberger/neogit";
"vimwiki/vimwiki";
"kyazdani42/nvim-web-devicons";
@@ -66,10 +74,34 @@ require "paq-nvim" {
"hoob3rt/lualine.nvim";
"pirmd/gemini.vim";
"folke/which-key.nvim";
- {{- if eq .chezmoi.os "darwin" }}
- "mrjones2014/dash.nvim";
- {{- end }}
}
+
+require("cmp").setup({
+ snippet = {
+ expand = function(args)
+ require'snippy'.expand_snippet(args.body)
+ end,
+ },
+ sources = require("cmp").config.sources({
+ { name = 'nvim_lsp' },
+ { name = 'snippy' },
+ }, {
+ { name = 'buffer' },
+ })
+})
+require("cmp").setup.cmdline("/", {
+ sources = {
+ { name = "buffer" }
+ }
+})
+require("cmp").setup.cmdline(":", {
+ sources = require("cmp").config.sources({
+ { name = "path" }
+ }, {
+ { name = "cmdline" }
+ })
+})
+
require("zen-mode").setup {
window = {
height = 0.8,
@@ -82,17 +114,17 @@ require("lualine").setup { options = { theme = "horizon" } }
require("which-key").setup{}
----- LANGUAGE SERVERS -----
-vim.cmd("autocmd BufEnter * lua require'completion'.on_attach()")
+local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
local ts = require "nvim-treesitter.configs"
ts.setup { ensure_installed = "maintained", highlight = { enable = true }}
-require"lspconfig".gdscript.setup{}
-require"lspconfig".denols.setup{}
-require"lspconfig".sourcekit.setup{}
-require"lspconfig".html.setup{}
-require"lspconfig".cssls.setup{}
-require"lspconfig".gopls.setup{}
-require"lspconfig".rust_analyzer.setup{}
-require"lspconfig".zls.setup{}
-require'lspconfig'.jedi_language_server.setup{}
+require"lspconfig".gdscript.setup{capabilities = capabilities}
+require"lspconfig".denols.setup{capabilities = capabilities}
+require"lspconfig".sourcekit.setup{capabilities = capabilities}
+require"lspconfig".html.setup{capabilities = capabilities}
+require"lspconfig".cssls.setup{capabilities = capabilities}
+require"lspconfig".gopls.setup{capabilities = capabilities}
+require"lspconfig".rust_analyzer.setup{capabilities = capabilities}
+require"lspconfig".zls.setup{capabilities = capabilities}
+require'lspconfig'.jedi_language_server.setup{capabilities = capabilities}