Skip to main content

Configuration Deep Dive

The Lovelace Neovim extension provides extensive configuration options for customizing daemon connection, UI behavior, task submission, keybindings, and logging. This guide covers all available configuration options in detail.

Configuration Overview

All configuration is done through the setup() function:

lua
require("lovelace").setup({
  daemon = { ... },
  ui = { ... },
  tasks = { ... },
  keymaps = { ... },
  log_level = "info",
})

Configuration Philosophy:

  • Sensible defaults - Works out of the box without configuration
  • Progressive customization - Only configure what you need to change
  • Clear documentation - Every option has clear purpose and defaults

Daemon Configuration

Configure how the extension connects to the Localhost daemon.

lua
daemon = {
  -- Socket path for JSON-RPC communication
  socket_path = nil,  -- Auto-discover if nil (default: /tmp/lovelace-localhost.sock)

  -- Auto-start daemon if not running
  auto_start = true,   -- Default: true

  -- Connection retry attempts before failing
  retry_count = 3,     -- Default: 3
}

Socket Path Discovery

When socket_path = nil (default), the extension searches for the socket in this order:

  1. Environment variable: LOVELACE_SOCKET
  2. Common locations:
    • /tmp/lovelace-localhost.sock (macOS/Linux default)
    • ~/.lovelace/localhost.sock (user-specific)
    • /var/run/lovelace/localhost.sock (system-wide)

Override socket path:

lua
daemon = {
  socket_path = "/custom/path/to/socket.sock"
}

Auto-Start Behavior

When auto_start = true and the daemon is not running:

  1. Attempts to start daemon: Runs localhost-ctl start
  2. Waits for startup: 2-second grace period
  3. Retries connection: Uses configured retry count
  4. Shows error if failed: Notification with instructions

Disable auto-start:

lua
daemon = {
  auto_start = false  -- Manual daemon management
}

Use when:

  • You manage the daemon lifecycle separately
  • Running in environments where auto-start is not allowed
  • Debugging daemon connection issues

Retry Strategy

The extension uses exponential backoff for connection retries:

AttemptDelayTotal Time
1Immediate0s
21 second1s
32 seconds3s
4+3 seconds3s + (n-3)*3s

Adjust retry count:

lua
daemon = {
  retry_count = 5  -- More attempts for slow networks
}

UI Configuration

Customize how task results and progress are displayed.

lua
ui = {
  -- How to display task results
  result_window = "split",  -- "split", "vsplit", "float", "tab"

  -- Progress notification style
  progress_style = "notify",  -- "notify", "statusline", "both"

  -- Float window dimensions (0.0-1.0 = percentage of screen)
  float_width = 0.8,   -- 80% of screen width
  float_height = 0.8,  -- 80% of screen height

  -- Window border style
  float_border = "rounded",  -- "none", "single", "double", "rounded", "solid", "shadow"
}

Result Window Types

TypeBehaviorUse When
splitHorizontal split below current windowDefault workflow
vsplitVertical split to the rightWide screens, side-by-side
floatCentered floating windowFocus on results, no clutter
tabNew tab pageSeparate workspace for results

Example configurations:

lua
-- Floating windows for cleaner UI
ui = {
  result_window = "float",
  float_width = 0.9,
  float_height = 0.85,
  float_border = "double"
}

-- Vertical split for side-by-side comparison
ui = {
  result_window = "vsplit"
}

-- New tab for complete isolation
ui = {
  result_window = "tab"
}

Progress Notification Styles

StyleBehaviorUse When
notifyShow vim.notify() messagesDefault, works everywhere
statuslineUpdate statusline indicatorCustom statusline (lualine, etc.)
bothNotifications + statuslineMaximum visibility

Statusline Integration:

If using statusline or both, add to your statusline config:

lua
-- lualine example
require("lualine").setup({
  sections = {
    lualine_x = {
      function()
        return require("lovelace").get_status()
      end
    }
  }
})

Float Window Dimensions

Control floating window size with decimal values between 0.0 and 1.0:

  • 0.8 = 80% of screen width/height
  • 0.5 = 50% (half screen)
  • 1.0 = 100% (full screen)

Small screens:

lua
ui = {
  float_width = 0.95,   -- 95% width
  float_height = 0.90,  -- 90% height
}

Large screens:

lua
ui = {
  float_width = 0.6,    -- 60% width (more compact)
  float_height = 0.7,   -- 70% height
}

Border Styles

Visual examples of border styles:

"none"     No border
"single"   ┌─────┐
"double"   ╔═════╗
"rounded"  ╭─────╮
"solid"    ████████
"shadow"   ┌─────┐ (with drop shadow)

Task Configuration

Configure task submission behavior and context collection.

lua
tasks = {
  -- Automatically collect file/selection context
  auto_collect_context = true,  -- Default: true

  -- Default workspace (nil = use current workspace)
  default_workspace = nil,
}

Auto-Collect Context

Controls what context is included when submitting tasks.

When auto_collect_context = true (default):

  • Current file path included
  • Selection range included (if visual mode)
  • Buffer content included
  • Working directory included

When auto_collect_context = false:

  • Only task description sent
  • No file or selection context
  • Useful for general questions or planning

Example use cases:

lua
-- Disable for architecture planning
tasks = {
  auto_collect_context = false
}

-- Enable for code-specific tasks (default)
tasks = {
  auto_collect_context = true
}

Default Workspace

Override automatic workspace detection:

lua
tasks = {
  default_workspace = "ws_abc123def456"  -- Force specific workspace
}

Use when:

  • Working on multiple related projects
  • Daemon workspace detection is incorrect
  • Consolidating tasks across directories

Workspace ID discovery:

vim
:LovelaceSession
" Output shows workspace ID

Keybindings Configuration

Customize default keybindings or disable them entirely.

lua
keymaps = {
  -- Enable default keybindings
  enabled = true,  -- Default: true

  -- Key prefix for all commands
  prefix = "<leader>l",  -- Default: "<leader>l"
}

Default Keybindings

When enabled = true, these keybindings are automatically created:

KeybindingCommandModeDescription
<prefix>t:LovelaceTaskVisualSubmit task (selection)
<prefix>T:LovelaceTasksNormalList all tasks
<prefix>a:LovelaceAgentsNormalShow agent workers
<prefix>h:LovelaceHealthNormalRun health check

Custom Prefix Examples

Use <leader>a instead of <leader>l:

lua
keymaps = {
  prefix = "<leader>a"
}

Use <C-l> (Ctrl+L):

lua
keymaps = {
  prefix = "<C-l>"
}

Use function keys:

lua
keymaps = {
  prefix = "<F5>"
}
-- Results in <F5>t, <F5>T, <F5>a, <F5>h

Custom Keybindings

Disable defaults and define your own:

lua
require("lovelace").setup({
  keymaps = { enabled = false }
})

-- Define custom keybindings
vim.keymap.set("v", "<F5>", "<cmd>LovelaceTask<cr>", { desc = "Submit task" })
vim.keymap.set("n", "<F6>", "<cmd>LovelaceTasks<cr>", { desc = "List tasks" })
vim.keymap.set("n", "<F7>", "<cmd>LovelaceAgents<cr>", { desc = "Show agents" })
vim.keymap.set("n", "<F8>", "<cmd>LovelaceHealth<cr>", { desc = "Health check" })

Logging Configuration

Control verbosity of extension logging.

lua
log_level = "info"  -- "debug", "info", "warn", "error"

Log Levels

LevelMessages ShownUse When
debugAll messages (very verbose)Debugging issues
infoGeneral information (default)Normal usage
warnWarnings and errorsReduce noise
errorOnly errorsMinimize logging

Viewing Logs

vim
:messages

Clearing Logs

vim
:messages clear

Debug Logging Example

Enable debug logging to troubleshoot connection issues:

lua
require("lovelace").setup({
  log_level = "debug"
})

Then check logs:

vim
:messages
" Shows detailed connection attempts, JSON-RPC messages, etc.

Complete Configuration Examples

Minimal Configuration (Defaults)

lua
require("lovelace").setup({})

Everything works with sensible defaults - no configuration needed!

Power User Configuration

lua
require("lovelace").setup({
  daemon = {
    socket_path = "/custom/path/to/socket.sock",
    auto_start = false,  -- Manual daemon management
    retry_count = 5,     -- More retry attempts
  },

  ui = {
    result_window = "float",  -- Use floating windows
    progress_style = "both",   -- Notifications + statusline
    float_width = 0.9,         -- 90% width
    float_height = 0.85,       -- 85% height
    float_border = "double",   -- Double-line border
  },

  tasks = {
    auto_collect_context = true,
    default_workspace = "my-workspace-id",
  },

  keymaps = {
    enabled = true,
    prefix = "<leader>a",  -- Use <leader>a instead of <leader>l
  },

  log_level = "debug",  -- Verbose logging for troubleshooting
})

Lightweight Configuration

Minimal UI, manual controls:

lua
require("lovelace").setup({
  daemon = {
    auto_start = false  -- I'll start the daemon manually
  },

  ui = {
    result_window = "split",    -- Simple horizontal split
    progress_style = "notify",  -- Just notifications
  },

  tasks = {
    auto_collect_context = true
  },

  keymaps = {
    enabled = false  -- Define my own keybindings
  },

  log_level = "warn"  -- Only show warnings and errors
})

-- Custom minimal keybindings
vim.keymap.set("v", "<leader>t", "<cmd>LovelaceTask<cr>")
vim.keymap.set("n", "<leader>T", "<cmd>LovelaceTasks<cr>")

Floating-First Configuration

Optimized for floating windows and minimal distraction:

lua
require("lovelace").setup({
  ui = {
    result_window = "float",
    float_width = 0.85,
    float_height = 0.80,
    float_border = "rounded",
    progress_style = "notify"
  },

  keymaps = {
    prefix = "<C-l>"  -- Use Ctrl+L prefix
  }
})

Configuration by Use Case

Use Case: Remote Development

Working over SSH with limited terminal width:

lua
require("lovelace").setup({
  ui = {
    result_window = "tab",  -- Separate tab for results
    progress_style = "statusline"  -- Don't flood with notifications
  },

  daemon = {
    retry_count = 10  -- Network may be slow/unstable
  }
})

Use Case: Pair Programming

Large screen, side-by-side workflow:

lua
require("lovelace").setup({
  ui = {
    result_window = "vsplit",  -- Vertical split for side-by-side
    progress_style = "both"     -- Show everything
  },

  keymaps = {
    prefix = "<F5>"  -- Easy to remember and explain
  }
})

Use Case: Production Debugging

Verbose logging, controlled task submission:

lua
require("lovelace").setup({
  tasks = {
    auto_collect_context = false  -- Explicit context only
  },

  log_level = "debug",  -- Full logging

  ui = {
    result_window = "float",
    progress_style = "both"
  }
})

Troubleshooting Configuration Issues

Configuration Not Applied

Symptom: Changes to setup() don't seem to take effect

Solutions:

  1. Reload Neovim:

    vim
    :qa
    nvim
    
  2. Check for syntax errors:

    lua
    -- Run manually to see errors
    :lua require("lovelace").setup({ ... })
    
  3. Verify setup() is called:

    lua
    -- In your init.lua or lazy.nvim config
    require("lovelace").setup({
      -- Your config here
    })
    

Keybindings Not Working

Symptom: <leader>lt doesn't submit tasks

Solutions:

  1. Check leader key:

    vim
    :echo mapleader
    " Should show your leader key (usually "\")
    
  2. Verify keymaps enabled:

    lua
    require("lovelace").setup({
      keymaps = { enabled = true }  -- Must be true
    })
    
  3. Check for conflicts:

    vim
    :verbose map <leader>l
    " Shows what's mapped to this key
    

Float Window Issues

Symptom: Float windows are too small or too large

Solutions:

  1. Adjust dimensions:

    lua
    ui = {
      float_width = 0.9,   -- Try different values
      float_height = 0.85
    }
    
  2. Check terminal size:

    vim
    :echo &columns
    :echo &lines
    " Ensure terminal is large enough
    

Next Steps

Related Documentation