Xinqi Bao's Git

add avante.nvim and its config
authorXinqi Bao <[email protected]>
Sat, 23 Aug 2025 14:28:39 +0000 (22:28 +0800)
committerXinqi Bao <[email protected]>
Sat, 23 Aug 2025 14:28:39 +0000 (22:28 +0800)
.config/nvim/init.vim
.config/nvim/lua/plugin-config/nvim-avante.lua [new file with mode: 0644]

index 9ec564b..6971f46 100644 (file)
@@ -47,6 +47,9 @@ set nowritebackup
 set undodir=~/.cache/nvim/undodir
 set undofile
 
+" auto added comment leader, detail for :h formatoptions
+set formatoptions+=/
+
 set tags=tags~;,tags~
 "setting gf (go file) path
 "change kernel version to your version, for kernel development
@@ -95,6 +98,27 @@ call plug#begin()
     Plug 'nvim-treesitter/nvim-treesitter'
     "Plug 'mfussenegger/nvim-dap'
     "Plug 'puremourning/vimspector'
+
+    """
+    "" avante and its dependents
+    " Deps
+    Plug 'nvim-lua/plenary.nvim'
+    Plug 'MunifTanjim/nui.nvim'
+    Plug 'MeanderingProgrammer/render-markdown.nvim'
+
+    " Optional deps
+    Plug 'hrsh7th/nvim-cmp'
+    Plug 'nvim-tree/nvim-web-devicons' "or Plug 'echasnovski/mini.icons'
+    Plug 'HakonHarnes/img-clip.nvim'
+    Plug 'zbirenbaum/copilot.lua'
+    Plug 'stevearc/dressing.nvim' " for enhanced input UI
+    Plug 'folke/snacks.nvim' " for modern input UI
+
+    " Yay, pass source=true if you want to build from source
+    Plug 'yetone/avante.nvim', { 'branch': 'main', 'do': 'make' }
+    ""
+    ""
+
 call plug#end()
 
 "----------------------
@@ -237,6 +261,12 @@ if has_key(plugs, 'nvim-treesitter')
     set foldlevel=99
 endif
 
+"----------------------
+" avante.nvim setting
+"----------------------
+if has_key(plugs, 'avante.nvim')
+    lua require('plugin-config/nvim-avante')
+endif
 
 nnoremap J :tabprevious<CR>
 nnoremap K :tabnext<CR>
diff --git a/.config/nvim/lua/plugin-config/nvim-avante.lua b/.config/nvim/lua/plugin-config/nvim-avante.lua
new file mode 100644 (file)
index 0000000..a53a4d9
--- /dev/null
@@ -0,0 +1,15 @@
+require('avante_lib').load()
+require('avante').setup({
+    provider = "claude",
+    providers = {
+        claude = {
+            endpoint = "https://api.anthropic.com",
+            model = "claude-sonnet-4-20250514",
+            timeout = 30000, -- Timeout in milliseconds
+            extra_request_body = {
+                temperature = 0.75,
+                max_tokens = 20480,
+            },
+        },
+    },
+})