tune startup time

This commit is contained in:
asep komarudin 2023-03-08 13:52:16 +07:00
parent b7de30e431
commit a745438e75
8 changed files with 126 additions and 95 deletions

View file

@ -12,7 +12,6 @@
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"code_runner.nvim": { "branch": "main", "commit": "a010649236fe245eaab2641a13228cd601499715" },
"dressing.nvim": { "branch": "master", "commit": "5f44f829481640be0f96759c965ae22a3bcaf7ce" },
"fidget.nvim": { "branch": "main", "commit": "688b4fec4517650e29c3e63cfbb6e498b3112ba1" },
"friendly-snippets": { "branch": "main", "commit": "009887b76f15d16f69ae1341f86a7862f61cf2a1" },
"gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" },
"impatient.nvim": { "branch": "main", "commit": "969f2c5c90457612c09cf2a13fee1adaa986d350" },
@ -20,10 +19,11 @@
"jaq-nvim": { "branch": "master", "commit": "236296aae555657487d1bb4d066cbde9d79d8cd4" },
"lazy.nvim": { "branch": "main", "commit": "5b4444f0d7e556deba3f7ca949a2ba0e2c3369fb" },
"live-server": { "branch": "main", "commit": "ecd7c1418823b65dd2bca710587c80afe42c973e" },
"lsp-progress.nvim": { "branch": "main", "commit": "3efe705b2e91693be92aa32d9b41bcb9027393ef" },
"lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "a31e011135a79d63c71254c250c9158e1056a1cb" },
"mason-null-ls.nvim": { "branch": "main", "commit": "29ce60f9a16fef3de682a9365ef635f24ae92bf9" },
"mason.nvim": { "branch": "main", "commit": "add6d1d63d8b86af951ba64b4157fe6b0af173d4" },
"mason.nvim": { "branch": "main", "commit": "bb307c339d14afaaefe624f784e3cf25451817e4" },
"mini.animate": { "branch": "main", "commit": "b0c717ed5513b5f23e7c48615449c7dc9fabd05b" },
"mini.indentscope": { "branch": "main", "commit": "7998edc970610c05598c7aea3d21ece8dd87ed52" },
"neoscroll.nvim": { "branch": "master", "commit": "d7601c26c8a183fa8994ed339e70c2d841253e93" },

View file

@ -31,7 +31,7 @@ vim.g.pcode_transparent_mode = 0
-- 0 disable progress
-- 1 lualine lsp progress
-- 2 fidget progress
vim.g.pcode_progress = 2
vim.g.pcode_progress = 1
-- style
-- 0 = default

View file

@ -5,8 +5,6 @@ return {
"folke/noice.nvim",
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
"nvim-treesitter/nvim-treesitter",
},
-- event = "BufWinEnter",
event = "VeryLazy",
@ -21,6 +19,12 @@ return {
progress = {
enabled = false,
},
hover = {
enabled = false,
},
signature = {
enabled = false,
},
},
},
keys = {
@ -97,7 +101,8 @@ return {
},
{
"hrsh7th/cmp-cmdline",
event = "BufWinEnter",
-- event = "BufWinEnter",
event = "VeryLazy",
config = function()
local cmp = require("cmp")
local mapping = {

View file

@ -2,7 +2,7 @@ return {
-- animations
{
"echasnovski/mini.animate",
event = "VeryLazy",
event = "BufRead",
opts = function()
-- don't use animate when scrolling with the mouse
local mouse_scrolled = false

View file

@ -10,91 +10,101 @@ if data_exists then
lspghost_text = custom_cmp.lspghost_text
end
return {
"hrsh7th/nvim-cmp",
version = false, -- last release is way too old
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lua",
{ "lukas-reineke/cmp-rg", enabled = cmprg }, -- experimental
{ "hrsh7th/cmp-calc", enabled = cmpcalc }, -- experimental
{ "quangnguyen30192/cmp-nvim-tags", enabled = cmptag }, -- experimental
},
opts = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
{ "hrsh7th/cmp-nvim-lsp", event = "BufRead" },
{ "hrsh7th/cmp-buffer", event = "BufRead" },
{ "hrsh7th/cmp-path", event = "BufRead" },
{ "saadparwaiz1/cmp_luasnip", event = "BufRead" },
{ "hrsh7th/cmp-nvim-lua", event = "BufRead" },
{ "lukas-reineke/cmp-rg", enabled = cmprg }, -- experimental
{ "hrsh7th/cmp-calc", enabled = cmpcalc }, -- experimental
{ "quangnguyen30192/cmp-nvim-tags", enabled = cmptag }, -- experimental
{
"hrsh7th/nvim-cmp",
version = false, -- last release is way too old
event = "InsertEnter",
-- dependencies = {
-- "hrsh7th/cmp-nvim-lsp",
-- "hrsh7th/cmp-buffer",
-- "hrsh7th/cmp-path",
-- "saadparwaiz1/cmp_luasnip",
-- "hrsh7th/cmp-nvim-lua",
-- { "lukas-reineke/cmp-rg", enabled = cmprg }, -- experimental
-- { "hrsh7th/cmp-calc", enabled = cmpcalc }, -- experimental
-- { "quangnguyen30192/cmp-nvim-tags", enabled = cmptag }, -- experimental
-- },
opts = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
local check_backspace = function()
local col = vim.fn.col(".") - 1
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
end
local check_backspace = function()
local col = vim.fn.col(".") - 1
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
end
return {
completion = {
completeopt = "menu,menuone,noinsert",
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif check_backspace() then
fallback()
else
fallback()
end
end, {
"i",
"s",
return {
completion = {
completeopt = "menu,menuone,noinsert",
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif check_backspace() then
fallback()
else
fallback()
end
end, {
"i",
"s",
}),
}),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
{ name = "nvim_lua" },
{ name = "rg" }, -- experimental
{ name = "calc" }, -- experimental
{ name = "tags" }, --experimental
}),
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
vim_item.kind = string.format("%s", require("user.icons")["kind"][vim_item.kind])
vim_item.menu = ({
nvim_lsp = "(LSP)",
luasnip = "(Snippet)",
buffer = "(Buffer)",
path = "(Path)",
})[entry.source.name]
return vim_item
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
experimental = {
ghost_text = lspghost_text,
native_menu = false,
},
}
end,
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
{ name = "nvim_lua" },
{ name = "rg" }, -- experimental
{ name = "calc" }, -- experimental
{ name = "tags" }, --experimental
}),
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
vim_item.kind = string.format("%s", require("user.icons")["kind"][vim_item.kind])
vim_item.menu = ({
nvim_lsp = "(LSP)",
luasnip = "(Snippet)",
buffer = "(Buffer)",
path = "(Path)",
})[entry.source.name]
return vim_item
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
experimental = {
ghost_text = lspghost_text,
native_menu = false,
},
}
end,
},
}

View file

@ -68,7 +68,7 @@ return {
},
{
"neovim/nvim-lspconfig",
event = "BufWinEnter",
event = "VeryLazy",
dependencies = {
"williamboman/mason-lspconfig.nvim",
},
@ -247,7 +247,7 @@ return {
-- for resize screen
{
"mrjones2014/smart-splits.nvim",
event = "BufWinEnter",
event = "VeryLazy",
config = function()
require("user.smartspit")
end,

View file

@ -12,7 +12,7 @@ return {
{
"nvim-lualine/lualine.nvim",
-- dependencies = { "kyazdani42/nvim-web-devicons", opt = true },
event = "BufWinEnter",
event = "BufRead",
config = function()
require("user.lualine")
end,
@ -48,7 +48,7 @@ return {
},
{
"akinsho/bufferline.nvim",
event = "BufWinEnter",
event = "BufRead",
config = function()
require("user.bufferline")
end,

View file

@ -13,3 +13,19 @@ if data_exists then
else
require("user.startify")
end
-- Disable statusline in dashboard
vim.api.nvim_create_autocmd("FileType", {
pattern = "alpha",
callback = function()
-- store current statusline value and use that
local old_laststatus = vim.opt.laststatus
vim.api.nvim_create_autocmd("BufUnload", {
buffer = 0,
callback = function()
vim.opt.laststatus = old_laststatus
end,
})
vim.opt.laststatus = 0
end,
})