llm.nvim icon indicating copy to clipboard operation
llm.nvim copied to clipboard

Allow environment variables to be passed

Open blmarket opened this issue 10 months ago • 0 comments

In order to set environment variable only to the LSP server, this set cmd_env from config if available.

Reference: https://neovim.io/doc/user/lsp.html#vim.lsp.ClientConfig


Example usage: See below example lazy.vim plugin configuration. with cmd_env, I can set log_level at the plugin config, instead of global environment.

local M = {
  'blmarket/llm.nvim',
  opts = {
    model = "gemma-7b-it-q4f16_2-MLC",
    backend = "openai",
    url = "http://127.0.0.1:8000/v1/completions",
    lsp = {
      bin_path = vim.fn.expand("$HOME/proj/llm-ls/target/release/llm-ls"),
      cmd_env = {
        LLM_LOG_LEVEL = "DEBUG",
      },
      version = "0.5.2",
    },
    fim = {
      enabled = false,
    },
    context_window = 1024,
    enable_suggestions_on_startup = true,
  },
}

return M

blmarket avatar Mar 31 '24 19:03 blmarket