-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve startuptime | remove un-needed plugins | lazy load plugin hig…
…hlights 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
- Loading branch information
Showing
21 changed files
with
461 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
startuptime difference
Tested on this machine (hdd too)
![image](https://user-images.githubusercontent.com/59060246/173574444-6be19633-2d51-4ecb-9bb5-3e8d4674e0c4.png)
vanilla nvim startuptime
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also bufferline loads when there are 1+ buffers as it doesnt really make any sense to have bufferline opening on startup when there's just 1 file opened ( file name can be seen in statusline )
Impatient was removed as it doesnt work with our config as we have a lazy loaded config, it works with non lazy loaded configs only
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck I just updated and it appears my custom folder is no longer loaded.
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to reproduce this issue, can u try minimal chadrc?
try
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck my custom config didn't change, I just run
:NvChadUpdate
I can try a minimal chadrc.
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cj do a packersync and reopen neovim
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mappings.lua is not getting used either. I tried running PackerSync :/
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mine work, lemme show u a video
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplescreenrecorder-2022-06-14_19.22.12.mp4
@cj
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck strange, did you see my gif above?
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removed
lazy_load
from utils? I will used it on custom plugins0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya its weird, do a clean install
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it doesnt really do lazy_loading , it just loads stuff after the gui enters. so your startuptime will still be the same when u do hyperfine "nvim +q" , try it
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do a packersync
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck I tried a clean install, same thing, didn't pick up anything
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cj i did a clean install + setup my custom config in front of you, you can see that it works flawlessly here
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did.
I also try:
then:
did not help =(
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eugene-gavriloff watch the video i sent before, i did a clean install and everything works :l
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like since the change, something in the custom plugins or overrides is throwing an error but getting ignored, which stops loading the entire custom folder.
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I highly doubt, did u not see my video? it seems as if the changes over there arent pulled properly or you packercompile wasnt done
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My custom config was broken after update. I remove
custom
folder and it's works.I'm migrating my custom config...)
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eugene-gavriloff bisect the custom folder i.e remove line by line in chadrc and see the changes
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gitsigns.nvim sometimes doesn't be loaded
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try putting multiple print statements
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make an issue on repo
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck that's what I am doing too, it's strange that no errors are being thrown.
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eugene-gavriloff did you resolve this? A :PackerSync did not fix the issue.
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cj did you remove lazy loading for lspconfig?
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck nope. I have narrowed it down to my override.lua file https://gist.github.com/cj/e3d62f432729ee7d9df4669e102d6515 when I require that in chadrc.lua the custom folder no longer works, but I get no errors.
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cj seems to be an issue with your override file probably. Show me your chadrc!
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck https://gist.github.com/cj/3ff7a78357f5994bc7656f70b7aed218
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cj if you dont mind then share your whole custom folder compressed. I will test it locally here :)
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck https://jmp.sh/bGMK4dM - Thank you!
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvim 0.7 is ok ,but 0.8 dev not working
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomasky use 0.7 until 0.8 releases. We give full support to the latest stable release of neovim, which is 0.7 currently
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also on 0.8 and it works perfectly for me (I created this autocmd)
it has nothing to do with 0.7 vs 0.8
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont know why it is not working,sometimes return 0, but return 128 most of the time,maybe
vim.loop.spawn("git", {
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck I think the issue is loading telescope.actions inside of override.lua
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you even know what the function is intended to do?
It should load gitsigns, if you're in a file which is tracked by git
perhaps most of your files aren't
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if i new a file ,add something in the file and save, then reopen it ,the code =1 ,not 0 at neovim 0.7
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes that's correctly
if the code isn't 0 gitsigns won't be loaded
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem is ,if i open the new file which not
git add
,then open other file which is added by git ,the gitsign will not display0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck looks like the custom folder I linked before was wrong, here is the correct one https://jumpshare.com/v/24uDuIAt75Gm4ynAVOnV
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try it after dinner
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cj i think requiring cmp is messing up it, your cmp config almost looks like the rewrite of the default cmp config. I suggest you to use a different config for it rather than overriding it
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
soo this in your custom plugins section
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck that seems to do the trick, but now I get
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the default plugins section change this to
This :
![image](https://user-images.githubusercontent.com/59060246/173656505-fb977404-9d7d-4533-86db-08ab037528eb.png)
reopen nvim and do a packersync and reopen nvim again xD
lemme know if its fixed, if yes then I will push the changes
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck that fixed it - thank you!
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck , If I change it this way, gitsigns works
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomasky cool, i'll add it in next commit
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck ,how to lazy load my custom plugins in
custom/plugins/init.lua
file ?0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the gitsigns maybe just need to be loaded at
BufAdd
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
never use that old packer_lazy_load function, it just loads the plugin after gui. Do real lazy loading
![image](https://user-images.githubusercontent.com/59060246/173731620-d4fe5113-6d80-4a9d-a41c-550e9a548269.png)
read this part
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I known ,so i use this method
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siduck ,every time I open a file, the gitsigns will be loaded ,I don't think it is necessary. Maybe just like this:
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think gitsigns will be loaded only on git tracked files
0bde81a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, But it should only be loaded once