Improve startuptime | remove un-needed plugins | lazy load plugin highlights too
removed nvim-gps as nvim-navic or winbar.nvim will be added when v0.8 neovim releases. Removed lsp signature as I was able to emulate showing args with the default signature help() window
This commit is contained in:
parent
d42ffe1ac7
commit
0bde81a074
21 changed files with 463 additions and 391 deletions
185
lua/ui/icons.lua
Normal file
185
lua/ui/icons.lua
Normal file
|
@ -0,0 +1,185 @@
|
|||
local M = {}
|
||||
|
||||
M.lspkind = {
|
||||
Namespace = "",
|
||||
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 = " ",
|
||||
Table = "",
|
||||
Object = " ",
|
||||
Tag = "",
|
||||
Array = "[]",
|
||||
Boolean = " ",
|
||||
Number = " ",
|
||||
Null = "ﳠ",
|
||||
String = " ",
|
||||
Calendar = "",
|
||||
Watch = " ",
|
||||
Package = "",
|
||||
}
|
||||
|
||||
M.devicons = {
|
||||
default_icon = {
|
||||
icon = "",
|
||||
name = "Default",
|
||||
},
|
||||
|
||||
c = {
|
||||
icon = "",
|
||||
name = "c",
|
||||
},
|
||||
|
||||
css = {
|
||||
icon = "",
|
||||
name = "css",
|
||||
},
|
||||
|
||||
deb = {
|
||||
icon = "",
|
||||
name = "deb",
|
||||
},
|
||||
|
||||
Dockerfile = {
|
||||
icon = "",
|
||||
name = "Dockerfile",
|
||||
},
|
||||
|
||||
html = {
|
||||
icon = "",
|
||||
name = "html",
|
||||
},
|
||||
|
||||
jpeg = {
|
||||
icon = "",
|
||||
name = "jpeg",
|
||||
},
|
||||
|
||||
jpg = {
|
||||
icon = "",
|
||||
name = "jpg",
|
||||
},
|
||||
|
||||
js = {
|
||||
icon = "",
|
||||
name = "js",
|
||||
},
|
||||
|
||||
kt = {
|
||||
icon = "",
|
||||
name = "kt",
|
||||
},
|
||||
|
||||
lock = {
|
||||
icon = "",
|
||||
name = "lock",
|
||||
},
|
||||
|
||||
lua = {
|
||||
icon = "",
|
||||
name = "lua",
|
||||
},
|
||||
|
||||
mp3 = {
|
||||
icon = "",
|
||||
name = "mp3",
|
||||
},
|
||||
|
||||
mp4 = {
|
||||
icon = "",
|
||||
name = "mp4",
|
||||
},
|
||||
|
||||
out = {
|
||||
icon = "",
|
||||
name = "out",
|
||||
},
|
||||
|
||||
png = {
|
||||
icon = "",
|
||||
name = "png",
|
||||
},
|
||||
|
||||
py = {
|
||||
icon = "",
|
||||
name = "py",
|
||||
},
|
||||
|
||||
["robots.txt"] = {
|
||||
icon = "ﮧ",
|
||||
name = "robots",
|
||||
},
|
||||
|
||||
toml = {
|
||||
icon = "",
|
||||
name = "toml",
|
||||
},
|
||||
|
||||
ts = {
|
||||
icon = "ﯤ",
|
||||
name = "ts",
|
||||
},
|
||||
|
||||
ttf = {
|
||||
icon = "",
|
||||
name = "TrueTypeFont",
|
||||
},
|
||||
|
||||
rb = {
|
||||
icon = "",
|
||||
name = "rb",
|
||||
},
|
||||
|
||||
rpm = {
|
||||
icon = "",
|
||||
name = "rpm",
|
||||
},
|
||||
|
||||
vue = {
|
||||
icon = "﵂",
|
||||
name = "vue",
|
||||
},
|
||||
|
||||
woff = {
|
||||
icon = "",
|
||||
name = "WebOpenFontFormat",
|
||||
},
|
||||
|
||||
woff2 = {
|
||||
icon = "",
|
||||
name = "WebOpenFontFormat2",
|
||||
},
|
||||
|
||||
xz = {
|
||||
icon = "",
|
||||
name = "xz",
|
||||
},
|
||||
|
||||
zip = {
|
||||
icon = "",
|
||||
name = "zip",
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
54
lua/ui/lsp.lua
Normal file
54
lua/ui/lsp.lua
Normal file
|
@ -0,0 +1,54 @@
|
|||
local function lspSymbol(name, icon)
|
||||
local hl = "DiagnosticSign" .. name
|
||||
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
|
||||
end
|
||||
|
||||
lspSymbol("Error", "")
|
||||
lspSymbol("Info", "")
|
||||
lspSymbol("Hint", "")
|
||||
lspSymbol("Warn", "")
|
||||
|
||||
vim.diagnostic.config {
|
||||
virtual_text = {
|
||||
prefix = "",
|
||||
},
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
}
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "single",
|
||||
})
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "single",
|
||||
})
|
||||
|
||||
-- suppress error messages from lang servers
|
||||
vim.notify = function(msg, log_level)
|
||||
if msg:match "exit code" then
|
||||
return
|
||||
end
|
||||
if log_level == vim.log.levels.ERROR then
|
||||
vim.api.nvim_err_writeln(msg)
|
||||
else
|
||||
vim.api.nvim_echo({ { msg } }, true, {})
|
||||
end
|
||||
end
|
||||
|
||||
-- Borders for LspInfo winodw
|
||||
local win = require "lspconfig.ui.windows"
|
||||
local _default_opts = win.default_opts
|
||||
|
||||
win.default_opts = function(options)
|
||||
local opts = _default_opts(options)
|
||||
opts.border = "single"
|
||||
return opts
|
||||
end
|
||||
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "single",
|
||||
silent = true,
|
||||
focusable = false,
|
||||
close_events = { "InsertCharPre", "CursorMoved" },
|
||||
})
|
|
@ -64,36 +64,34 @@ M.mode = function()
|
|||
return current_mode .. mode_sep1 .. "%#ST_EmptySpace#" .. sep_r
|
||||
end
|
||||
|
||||
M.fileInfo = function()
|
||||
local icon = ""
|
||||
M.fileicon = function()
|
||||
local icon = " "
|
||||
|
||||
local filename = fn.fnamemodify(fn.expand "%:t", ":r")
|
||||
local extension = fn.expand "%:e"
|
||||
|
||||
if filename ~= "" then
|
||||
local devicons_present, devicons = pcall(require, "nvim-web-devicons")
|
||||
|
||||
if devicons_present then
|
||||
local ft_icon = devicons.get_icon(filename, extension)
|
||||
icon = (ft_icon ~= nil and " " .. ft_icon) or ""
|
||||
end
|
||||
end
|
||||
|
||||
return "%#St_file_info#" .. icon
|
||||
end
|
||||
|
||||
M.filename = function()
|
||||
local filename = fn.fnamemodify(fn.expand "%:t", ":r")
|
||||
|
||||
if filename == "" then
|
||||
icon = icon .. " Empty "
|
||||
filename = "Empty "
|
||||
else
|
||||
filename = " " .. filename .. " "
|
||||
end
|
||||
|
||||
local devicons_present, devicons = pcall(require, "nvim-web-devicons")
|
||||
|
||||
if not devicons_present then
|
||||
return " "
|
||||
end
|
||||
|
||||
local ft_icon = devicons.get_icon(filename, extension)
|
||||
icon = (ft_icon ~= nil and " " .. ft_icon) or icon
|
||||
|
||||
return "%#St_file_info#" .. icon .. filename .. "%#St_file_sep#" .. sep_r
|
||||
end
|
||||
|
||||
M.gps = function()
|
||||
if vim.o.columns < 140 or not package.loaded["nvim-gps"] then
|
||||
return ""
|
||||
end
|
||||
|
||||
local gps = require "nvim-gps"
|
||||
return (gps.is_available() and gps.get_location()) or ""
|
||||
return "%#St_file_info#" .. filename .. "%#St_file_sep#" .. sep_r
|
||||
end
|
||||
|
||||
M.git = function()
|
||||
|
@ -153,10 +151,10 @@ M.LSP_status = function()
|
|||
local clients = vim.lsp.get_active_clients()
|
||||
local name = false
|
||||
for _, client in ipairs(clients) do
|
||||
if client.attached_buffers[vim.api.nvim_get_current_buf()] then
|
||||
name = client.name
|
||||
break
|
||||
end
|
||||
if client.attached_buffers[vim.api.nvim_get_current_buf()] then
|
||||
name = client.name
|
||||
break
|
||||
end
|
||||
end
|
||||
local content = name and " LSP ~ " .. name .. " " or false
|
||||
return content and ("%#St_LspStatus#" .. content) or ""
|
||||
|
@ -189,12 +187,12 @@ end
|
|||
M.run = function()
|
||||
return table.concat {
|
||||
M.mode(),
|
||||
M.fileInfo(),
|
||||
M.fileicon(),
|
||||
M.filename(),
|
||||
M.git(),
|
||||
|
||||
"%=",
|
||||
M.LSP_progress(),
|
||||
M.gps(),
|
||||
"%=",
|
||||
|
||||
M.LSP_Diagnostics(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue