This commit is contained in:
2025-12-22 13:54:17 -06:00
parent 7918544153
commit b17afad345
3 changed files with 44 additions and 79 deletions

View File

@@ -36,6 +36,18 @@ return {
}, },
}) })
end, end,
anthropic_opus = function()
return require("codecompanion.adapters").extend("anthropic", {
env = {
api_key = "ANTHROPIC_API_KEY",
},
schema = {
model = {
default = "claude-opus-4-5-20251101",
},
},
})
end,
}, },
}, },
-- Display settings for the chat window -- Display settings for the chat window
@@ -71,6 +83,18 @@ return {
vim.api.nvim_set_keymap("n", "<leader>ca", "<cmd>CodeCompanionActions<cr>", { noremap = true, silent = true }) vim.api.nvim_set_keymap("n", "<leader>ca", "<cmd>CodeCompanionActions<cr>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("v", "<leader>ca", "<cmd>CodeCompanionActions<cr>", { noremap = true, silent = true }) vim.api.nvim_set_keymap("v", "<leader>ca", "<cmd>CodeCompanionActions<cr>", { noremap = true, silent = true })
-- Additional keymaps for Opus
vim.api.nvim_set_keymap(
"n",
"<leader>co",
"<cmd>CodeCompanionChat anthropic_opus Toggle<cr>",
{ noremap = true, silent = true, desc = "Chat with Claude Opus" }
)
vim.api.nvim_set_keymap(
"v",
"<leader>co",
"<cmd>CodeCompanionChat anthropic_opus Toggle<cr>",
{ noremap = true, silent = true, desc = "Chat with Claude Opus" }
)
end, end,
} }

View File

@@ -30,6 +30,7 @@ return {
window = { window = {
mappings = { mappings = {
["\\"] = "close_window", ["\\"] = "close_window",
["/"] = "fuzzy_finder",
}, },
}, },
}, },

View File

@@ -1,54 +1,18 @@
-- modified version of code from this config -- Treesitter configuration for syntax highlighting and text objects
--https://github.com/fredrikaverpil/dotfiles/blob/main/nvim-fredrik/lua/fredrik/plugins/core/treesitter.lua
return { return {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
lazy = false, lazy = false,
priority = 1000, priority = 1000,
build = ":TSUpdate", build = ":TSUpdate",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
},
config = function() config = function()
local ok, treesitter = pcall(require, "nvim-treesitter.configs") require("nvim-treesitter.configs").setup({
if not ok then
vim.notify("nvim-treesitter.configs not available", vim.log.levels.WARN)
return
end
treesitter.setup({
ensure_installed = { ensure_installed = {
"astro", "astro", "bash", "c", "css", "diff", "go", "gomod", "gowork", "gosum",
"bash", "graphql", "html", "javascript", "jsdoc", "json", "jsonc", "json5",
"c", "lua", "luadoc", "luap", "markdown", "markdown_inline", "python",
"css", "query", "regex", "toml", "tsx", "typescript", "vim", "vimdoc",
"diff", "yaml", "ruby",
"go",
"gomod",
"gowork",
"gosum",
"graphql",
"html",
"javascript",
"jsdoc",
"json",
"jsonc",
"json5",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"yaml",
"ruby",
}, },
sync_install = false, sync_install = false,
auto_install = true, auto_install = true,
@@ -56,9 +20,7 @@ return {
enable = true, enable = true,
additional_vim_regex_highlighting = false, additional_vim_regex_highlighting = false,
}, },
indent = { indent = { enable = true },
enable = true,
},
incremental_selection = { incremental_selection = {
enable = true, enable = true,
keymaps = { keymaps = {
@@ -83,38 +45,16 @@ return {
"nvim-treesitter/nvim-treesitter-textobjects", "nvim-treesitter/nvim-treesitter-textobjects",
event = "BufReadPre", event = "BufReadPre",
dependencies = { "nvim-treesitter/nvim-treesitter" }, dependencies = { "nvim-treesitter/nvim-treesitter" },
keys = { opts = {
{ select = {
"af", enable = true,
function() lookahead = true,
require("nvim-treesitter-textobjects.select").select_textobject("@function.outer", "textobjects") keymaps = {
end, ["af"] = "@function.outer",
desc = "Select outer function", ["if"] = "@function.inner",
mode = { "x", "o" }, ["ac"] = "@class.outer",
["ic"] = "@class.inner",
}, },
{
"if",
function()
require("nvim-treesitter-textobjects.select").select_textobject("@function.inner", "textobjects")
end,
desc = "Select inner function",
mode = { "x", "o" },
},
{
"ac",
function()
require("nvim-treesitter-textobjects.select").select_textobject("@class.outer", "textobjects")
end,
desc = "Select outer class",
mode = { "x", "o" },
},
{
"ic",
function()
require("nvim-treesitter-textobjects.select").select_textobject("@class.inner", "textobjects")
end,
desc = "Select inner class",
mode = { "x", "o" },
}, },
}, },
}, },