Skip to content

Configuration

Full Schema

lua
require('bonk').setup({
  -- Server
  server = {
    path = nil,                   -- auto-detected from plugin path
    node_binary = 'node',         -- path to node executable
    log_level = 'warn',           -- 'debug', 'info', 'warn', 'error'
    idle_timeout = 60,            -- seconds before server shuts down with no clients
    state_dir = '~/.local/state/bonk/',
  },

  -- Phase 1: Completions
  completion = {
    model = 'claude-opus-4-6',
    max_tokens = 512,
    context_budget = 32768,
    timeout = 30000,              -- ms
    auto_dismiss_on = {           -- events that dismiss ghost text
      'InsertLeave',
      'BufLeave',
    },
  },

  -- Phase 2: Chat
  chat = {
    model = 'claude-opus-4-6',
    position = 'right',
    width = 80,
    height = 20,
    session_timeout = 1800,       -- seconds
  },

  -- Context
  context = {
    budget = 32768,               -- characters
    prefix_ratio = 0.75,          -- % of current-file budget for pre-cursor content
    max_file_size = 1048576,      -- 1MB, skip files larger than this
    track_edits = true,
    max_edit_history = 100,
    resolve_imports = true,
    gitignore = true,
  },

  -- UI
  highlights = {
    ghost_text = 'Comment',       -- highlight group for ghost text
  },
})

Server Options

OptionTypeDefaultDescription
pathstring?nilPath to server directory. Auto-detected from plugin install path.
node_binarystring'node'Path to the Node.js executable.
log_levelstring'warn'Log verbosity: 'debug', 'info', 'warn', 'error'.
idle_timeoutnumber60Seconds before the server shuts down when no clients are connected.
state_dirstring'~/.local/state/bonk/'Directory for the server lock file and runtime state.

Completion Options

OptionTypeDefaultDescription
modelstring'claude-opus-4-6'Claude model used for completions.
max_tokensnumber512Maximum number of tokens in a completion response.
context_budgetnumber32768Character budget for context sent with each request.
timeoutnumber30000Milliseconds before a completion request is cancelled.
auto_dismiss_onstring[]{'InsertLeave', 'BufLeave'}Neovim events that automatically clear ghost text.

Chat Options

OptionTypeDefaultDescription
modelstring'claude-opus-4-6'Claude model used for chat.
positionstring'right'Panel position: 'right', 'left', 'bottom', 'float'.
widthnumber80Panel width in columns (for 'left'/'right' positions).
heightnumber20Panel height in lines (for 'bottom' position).
session_timeoutnumber1800Seconds of inactivity before a chat session expires.

Context Options

OptionTypeDefaultDescription
budgetnumber32768Character budget for assembled context.
prefix_rationumber0.75Proportion of the current-file budget allocated to content before the cursor.
max_file_sizenumber1048576Files larger than this (bytes) are skipped during context assembly.
track_editsbooleantrueWhether to track buffer edits for context.
max_edit_historynumber100Maximum number of edit entries in the rolling window.
resolve_importsbooleantrueWhether to resolve imports/requires for Priority 3 context.
gitignorebooleantrueWhether to respect .gitignore patterns in the repo index.

Highlight Options

OptionTypeDefaultDescription
ghost_textstring'Comment'Highlight group that BonkGhost is linked to.

Override the ghost text appearance in your colorscheme:

lua
vim.api.nvim_set_hl(0, 'BonkGhost', { fg = '#6a6a6a', italic = true })

Released under the MIT License.