From 374797caeebc852cfec141451b96838a40fe60d4 Mon Sep 17 00:00:00 2001 From: MasterGordon Date: Sun, 24 Oct 2021 01:38:19 +0200 Subject: [PATCH] change completion and updated galaxyline --- lua/plugins.lua | 30 ++++++---- lua/plugins/cmp.lua | 89 +++++++++++++++++++++++++++++ lua/plugins/formatter.lua | 11 +++- lua/plugins/galaxyline.lua | 112 +++++++++++++++++-------------------- lua/plugins/lsp.lua | 16 ++---- spell/de.utf-8.add | 2 + spell/de.utf-8.add.spl | Bin 175 -> 197 bytes 7 files changed, 176 insertions(+), 84 deletions(-) create mode 100644 lua/plugins/cmp.lua diff --git a/lua/plugins.lua b/lua/plugins.lua index 605ba32..dbba403 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -55,7 +55,7 @@ return require("packer").startup( } use { - "glepnir/galaxyline.nvim", + "NTBBloodbath/galaxyline.nvim", branch = "main", config = function() require "plugins/galaxyline" @@ -155,9 +155,7 @@ return require("packer").startup( "RishabhRD/nvim-lsputils", "onsails/lspkind-nvim", "ray-x/lsp_signature.nvim", - "jose-elias-alvarez/nvim-lsp-ts-utils", - -- "jose-elias-alvarez/null-ls.nvim", - "nvim-lua/lsp-status.nvim" + "jose-elias-alvarez/nvim-lsp-ts-utils" } } use { @@ -237,7 +235,7 @@ return require("packer").startup( } ) end, - tag = "v0.2.1", -- recommended to pin to a tag and update manually as there may be breaking changes + tag = "v0.2.1", requires = { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim" @@ -258,13 +256,25 @@ return require("packer").startup( end } use { - "ms-jpq/coq_nvim", - branch = "coq", + "hrsh7th/nvim-cmp", config = function() - require "plugins/coq" + require("plugins/cmp") end, - setup = function() - vim.cmd("let g:coq_settings = { 'auto_start': v:true, 'keymaps': {'manual_completion': ''} }") + requires = { + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-path", + "hrsh7th/cmp-nvim-lua" + } + } + use { + "Saecki/crates.nvim", + event = {"BufRead Cargo.toml"}, + requires = {{"nvim-lua/plenary.nvim"}}, + config = function() + require("crates").setup() end } use "aklt/plantuml-syntax" diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua new file mode 100644 index 0000000..3542471 --- /dev/null +++ b/lua/plugins/cmp.lua @@ -0,0 +1,89 @@ +local cmp = require "cmp" + +options = { + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false + }, + experimental = { + ghost_text = true, + native_menu = false + }, + formatting = { + 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 = " " + }, + source_names = { + nvim_lsp = "(LSP)", + emoji = "(Emoji)", + path = "(Path)", + calc = "(Calc)", + cmp_tabnine = "(Tabnine)", + vsnip = "(Snippet)", + luasnip = "(Snippet)", + buffer = "(Buffer)" + }, + duplicates = { + buffer = 1, + path = 1, + nvim_lsp = 0, + luasnip = 1 + }, + duplicates_default = 0, + format = function(entry, vim_item) + vim_item.kind = options.formatting.kind_icons[vim_item.kind] + vim_item.menu = options.formatting.source_names[entry.source.name] + vim_item.dup = options.formatting.duplicates[entry.source.name] or options.formatting.duplicates_default + return vim_item + end + }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end + }, + documentation = { + border = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"} + }, + mapping = { + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm({select = true}) + }, + sources = { + {name = "nvim_lsp"}, + {name = "path"}, + {name = "luasnip"}, + {name = "nvim_lua"}, + {name = "buffer"}, + {name = "calc"}, + {name = "emoji"}, + {name = "crates"} + } +} + +cmp.setup(options) diff --git a/lua/plugins/formatter.lua b/lua/plugins/formatter.lua index c520707..7e0241c 100644 --- a/lua/plugins/formatter.lua +++ b/lua/plugins/formatter.lua @@ -27,6 +27,15 @@ require("formatter").setup( stdin = true } end + }, + rust = { + function() + return { + exe = "rustfmt", + args = {"--emit=stdout"}, + stdin = true + } + end } } } @@ -36,7 +45,7 @@ vim.api.nvim_exec( [[ augroup FormatAutogroup autocmd! - autocmd BufWritePost *.lua,*.tsx,*.ts,*.js,*.jsx,*.json FormatWrite + autocmd BufWritePost *.rs,*.lua,*.tsx,*.ts,*.js,*.jsx,*.json FormatWrite augroup END ]], true diff --git a/lua/plugins/galaxyline.lua b/lua/plugins/galaxyline.lua index cecafb7..706a301 100644 --- a/lua/plugins/galaxyline.lua +++ b/lua/plugins/galaxyline.lua @@ -1,36 +1,36 @@ local gl = require("galaxyline") -local colors = require("galaxyline.theme").default +local colors = require("galaxyline.themes.colors").get_color local theme = require("monokai") local condition = require("galaxyline.condition") local gls = gl.section -colors.bg = theme.classic.base3 gl.short_line_list = {"NvimTree", "vista", "dbui", "packer"} +local color_bg = "#333842" gls.left[2] = { ViMode = { provider = function() -- auto change color according the vim mode local mode_color = { - n = colors.green, - i = colors.red, - v = colors.blue, - [""] = colors.blue, - V = colors.blue, - c = colors.magenta, - no = colors.red, - s = colors.orange, - S = colors.orange, - [""] = colors.orange, - ic = colors.yellow, - R = colors.violet, - Rv = colors.violet, - cv = colors.red, - ce = colors.red, - r = colors.cyan, - rm = colors.cyan, - ["r?"] = colors.cyan, - ["!"] = colors.red, - t = colors.red + n = colors("green"), + i = colors("red"), + v = colors("blue"), + [""] = colors("blue"), + V = colors("blue"), + c = colors("magenta"), + no = colors("red"), + s = colors("orange"), + S = colors("orange"), + [""] = colors("orange"), + ic = colors("yellow"), + R = colors("violet"), + Rv = colors("violet"), + cv = colors("red"), + ce = colors("red"), + r = colors("cyan"), + rm = colors("cyan"), + ["r?"] = colors("cyan"), + ["!"] = colors("red"), + t = colors("red") } local mode_map = { ["n"] = "NORMAL ", @@ -53,12 +53,12 @@ gls.left[2] = { ["!"] = "SHELL ", ["t"] = "TERMINAL " } - vim.api.nvim_command("hi GalaxyViMode guibg=" .. mode_color[vim.fn.mode()]) + vim.api.nvim_command("hi GalaxyViMode guibg=" .. mode_color[vim.fn.mode()]()) return " " .. mode_map[vim.fn.mode()] end, separator = " ", - separator_highlight = {nil, colors.bg}, - highlight = {colors.bg, colors.bg, "bold"} + separator_highlight = {nil, color_bg}, + highlight = {color_bg, color_bg, "bold"} } } gls.left[3] = { @@ -72,14 +72,14 @@ gls.left[3] = { return " " .. vim.call("reg_recording") .. " " end end, - highlight = {colors.red, colors.bg} + highlight = {colors("red"), color_bg} } } gls.left[5] = { FileIcon = { provider = "FileIcon", condition = condition.buffer_not_empty, - highlight = {require("galaxyline.provider_fileinfo").get_file_icon_color, colors.bg} + highlight = {require("galaxyline.providers.fileinfo").get_file_icon_color, color_bg} } } @@ -87,7 +87,7 @@ gls.left[6] = { FileName = { provider = "FileName", condition = condition.buffer_not_empty, - highlight = {colors.magenta, colors.bg, "bold"} + highlight = {colors("magenta"), color_bg, "bold"} } } @@ -95,8 +95,8 @@ gls.left[7] = { LineInfo = { provider = "LineColumn", separator = " ", - separator_highlight = {"NONE", colors.bg}, - highlight = {colors.fg, colors.bg} + separator_highlight = {"NONE", color_bg}, + highlight = {colors("fg"), color_bg} } } @@ -104,8 +104,8 @@ gls.left[8] = { PerCent = { provider = "LinePercent", separator = " ", - separator_highlight = {"NONE", colors.bg}, - highlight = {colors.fg, colors.bg, "bold"} + separator_highlight = {"NONE", color_bg}, + highlight = {colors("fg"), color_bg, "bold"} } } @@ -113,14 +113,14 @@ gls.left[9] = { DiagnosticError = { provider = "DiagnosticError", icon = "  ", - highlight = {colors.red, colors.bg} + highlight = {colors("red"), color_bg} } } gls.left[10] = { DiagnosticWarn = { provider = "DiagnosticWarn", icon = "  ", - highlight = {colors.yellow, colors.bg} + highlight = {colors("yellow"), color_bg} } } @@ -128,7 +128,7 @@ gls.left[11] = { DiagnosticHint = { provider = "DiagnosticHint", icon = "  ", - highlight = {colors.cyan, colors.bg} + highlight = {colors("cyan"), color_bg} } } @@ -136,19 +136,7 @@ gls.left[12] = { DiagnosticInfo = { provider = "DiagnosticInfo", icon = "  ", - highlight = {colors.blue, colors.bg} - } -} - -gls.right[0] = { - LeftEnd = { - provider = function() - return require("lsp-status").status() - end, - condition = condition.hide_in_width, - separator = " ", - separator_highlight = {"NONE", colors.bg}, - highlight = {"NONE", colors.bg} + highlight = {colors("blue"), color_bg} } } @@ -157,8 +145,8 @@ gls.right[1] = { provider = "FileEncode", condition = condition.hide_in_width, separator = " ", - separator_highlight = {"NONE", colors.bg}, - highlight = {colors.green, colors.bg, "bold"} + separator_highlight = {"NONE", color_bg}, + highlight = {colors("green"), color_bg, "bold"} } } @@ -167,8 +155,8 @@ gls.right[2] = { provider = "FileFormat", condition = condition.hide_in_width, separator = " ", - separator_highlight = {"NONE", colors.bg}, - highlight = {colors.green, colors.bg, "bold"} + separator_highlight = {"NONE", color_bg}, + highlight = {colors("green"), color_bg, "bold"} } } @@ -179,8 +167,8 @@ gls.right[3] = { end, condition = condition.check_git_workspace, separator = " ", - separator_highlight = {"NONE", colors.bg}, - highlight = {colors.violet, colors.bg, "bold"} + separator_highlight = {"NONE", color_bg}, + highlight = {colors("violet"), color_bg, "bold"} } } @@ -188,7 +176,7 @@ gls.right[4] = { GitBranch = { provider = "GitBranch", condition = condition.check_git_workspace, - highlight = {colors.violet, colors.bg, "bold"} + highlight = {colors("violet"), color_bg, "bold"} } } @@ -196,10 +184,10 @@ gls.right[5] = { DiffAdd = { provider = "DiffAdd", separator = " ", - separator_highlight = {nil, colors.bg}, + separator_highlight = {nil, color_bg}, condition = condition.hide_in_width, icon = "  ", - highlight = {colors.green, colors.bg} + highlight = {colors("green"), color_bg} } } gls.right[6] = { @@ -207,7 +195,7 @@ gls.right[6] = { provider = "DiffModified", condition = condition.hide_in_width, icon = " 柳", - highlight = {colors.orane, colors.bg} + highlight = {colors("orane"), color_bg} } } gls.right[7] = { @@ -215,7 +203,7 @@ gls.right[7] = { provider = "DiffRemove", condition = condition.hide_in_width, icon = "  ", - highlight = {colors.red, colors.bg} + highlight = {colors("red"), color_bg} } } @@ -226,9 +214,9 @@ gls.short_line_left[1] = { ShortLineFileName = { provider = "FileName", condition = condition.buffer_not_empty, - highlight = {colors.fg, colors.bg}, + highlight = {colors("fg"), color_bg}, separator = " ", - separator_highlight = {nil, colors.bg} + separator_highlight = {nil, color_bg} } } @@ -238,6 +226,6 @@ gls.short_line_left[1] = { gls.short_line_right[1] = { BufferIcon = { provider = "BufferIcon", - highlight = {colors.fg, colors.bg} + highlight = {colors("fg"), color_bg} } } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 844e800..f020d02 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -21,12 +21,6 @@ signHint["texthl"] = "DiagnosticSignHint" vim.fn.sign_define("DiagnosticSignHint", signHint) vim.fn.sign_define("DiagnosticSignInfo", signHint) --- Lsp Status -local lsp_status = require("lsp-status") - --- Register the progress handler -lsp_status.register_progress() - --- Completion Icons require("lspkind").init({}) @@ -64,8 +58,8 @@ local on_attach = function(client, bufnr) buf_set_keymap("n", "[d", "lua vim.lsp.diagnostic.goto_prev()", opts) buf_set_keymap("n", "]d", "lua vim.lsp.diagnostic.goto_next()", opts) buf_set_keymap("n", "q", "lua vim.lsp.diagnostic.set_loclist()", opts) - lsp_status.on_attach(client, bufnr) end +local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) require "lspconfig".jsonls.setup { on_attach = on_attach, @@ -75,7 +69,7 @@ require "lspconfig".jsonls.setup { settings = { json = require "json-schema" }, - capabilities = lsp_status.capabilities + capabilities = capabilities } require "lspconfig".tsserver.setup { @@ -92,7 +86,7 @@ require "lspconfig".tsserver.setup { flags = { debounce_text_changes = 150 }, - capabilities = lsp_status.capabilities + capabilities = capabilities } require "lspconfig".eslint.setup { @@ -106,7 +100,7 @@ require "lspconfig".eslint.setup { return {} end }, - capabilities = lsp_status.capabilities + capabilities = capabilities } --[[ require "lspconfig".java_language_server.setup { @@ -120,6 +114,6 @@ for _, lsp in ipairs(servers) do flags = { debounce_text_changes = 150 }, - capabilities = lsp_status.capabilities + capabilities = capabilities } end diff --git a/spell/de.utf-8.add b/spell/de.utf-8.add index 27f094a..2d1c5e2 100644 --- a/spell/de.utf-8.add +++ b/spell/de.utf-8.add @@ -10,3 +10,5 @@ config technic/! ConfigManager Grenning +BWL +Marriot diff --git a/spell/de.utf-8.add.spl b/spell/de.utf-8.add.spl index 1fe195d5bd008149cd2b59874af2218b4e094bfe..35903991ba7bccf6858214bf094ed614b00e9211 100644 GIT binary patch delta 119 zcmZ3_c$85+%+t5HAT=k)=syDkLj`+cQgT{)ZV6*4V+msh69ba~V>x3EBNNL+d3k$A z1_se2#v;a4#ylX*1mbi?CMM>@%zU6=5l|qX5vata1SpZpm<$w21o4B?7_&gM!^C_^ JMwf}5Y5<_M8O{Iz literal 175 zcmY+7yApyx3`KJ@4mBU(SJ+xuP*Kp@$2BZ4u$DprSQ05_*h?DhrH@A;R&5zUkbc2hPrWqLj!~b=;mDfyDR>kxRj}^|PsG Yf??MKT}Iq@BQyVq<`;#Hvj+t