Skip to content

Configuration

lex edited this page Jul 23, 2026 · 1 revision

Configuration

Default Setup

require("poste").setup({
  -- Rust CLI binary path (auto-detected if not set)
  poste_binary = "poste",

  -- Default environment name
  default_env = "dev",

  -- Response window split direction
  split_direction = "vertical",  -- "vertical" | "horizontal"

  -- Response window size (columns for vertical, rows for horizontal)
  split_size = 80,

  -- Log file path
  log_file = nil,  -- nil = disabled

  -- Response cache directory (for cross-request variable chaining)
  response_cache_dir = nil,  -- nil = uses default cache dir

  -- Maximum body preview size (bytes) before saving to file
  max_body_preview_size = 1048576,  -- 1MB

  -- Lines to preview before saving large body to file
  body_preview_lines = 20,
})

Example Configurations

Minimal

require("poste").setup()

Horizontal Split

require("poste").setup({
  split_direction = "horizontal",
  split_size = 20,
})

Full Custom

require("poste").setup({
  poste_binary = "/usr/local/bin/poste",
  default_env = "production",
  split_direction = "vertical",
  split_size = 100,
  log_file = "/tmp/poste.log",
  max_body_preview_size = 524288,  -- 512KB
  body_preview_lines = 50,
})

Environment Configuration

Create an env.json file in the same directory or any parent directory of your .http file:

{
  "dev": {
    "base_url": "https://dev.api.example.com",
    "api_key": "dev-key-123"
  },
  "staging": {
    "base_url": "https://staging.api.example.com",
    "api_key": "staging-key-456"
  },
  "production": {
    "base_url": "https://api.example.com",
    "api_key": "prod-key-789"
  }
}

Switch environments with :PosteEnv or <leader>vv. The active environment name appears in the winbar.

Variables from env.json are accessible via {{var_name}} in .http files.

Highlight Overrides

require("poste").setup({
  highlight_overrides = {
    PosteHeader = { fg = "#ff8800" },
    PosteMethod = { fg = "#ff00ff", bold = true },
    PosteVarRef = { fg = "#00ffff" },
    PosteUrl = { fg = "#0088ff", underline = true },
    -- See highlights.lua for all groups
  },
})

Disabling Features

Not all features need to be enabled. You can disable completion sources or import features by not loading the relevant modules. The plugin is designed to be modular — each file in lua/poste/http/ is independently loadable.

Clone this wiki locally