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
6
init.lua
6
init.lua
|
@ -1,9 +1,3 @@
|
|||
local present, impatient = pcall(require, "impatient")
|
||||
|
||||
if present then
|
||||
impatient.enable_profile()
|
||||
end
|
||||
|
||||
require "core"
|
||||
require "core.utils"
|
||||
require "core.options"
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
-- https://github.com/max397574/omega-nvim/blob/master/lua/omega/modules/ui/bufferline.lua
|
||||
local lazy_load = function(tb)
|
||||
vim.api.nvim_create_autocmd(tb.events, {
|
||||
pattern = "*",
|
||||
group = vim.api.nvim_create_augroup(tb.augroup_name, {}),
|
||||
callback = function()
|
||||
if tb.condition() then
|
||||
vim.api.nvim_del_augroup_by_name(tb.augroup_name)
|
||||
|
||||
-- dont defer for treesitter as it will show slow highlighting
|
||||
-- This deferring only happens only when we do "nvim filename"
|
||||
if tb.plugins ~= "nvim-treesitter" then
|
||||
vim.defer_fn(function()
|
||||
vim.cmd("PackerLoad " .. tb.plugins)
|
||||
end, 0)
|
||||
else
|
||||
vim.cmd("PackerLoad " .. tb.plugins)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
local M = {}
|
||||
|
||||
M.bufferline = function()
|
||||
lazy_load {
|
||||
events = { "BufNewFile", "BufAdd", "TabEnter" },
|
||||
augroup_name = "BufferLineLazy",
|
||||
plugins = "bufferline.nvim",
|
||||
|
||||
condition = function()
|
||||
return #vim.fn.getbufinfo { buflisted = 1 } >= 2
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
M.colorizer = function()
|
||||
lazy_load {
|
||||
events = { "BufRead", "BufNewFile" },
|
||||
augroup_name = "ColorizerLazy",
|
||||
plugins = "nvim-colorizer.lua",
|
||||
|
||||
condition = function()
|
||||
local items = { "#", "rgb", "hsl" }
|
||||
|
||||
for _, val in ipairs(items) do
|
||||
if vim.fn.search(val) ~= 0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
-- load certain plugins only when there's a file opened in the buffer
|
||||
-- if "nvim-file" is executed -> load the plugin after nvim gui loads
|
||||
-- This gives an instant preview of nvim with the file opened
|
||||
|
||||
M.on_file_open = function()
|
||||
lazy_load {
|
||||
events = { "BufRead", "BufWinEnter", "BufNewFile" },
|
||||
augroup_name = "BeLazyOnFileOpen",
|
||||
plugins = "nvim-lsp-installer indent-blankline.nvim",
|
||||
|
||||
condition = function()
|
||||
local file = vim.fn.expand "%"
|
||||
return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= ""
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
M.treesitter = function()
|
||||
lazy_load {
|
||||
events = { "BufRead", "BufWinEnter", "BufNewFile" },
|
||||
augroup_name = "Treesitter_lazy",
|
||||
plugins = "nvim-treesitter",
|
||||
|
||||
condition = function()
|
||||
local file = vim.fn.expand "%"
|
||||
return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= ""
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
M.gitsigns = function()
|
||||
-- taken from https://github.com/max397574
|
||||
vim.api.nvim_create_autocmd({ "BufAdd", "VimEnter" }, {
|
||||
callback = function()
|
||||
local function onexit(code, _)
|
||||
if code == 0 then
|
||||
vim.schedule(function()
|
||||
require("packer").loader "gitsigns.nvim"
|
||||
end)
|
||||
end
|
||||
end
|
||||
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
||||
if lines ~= { "" } then
|
||||
vim.loop.spawn("git", {
|
||||
args = {
|
||||
"ls-files",
|
||||
"--error-unmatch",
|
||||
vim.fn.expand "%",
|
||||
},
|
||||
}, onexit)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
|
@ -1,15 +1,15 @@
|
|||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
|
||||
local config = require("core.utils").load_config()
|
||||
|
||||
g.nvchad_theme = config.ui.theme
|
||||
g.toggle_theme_icon = " "
|
||||
g.transparency = config.ui.transparency
|
||||
g.theme_switcher_loaded = false
|
||||
|
||||
-- use filetype.lua instead of filetype.vim
|
||||
g.did_load_filetypes = 0
|
||||
g.do_filetype_lua = 1
|
||||
g.toggle_theme_icon = " "
|
||||
g.transparency = config.ui.transparency
|
||||
|
||||
opt.laststatus = 3 -- global statusline
|
||||
opt.statusline = config.plugins.options.statusline.config
|
||||
|
@ -76,6 +76,19 @@ local default_plugins = {
|
|||
"vimballPlugin",
|
||||
"zip",
|
||||
"zipPlugin",
|
||||
"python3_provider",
|
||||
"python_provider",
|
||||
"node_provider",
|
||||
"ruby_provider",
|
||||
"perl_provider",
|
||||
"tutor",
|
||||
"rplugin",
|
||||
"syntax",
|
||||
"synmenu",
|
||||
"optwin",
|
||||
"compiler",
|
||||
"bugreport",
|
||||
"ftplugin",
|
||||
}
|
||||
|
||||
for _, plugin in pairs(default_plugins) do
|
||||
|
|
|
@ -114,13 +114,6 @@ M.load_mappings = function(mappings, mapping_opt)
|
|||
end
|
||||
end
|
||||
|
||||
-- load plugin after entering vim ui
|
||||
M.packer_lazy_load = function(plugin)
|
||||
vim.defer_fn(function()
|
||||
require("packer").loader(plugin)
|
||||
end, 0)
|
||||
end
|
||||
|
||||
-- remove plugins defined in chadrc
|
||||
M.remove_default_plugins = function(plugins)
|
||||
local removals = M.load_config().plugins.remove or {}
|
||||
|
|
|
@ -4,6 +4,8 @@ if not present then
|
|||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "alpha"
|
||||
|
||||
local function button(sc, txt, keybind)
|
||||
local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ if not present then
|
|||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "bufferline"
|
||||
|
||||
vim.cmd [[
|
||||
function! Toggle_theme(a,b,c,d)
|
||||
lua require('base46').toggle_theme()
|
||||
|
|
|
@ -4,6 +4,8 @@ if not present then
|
|||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "cmp"
|
||||
|
||||
vim.opt.completeopt = "menuone,noselect"
|
||||
|
||||
local function border(hl_name)
|
||||
|
@ -45,9 +47,8 @@ local options = {
|
|||
},
|
||||
formatting = {
|
||||
format = function(_, vim_item)
|
||||
local icons = require "plugins.configs.lspkind_icons"
|
||||
local icons = require("ui.icons").lspkind
|
||||
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
|
||||
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
local present, gps = pcall(require, "nvim-gps")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local icons = require "plugins.configs.lspkind_icons"
|
||||
|
||||
local options = {
|
||||
depth = 5,
|
||||
|
||||
icons = {
|
||||
["class-name"] = "%#GpsItemKindClass#" .. icons.Class .. "%*" .. " ",
|
||||
["function-name"] = "%#GpsItemKindFunction#" .. icons.Function .. "%*" .. " ",
|
||||
["method-name"] = "%#GpsItemKindMethod#" .. icons.Method .. "%*" .. " ",
|
||||
["container-name"] = "%#GpsItemKindProperty#" .. icons.Object .. "%*" .. " ",
|
||||
["tag-name"] = "%#GpsItemKindKeyword#" .. icons.Tag .. "%*" .. " ",
|
||||
["mapping-name"] = "%#GpsItemKindProperty#" .. icons.Object .. "%*" .. " ",
|
||||
["sequence-name"] = "%GpsItemKindProperty#" .. icons.Array .. "%*" .. " ",
|
||||
["null-name"] = "%GpsItemKindField#" .. icons.Field .. "%*" .. " ",
|
||||
["boolean-name"] = "%GpsItemKindValue#" .. icons.Boolean .. "%*" .. " ",
|
||||
["integer-name"] = "%GpsItemKindValue#" .. icons.Number .. "%*" .. " ",
|
||||
["float-name"] = "%GpsItemKindValue#" .. icons.Number .. "%*" .. " ",
|
||||
["string-name"] = "%GpsItemKindValue#" .. icons.String .. "%*" .. " ",
|
||||
["array-name"] = "%GpsItemKindProperty#" .. icons.Array .. "%*" .. " ",
|
||||
["object-name"] = "%GpsItemKindProperty#" .. icons.Object .. "%*" .. " ",
|
||||
["number-name"] = "%GpsItemKindValue#" .. icons.Number .. "%*" .. " ",
|
||||
["table-name"] = "%GpsItemKindProperty#" .. icons.Table .. "%*" .. " ",
|
||||
["date-name"] = "%GpsItemKindValue#" .. icons.Calendar .. "%*" .. " ",
|
||||
["date-time-name"] = "%GpsItemKindValue#" .. icons.Table .. "%*" .. " ",
|
||||
["inline-table-name"] = "%GpsItemKindProperty#" .. icons.Calendar .. "%*" .. " ",
|
||||
["time-name"] = "%GpsItemKindValue#" .. icons.Watch .. "%*" .. " ",
|
||||
["module-name"] = "%GpsItemKindModule#" .. icons.Module .. "%*" .. " ",
|
||||
},
|
||||
}
|
||||
|
||||
options = require("core.utils").load_override(options, "SmiteshP/nvim-gps")
|
||||
|
||||
gps.setup(options)
|
|
@ -1,128 +0,0 @@
|
|||
local present, devicons = pcall(require, "nvim-web-devicons")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local options = {
|
||||
override = {
|
||||
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",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- check for any override
|
||||
options = require("core.utils").load_override(options, "kyazdani42/nvim-web-devicons")
|
||||
|
||||
devicons.setup(options)
|
|
@ -4,20 +4,12 @@ if not present then
|
|||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "lsp"
|
||||
|
||||
local M = {}
|
||||
local utils = require "core.utils"
|
||||
|
||||
require("plugins.configs.others").lsp_handlers()
|
||||
|
||||
-- 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
|
||||
require "ui.lsp"
|
||||
|
||||
M.on_attach = function(client, bufnr)
|
||||
client.resolved_capabilities.document_formatting = false
|
||||
|
@ -25,6 +17,16 @@ M.on_attach = function(client, bufnr)
|
|||
|
||||
local lsp_mappings = utils.load_config().mappings.lspconfig
|
||||
utils.load_mappings({ lsp_mappings }, { buffer = bufnr })
|
||||
|
||||
if client.supports_method "textDocument/signatureHelp" then
|
||||
vim.api.nvim_create_autocmd({ "CursorHoldI" }, {
|
||||
pattern = "*",
|
||||
group = vim.api.nvim_create_augroup("LspSignature", {}),
|
||||
callback = function()
|
||||
vim.lsp.buf.signature_help()
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
return {
|
||||
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 = "",
|
||||
String = "",
|
||||
Calendar = " ",
|
||||
Watch = "",
|
||||
}
|
|
@ -4,6 +4,8 @@ if not present then
|
|||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "nvimtree"
|
||||
|
||||
local options = {
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
|
|
|
@ -4,6 +4,8 @@ if not present then
|
|||
return
|
||||
end
|
||||
|
||||
require "base46.term"
|
||||
|
||||
local options = {
|
||||
terminals = {
|
||||
list = {},
|
||||
|
|
|
@ -19,28 +19,9 @@ M.autopairs = function()
|
|||
autopairs.setup(options)
|
||||
|
||||
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end
|
||||
|
||||
M.better_escape = function()
|
||||
local present, escape = pcall(require, "better_escape")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local options = {
|
||||
mapping = { "jk" }, -- a table with mappings to use
|
||||
timeout = vim.o.timeoutlen,
|
||||
clear_empty_lines = false, -- clear line after escaping if there is only whitespace
|
||||
keys = "<Esc>",
|
||||
}
|
||||
|
||||
options = load_override(options, "max397574/better-escape.nvim")
|
||||
escape.setup(options)
|
||||
end
|
||||
|
||||
M.blankline = function()
|
||||
local present, blankline = pcall(require, "indent_blankline")
|
||||
|
||||
|
@ -48,6 +29,8 @@ M.blankline = function()
|
|||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "blankline"
|
||||
|
||||
local options = {
|
||||
indentLine_enabled = 1,
|
||||
char = "▏",
|
||||
|
@ -59,7 +42,6 @@ M.blankline = function()
|
|||
"lspinfo",
|
||||
"TelescopePrompt",
|
||||
"TelescopeResults",
|
||||
"nvchad_cheatsheet",
|
||||
"lsp-installer",
|
||||
"",
|
||||
},
|
||||
|
@ -99,9 +81,9 @@ M.colorizer = function()
|
|||
}
|
||||
|
||||
options = load_override(options, "NvChad/nvim-colorizer.lua")
|
||||
|
||||
colorizer.setup(options["filetypes"], options["user_default_options"])
|
||||
vim.cmd "ColorizerReloadAllBuffers"
|
||||
|
||||
vim.cmd "ColorizerAttachToBuffer"
|
||||
end
|
||||
|
||||
M.comment = function()
|
||||
|
@ -130,79 +112,9 @@ M.luasnip = function()
|
|||
|
||||
options = load_override(options, "L3MON4D3/LuaSnip")
|
||||
luasnip.config.set_config(options)
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end
|
||||
|
||||
M.signature = function()
|
||||
local present, lsp_signature = pcall(require, "lsp_signature")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local options = {
|
||||
bind = true,
|
||||
doc_lines = 0,
|
||||
floating_window = true,
|
||||
fix_pos = true,
|
||||
hint_enable = true,
|
||||
hint_prefix = " ",
|
||||
hint_scheme = "String",
|
||||
hi_parameter = "Search",
|
||||
max_height = 22,
|
||||
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
|
||||
handler_opts = {
|
||||
border = "single", -- double, single, shadow, none
|
||||
},
|
||||
zindex = 200, -- by default it will be on top of all floating windows, set to 50 send it to bottom
|
||||
padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc
|
||||
}
|
||||
|
||||
options = load_override(options, "ray-x/lsp_signature.nvim")
|
||||
lsp_signature.setup(options)
|
||||
end
|
||||
|
||||
M.lsp_handlers = function()
|
||||
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
|
||||
end
|
||||
|
||||
M.gitsigns = function()
|
||||
local present, gitsigns = pcall(require, "gitsigns")
|
||||
|
||||
|
@ -210,6 +122,8 @@ M.gitsigns = function()
|
|||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "git"
|
||||
|
||||
local options = {
|
||||
signs = {
|
||||
add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" },
|
||||
|
@ -219,9 +133,21 @@ M.gitsigns = function()
|
|||
changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" },
|
||||
},
|
||||
}
|
||||
options = load_override(options, "lewis6991/gitsigns.nvim")
|
||||
|
||||
options = load_override(options, "lewis6991/gitsigns.nvim")
|
||||
gitsigns.setup(options)
|
||||
end
|
||||
|
||||
M.devicons = function()
|
||||
local present, devicons = pcall(require, "nvim-web-devicons")
|
||||
|
||||
if present then
|
||||
require("base46").load_highlight "devicons"
|
||||
|
||||
local options = { override = require("ui.icons").devicons }
|
||||
options = require("core.utils").load_override(options, "kyazdani42/nvim-web-devicons")
|
||||
devicons.setup(options)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -4,6 +4,10 @@ if not present then
|
|||
return
|
||||
end
|
||||
|
||||
vim.g.theme_switcher_loaded = true
|
||||
|
||||
require("base46").load_highlight "telescope"
|
||||
|
||||
local options = {
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
|
|
|
@ -4,6 +4,9 @@ if not present then
|
|||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "syntax"
|
||||
require("base46").load_highlight "treesitter"
|
||||
|
||||
local options = {
|
||||
ensure_installed = {
|
||||
"lua",
|
||||
|
|
|
@ -4,6 +4,8 @@ if not present then
|
|||
return
|
||||
end
|
||||
|
||||
require("base46").load_highlight "whichkey"
|
||||
|
||||
local options = {
|
||||
|
||||
icons = {
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
vim.cmd "packadd packer.nvim"
|
||||
|
||||
local lazy_load = require "core.lazy_load"
|
||||
|
||||
local plugins = {
|
||||
|
||||
["nvim-lua/plenary.nvim"] = {},
|
||||
["lewis6991/impatient.nvim"] = {},
|
||||
["wbthomason/packer.nvim"] = {},
|
||||
["NvChad/extensions"] = {},
|
||||
["NvChad/extensions"] = { module = "nvchad", cmd = "Telescope" },
|
||||
|
||||
["NvChad/base46"] = {
|
||||
after = "plenary.nvim",
|
||||
|
@ -24,43 +27,40 @@ local plugins = {
|
|||
},
|
||||
|
||||
["kyazdani42/nvim-web-devicons"] = {
|
||||
after = "base46",
|
||||
module = "nvim-web-devicons",
|
||||
config = function()
|
||||
require "plugins.configs.icons"
|
||||
end,
|
||||
},
|
||||
|
||||
["SmiteshP/nvim-gps"] = {
|
||||
event = "CursorMoved",
|
||||
config = function()
|
||||
require "plugins.configs.gps"
|
||||
require("plugins.configs.others").devicons()
|
||||
end,
|
||||
},
|
||||
|
||||
["akinsho/bufferline.nvim"] = {
|
||||
tag = "v2.*",
|
||||
after = "nvim-web-devicons",
|
||||
opt = true,
|
||||
setup = lazy_load.bufferline(),
|
||||
config = function()
|
||||
require "plugins.configs.bufferline"
|
||||
end,
|
||||
},
|
||||
|
||||
["lukas-reineke/indent-blankline.nvim"] = {
|
||||
event = "BufRead",
|
||||
opt = true,
|
||||
config = function()
|
||||
require("plugins.configs.others").blankline()
|
||||
end,
|
||||
},
|
||||
|
||||
["NvChad/nvim-colorizer.lua"] = {
|
||||
event = "BufRead",
|
||||
opt = true,
|
||||
setup = lazy_load.colorizer(),
|
||||
config = function()
|
||||
require("plugins.configs.others").colorizer()
|
||||
end,
|
||||
},
|
||||
|
||||
["nvim-treesitter/nvim-treesitter"] = {
|
||||
event = { "BufRead", "BufNewFile" },
|
||||
module = "nvim-treesitter",
|
||||
cmd = { "TSInstall", "TSUninstall" },
|
||||
setup = lazy_load.treesitter(),
|
||||
run = ":TSUpdate",
|
||||
config = function()
|
||||
require "plugins.configs.treesitter"
|
||||
|
@ -70,25 +70,17 @@ local plugins = {
|
|||
-- git stuff
|
||||
["lewis6991/gitsigns.nvim"] = {
|
||||
opt = true,
|
||||
setup = lazy_load.gitsigns(),
|
||||
config = function()
|
||||
require("plugins.configs.others").gitsigns()
|
||||
end,
|
||||
setup = function()
|
||||
require("core.utils").packer_lazy_load "gitsigns.nvim"
|
||||
end,
|
||||
},
|
||||
|
||||
-- lsp stuff
|
||||
|
||||
["williamboman/nvim-lsp-installer"] = {
|
||||
opt = true,
|
||||
setup = function()
|
||||
require("core.utils").packer_lazy_load "nvim-lsp-installer"
|
||||
-- reload the current file so lsp actually starts for it
|
||||
vim.defer_fn(function()
|
||||
vim.cmd 'if &ft == "packer" | echo "" | else | silent! e %'
|
||||
end, 0)
|
||||
end,
|
||||
setup = lazy_load.on_file_open(),
|
||||
},
|
||||
|
||||
["neovim/nvim-lspconfig"] = {
|
||||
|
@ -100,15 +92,6 @@ local plugins = {
|
|||
end,
|
||||
},
|
||||
|
||||
["ray-x/lsp_signature.nvim"] = {
|
||||
after = "nvim-lspconfig",
|
||||
config = function()
|
||||
require("plugins.configs.others").signature()
|
||||
end,
|
||||
},
|
||||
|
||||
|
||||
|
||||
-- load luasnips + cmp related in insert mode only
|
||||
|
||||
["rafamadriz/friendly-snippets"] = {
|
||||
|
@ -190,11 +173,9 @@ local plugins = {
|
|||
end,
|
||||
},
|
||||
|
||||
-- Only load whichkey after all the gui
|
||||
["folke/which-key.nvim"] = {
|
||||
opt = true,
|
||||
setup = function()
|
||||
require("core.utils").packer_lazy_load "which-key.nvim"
|
||||
end,
|
||||
module = "which-key",
|
||||
config = function()
|
||||
require "plugins.configs.whichkey"
|
||||
end,
|
||||
|
|
|
@ -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
|
|
@ -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…
Reference in New Issue