fix: load avante_lib synchronously when not using lazy (#1345)

This commit is contained in:
Ojas Kavathe
2025-02-23 12:41:39 +05:30
committed by GitHub
parent 7255e16020
commit 4be3574583
2 changed files with 24 additions and 6 deletions

View File

@@ -137,7 +137,6 @@ Plug 'zbirenbaum/copilot.lua'
" Yay, pass source=true if you want to build from source
Plug 'yetone/avante.nvim', { 'branch': 'main', 'do': 'make' }
autocmd! User avante.nvim lua << EOF
require('avante_lib').load()
require('avante').setup()
EOF
```
@@ -169,7 +168,6 @@ add({ source = 'zbirenbaum/copilot.lua' })
add({ source = 'HakonHarnes/img-clip.nvim' })
add({ source = 'MeanderingProgrammer/render-markdown.nvim' })
now(function() require('avante_lib').load() end)
later(function() require('render-markdown').setup({...}) end)
later(function()
require('img-clip').setup({...}) -- config img-clip
@@ -205,7 +203,6 @@ end)
branch = 'main',
run = 'make',
config = function()
require('avante_lib').load()
require('avante').setup()
end
}
@@ -213,6 +210,24 @@ end)
</details>
<details>
<summary><a href="https://github.com/nix-community/home-manager">Home Manager</a></summary>
```nix
programs.neovim = {
plugins = [
{
plugin = pkgs.vimPlugins.avante-nvim;
type = "lua";
config = ''require("avante").setup()'' # or builtins.readFile ./plugins/avante.lua;
}
];
};
```
</details>
<details>
<summary>Lua</summary>
@@ -231,20 +246,21 @@ require('copilot').setup ({
require('render-markdown').setup ({
-- use recommended settings from above
})
require('avante_lib').load()
require('avante').setup ({
-- Your config here!
})
```
**NOTE**: For <code>avante.tokenizers</code> and templates to work, make sure to call <code>require('avante_lib').load()</code> somewhere when entering the editor. We will leave the users to decide where it fits to do this, as this varies among configurations. (But we do recommend running this after where you set your colorscheme)
</details>
> [!IMPORTANT]
>
> `avante.nvim` is currently only compatible with Neovim 0.10.1 or later. Please ensure that your Neovim version meets these requirements before proceeding.
> [!NOTE]
>
> When loading the plugin synchronously, we recommend `require`ing it sometime after your colorscheme.
> [!NOTE]
>
> Recommended **Neovim** options:

View File

@@ -49,6 +49,8 @@ H.load_path = function()
pattern = "VeryLazy",
callback = load_path,
})
else
require("avante_lib").load()
end
end