diff --git a/init.lua b/init.lua index bf32cef..6a8985f 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,7 @@ require("user.options") require("user.keymaps") require("user.plugins") +require("user.autocmds") vim.cmd.colorscheme("tokyonight-storm") diff --git a/lua/plugins/avante.lua b/lua/plugins/avante.lua index b3bb012..3378988 100644 --- a/lua/plugins/avante.lua +++ b/lua/plugins/avante.lua @@ -2,7 +2,7 @@ -- [DEPRECATED] The configuration of `claude.max_tokens` should be placed in `providers.claude.extra_request_body.max_toke -- ns`; for detailed migration instructions, please visit: https://github.com/yetone/avante.nvim/wiki/Provider-configurati -- [DEPRECATED] The configuration of `openai` should be placed in `providers.openai`. For detailed migration instructions, --- please visit: https://github.com/yetone/avante.nvim/wiki/Provider-configuration-migration-guide +-- please visit: https://github.com/yetone/avante.nvim/wiki/Provider-configuration-migration-guide return { "yetone/avante.nvim", @@ -14,7 +14,7 @@ return { -- for example -- provider = "openai", provider = "claude", - providers = { + providers = { claude = { endpoint = "https://api.anthropic.com", model = "claude-3-5-sonnet-20241022", diff --git a/lua/user/autocmds.lua b/lua/user/autocmds.lua new file mode 100644 index 0000000..0be12b5 --- /dev/null +++ b/lua/user/autocmds.lua @@ -0,0 +1,17 @@ +vim.api.nvim_create_autocmd("VimEnter", { + callback = function() + local project_config = vim.fn.getcwd() .. "/.project.lua" + if vim.fn.filereadable(project_config) == 1 then + dofile(project_config) + end + end, +}) + +-- remove trailing spaces +vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*", + callback = function() + vim.cmd("%s/\\s\\+$//e") + end, +}) + diff --git a/old/lua/config/autocmds.lua b/old/lua/config/autocmds.lua deleted file mode 100644 index d2578fd..0000000 --- a/old/lua/config/autocmds.lua +++ /dev/null @@ -1,17 +0,0 @@ --- Autocmds are automatically loaded on the VeryLazy event --- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua --- --- Add any additional autocmds here --- with `vim.api.nvim_create_autocmd` --- --- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults) --- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell") - -vim.api.nvim_create_autocmd("VimEnter", { - callback = function() - local project_config = vim.fn.getcwd() .. "/.project.lua" - if vim.fn.filereadable(project_config) == 1 then - dofile(project_config) - end - end, -})