change completion and updated galaxyline

This commit is contained in:
MasterGordon 2021-10-24 01:38:19 +02:00
parent e82112e9c2
commit 374797caee
7 changed files with 176 additions and 84 deletions

View File

@ -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': '<c-f>'} }")
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"

89
lua/plugins/cmp.lua Normal file
View File

@ -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 = {
["<C-f>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = 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)

View File

@ -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

View File

@ -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}
}
}

View File

@ -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", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", 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

View File

@ -10,3 +10,5 @@ config
technic/!
ConfigManager
Grenning
BWL
Marriot

Binary file not shown.