From fbc7b9ab321df36e7ff851c7e868c1fa220d35ec Mon Sep 17 00:00:00 2001 From: Darius Auding <Darius.auding@gmx.de> Date: Mon, 7 Aug 2023 21:41:17 +0200 Subject: [PATCH] Add better selection and lsp menus add better completion with Buffer and path completion --- lua/codecraft/core/neovide.lua | 2 +- lua/codecraft/plugin-setup.lua | 10 +++--- lua/codecraft/plugin/lsp/completion.lua | 47 +++++++++++++++++++++++++ lua/codecraft/plugin/lsp/lsp.lua | 1 + lua/codecraft/plugin/lsp/null-ls.lua | 6 ++-- lua/codecraft/plugin/nvimtree.lua | 7 ++-- 6 files changed, 63 insertions(+), 10 deletions(-) diff --git a/lua/codecraft/core/neovide.lua b/lua/codecraft/core/neovide.lua index 2a2f359..f925d1d 100644 --- a/lua/codecraft/core/neovide.lua +++ b/lua/codecraft/core/neovide.lua @@ -13,6 +13,6 @@ if vim.g.neovide then vim.g.neovide_background_color = "#000000" .. alpha() vim.g.neovide_floating_blur_amount_x = 2.0 vim.g.neovide_floating_blur_amount_y = 2.0 - vim.g.neovide_cursor_animation_length = 0.02 + vim.g.neovide_cursor_animation_length = 0.03 vim.g.neovide_cursor_antialiasing = true end diff --git a/lua/codecraft/plugin-setup.lua b/lua/codecraft/plugin-setup.lua index 26d6cf7..202548f 100644 --- a/lua/codecraft/plugin-setup.lua +++ b/lua/codecraft/plugin-setup.lua @@ -123,10 +123,12 @@ require("packer").startup(function(use) use("tpope/vim-rhubarb") use("lewis6991/gitsigns.nvim") - use("navarasu/onedark.nvim") -- Theme inspired by Atom - use("Mofiqul/dracula.nvim") -- dracula - use("wojciechkepka/vim-github-dark") - use("shaunsingh/nord.nvim") + use "navarasu/onedark.nvim" -- Theme inspired by Atom + use'ayu-theme/ayu-vim' + use "EdenEast/nightfox.nvim" + use "Mofiqul/dracula.nvim" -- dracula + use "wojciechkepka/vim-github-dark" + use "shaunsingh/nord.nvim" use({ "catppuccin/nvim", as = "catppuccin" }) use("morhetz/gruvbox") use("folke/tokyonight.nvim") diff --git a/lua/codecraft/plugin/lsp/completion.lua b/lua/codecraft/plugin/lsp/completion.lua index 5ccb22e..20f6ffb 100644 --- a/lua/codecraft/plugin/lsp/completion.lua +++ b/lua/codecraft/plugin/lsp/completion.lua @@ -2,12 +2,54 @@ local cmp = require("cmp") local luasnip = require("luasnip") +local kind_icons = { + Text = "󰉿", + Method = "󰆧", + Function = "ó°Š•", + Constructor = "ï£", + Field = "îŸ ", + Variable = "󰀫", + Class = "ó° ±", + Interface = "", + Module = "ï’‡", + Property = "󰜢", + Unit = "ó°‘", + Value = "ó°Ž ", + Enum = "ï…", + Keyword = "󰌋", + Snippet = "", + Color = "ó°˜", + File = "󰈙", + Reference = "ï’", + Folder = "󰉋", + EnumMember = "ï…", + Constant = "ó°¿", + Struct = "", + Event = "", + Operator = "󰆕", + TypeParameter = " ", + Misc = "î£ ", +} + cmp.setup({ snippet = { expand = function(args) luasnip.lsp_expand(args.body) end, }, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function (entry, vim_item) + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + vim_item.menu = ({ + nvim_lsp = "[LSP]", + luasnip = "[Snippet]", + buffer = "[Buffer]", + path = "[Path]" + })[entry.source.name] + return vim_item + end + }, mapping = cmp.mapping.preset.insert({ ["<C-d>"] = cmp.mapping.scroll_docs(-4), ["<C-f>"] = cmp.mapping.scroll_docs(4), @@ -19,6 +61,11 @@ cmp.setup({ ["<S-TAB>"] = cmp.mapping.select_prev_item(), ["<TAB>"] = cmp.mapping.select_next_item(), }), + windows = { + documentation = { + border = { "â•", "─", "â•®", "│", "╯", "─", "â•°", "│" } + } + }, sources = { { name = "nvim_lsp" }, { name = "luasnip" }, diff --git a/lua/codecraft/plugin/lsp/lsp.lua b/lua/codecraft/plugin/lsp/lsp.lua index 9b7ad01..bd2c389 100644 --- a/lua/codecraft/plugin/lsp/lsp.lua +++ b/lua/codecraft/plugin/lsp/lsp.lua @@ -91,6 +91,7 @@ local servers = { telemetry = { enable = false }, }, }, + svelte = {}, } -- diff --git a/lua/codecraft/plugin/lsp/null-ls.lua b/lua/codecraft/plugin/lsp/null-ls.lua index 12977e2..eb5a02d 100644 --- a/lua/codecraft/plugin/lsp/null-ls.lua +++ b/lua/codecraft/plugin/lsp/null-ls.lua @@ -4,12 +4,12 @@ local mason_null_ls = require('mason-null-ls') local formatting = null_ls.builtins.formatting local diagnostics = null_ls.builtins.diagnostics -local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) - local formatters_linters = { prettier = {}, rustfmt = {}, black = {}, + pylint = {}, + eslint_d = {}, } mason_null_ls.setup({ @@ -20,6 +20,8 @@ null_ls.setup ({ formatting.prettier, formatting.rustfmt, formatting.black, + diagnostics.pylint, + diagnostics.eslint, }, on_attach = function(current_client, bufnr) if current_client.supports_method("textDocument/formatting") then diff --git a/lua/codecraft/plugin/nvimtree.lua b/lua/codecraft/plugin/nvimtree.lua index eb879c7..94a41d9 100644 --- a/lua/codecraft/plugin/nvimtree.lua +++ b/lua/codecraft/plugin/nvimtree.lua @@ -74,7 +74,7 @@ end require("nvim-tree").setup({ disable_netrw = true, hijack_netrw = true, - on_attach = on_attach, + on_attach = on_attach, diagnostics = { enable = true, }, @@ -103,5 +103,6 @@ require("nvim-tree").setup({ } }) -vim.cmd("autocmd VimEnter * NvimTreeOpen") -vim.cmd("autocmd VimEnter * wincmd p") +-- ON STARTUP +-- vim.cmd("autocmd VimEnter * NvimTreeOpen") +-- vim.cmd("autocmd VimEnter * wincmd p") -- GitLab