Posted on :: Tags: , , ,

Everything I need to not forget.

CodeCompanion

Configuration

Standard Lazy.nvim configuration, with some extra options.

{
  "olimorris/codecompanion.nvim",
  opts = {
    adapters = {
      deepseek = function()
        return require("codecompanion.adapters").extend("deepseek", {
          env = {
            api_key = "KEY", -- At the moment I left it hardcoded, but you can use vim.env.KEY or vim.fn.getenv("KEY") to get the key from the environment
          },
          schema = {
            model = {
              default = "deepseek-chat",
            },
          },
        })
      end,
    },
    display = {
      action_palette = {
        -- width = 95,
        -- height = 10,
        prompt = "Prompt ", -- Prompt used for interactive LLM calls
        provider = "default", -- Can be "default", "telescope", "mini_pick" or "snacks". If not specified, the plugin will autodetect installed providers.
        opts = {
          show_default_actions = true, -- Show the default actions in the action palette?
          show_default_prompt_library = true, -- Show the default prompt library in the action palette?
        },
      },
    },
    strategies = {
      chat = {
        -- adapter = "deepseek",
        -- adapter = "anthropic",
      },
      inline = {
        -- adapter = "copilot",
      },
      cmd = {
        -- adapter = "deepseek",
      },
    },
    extensions = {
      history = {
        enabled = true,
        opts = {
          -- Keymap to open history from chat buffer (default: gh)
          keymap = "gh",
          -- Automatically generate titles for new chats
          auto_generate_title = true,
          ---On exiting and entering neovim, loads the last chat on opening chat
          continue_last_chat = false,
          ---When chat is cleared with `gx` delete the chat from history
          delete_on_clearing_chat = false,
          -- Picker interface ("telescope" or "snacks" or "default")
          picker = "telescope",
          ---Enable detailed logging for history extension
          enable_logging = false,
          ---Directory path to save the chats
          dir_to_save = vim.fn.stdpath("data") .. "/codecompanion-history",
          -- Save all chats by default
          auto_save = true,
          -- Keymap to save the current chat manually
          save_chat_keymap = "sc",
        },
      },
      vectorcode = {
        opts = {
          add_tool = true,
        },
      },
    },
  },
  dependencies = {
    "nvim-lua/plenary.nvim",
    "nvim-treesitter/nvim-treesitter",
    "ravitemer/codecompanion-history.nvim",
  },
}

Extensions

History

Just install the plugin:

{
    "olimorris/codecompanion.nvim",
    dependencies = {
        --other plugins
        "ravitemer/codecompanion-history.nvim"
    }
}

And add it to the extensions as shown above. While in the CodeCompanion chat, use gh to open the history, and sc to save the current chat.

VectorCode

Configuration is needed. First install pipx. Then install the package:

pipx install vectorcode

Then, cd into your code and run vectorcode init to initialize the vector database. Finally, run:

vectorcode vectorise src/**/*.py

Also install the plugin:

{
  "Davidyz/VectorCode",
  version = "*", -- optional, depending on whether you're on nightly or release
  build = "pipx upgrade vectorcode", -- optional but recommended. This keeps your CLI up-to-date.
  dependencies = { "nvim-lua/plenary.nvim" },
}

To grant the LLM access to your indexed codebases, simply mention the @vectorcode tool in the chat buffer. The LLM can then query any projects indexed by VectorCode (verifiable via vectorcode ls in the terminal) to retrieve relevant context for your prompts.