Skip to content

Advanced Configuration

GrayKwon edited this page Sep 14, 2025 · 2 revisions

Advanced Configuration

This page covers detailed configuration options for endpoint.nvim.

Picker Configuration

Tip

Configure your preferred picker interface with custom options for the best experience.

Telescope Picker

require("endpoint").setup({
  picker = {
    type = "telescope",
    options = {
      telescope = {
        theme = "dropdown",
        previewer = false,
        layout_config = { 
          width = 0.8,
          height = 0.6 
        },
        sorting_strategy = "ascending",
        layout_strategy = "center",
      }
    }
  }
})

Features:

  • Rich fuzzy search interface
  • File preview with syntax highlighting
  • Full Telescope keybinding support
  • Customizable themes and layouts

Snacks Picker

require("endpoint").setup({
  picker = {
    type = "snacks",
    options = {
      snacks = {
        prompt = "Find Endpoints ",
        matcher = { fuzzy = true, smartcase = true },
        preview = "file", -- "file", "none"
        layout = { width = 0.8, height = 0.6 }
      }
    }
  }
})

Features:

  • Modern picker interface
  • File preview with precise line highlighting
  • Fuzzy matching with file position patterns
  • Clean, fast interface

vim.ui.select

require("endpoint").setup({
  picker = {
    type = "vim_ui_select",
    options = {
      vim_ui_select = {
        prompt = "Choose endpoint: ",
        kind = "endpoint", -- Useful for dressing.nvim theming
        format_item = function(item)
          return item.display_value
        end
      }
    }
  }
})

Features:

  • Native Neovim interface
  • Works without external dependencies
  • Integrates with vim.ui.select overrides (like dressing.nvim)
  • Lightweight and simple

UI Customization

Note

Customize the appearance of endpoints with icons, colors, and display options.

Display Options

ui = {
  show_icons = true,     -- Show method icons
  show_method = true,    -- Show method text
  
  -- Option 1: Icons only
  show_icons = true,
  show_method = false,
  -- Result: πŸ“₯ /api/users
  
  -- Option 2: Method text only
  show_icons = false,
  show_method = true,
  -- Result: GET /api/users
  
  -- Option 3: Both icons and method text
  show_icons = true,
  show_method = true,
  -- Result: πŸ“₯ GET /api/users
  
  -- Option 4: Minimal (path only)
  show_icons = false,
  show_method = false,
  -- Result: /api/users
}

Custom Icons and Colors

Tip

Define custom icons and colors for each HTTP method to match your preferred style.

ui = {
  methods = {
    GET = { 
      icon = "πŸ”", 
      color = "TelescopeResultsNumber" 
    },
    POST = { 
      icon = "✨", 
      color = "TelescopeResultsConstant" 
    },
    PUT = { 
      icon = "πŸ”„", 
      color = "TelescopeResultsKeyword" 
    },
    DELETE = { 
      icon = "❌", 
      color = "TelescopeResultsSpecialChar" 
    },
    PATCH = { 
      icon = "πŸ› οΈ", 
      color = "TelescopeResultsFunction" 
    },
    ROUTE = { 
      icon = "πŸ”—", 
      color = "TelescopeResultsIdentifier" 
    }, -- React Router
  },
}

Framework-Specific Configuration

Rails Configuration

frameworks = {
  rails = {
    display_format = "smart", -- "action_only", "controller_action", "smart"
    show_action_annotation = true, -- Show [controller#action] annotations
  },
}

Display Format Options:

  • "action_only": Show only action name
    β†’ GET[#index] /users

  • "controller_action": Show controller#action
    β†’ GET[users#index] /users

  • "smart": Smart formatting
    β†’ Root routes: GET[home#index] /
    β†’ Regular: GET[users#index] /users

Action Annotation Control:

  • show_action_annotation = true: Show annotations (default)
    β†’ GET[users#index] /users

  • show_action_annotation = false: Hide annotations
    β†’ GET /users

Complete Configuration Example

require("endpoint").setup({
  -- Cache configuration
  cache = {
    mode = "session", -- "none", "session", "persistent"
  },
  
  -- Picker configuration
  picker = {
    type = "telescope", -- "telescope", "vim_ui_select", "snacks"
    options = {
      telescope = {
        theme = "dropdown",
        previewer = true,
        layout_config = { width = 0.9, height = 0.7 }
      },
      snacks = {
        preview = "file",
        layout = { width = 0.8, height = 0.6 }
      },
    },
  },
  
  -- UI customization
  ui = {
    show_icons = true,
    show_method = true,
    methods = {
      GET = { icon = "πŸ“₯", color = "TelescopeResultsNumber" },
      POST = { icon = "πŸ“€", color = "TelescopeResultsConstant" },
      PUT = { icon = "✏️", color = "TelescopeResultsKeyword" },
      DELETE = { icon = "πŸ—‘οΈ", color = "TelescopeResultsSpecialChar" },
      PATCH = { icon = "πŸ”§", color = "TelescopeResultsFunction" },
      ROUTE = { icon = "πŸ”—", color = "TelescopeResultsIdentifier" },
    },
  },
  
  -- Framework-specific settings
  frameworks = {
    rails = {
      display_format = "smart",
      show_action_annotation = true,
    },
  },
})

Clone this wiki locally