Skip to main content
This configuration uses blink.cmp for fast, intelligent code completion with LSP integration, snippet support, and specialized sources.

Overview

Blink.cmp is configured in lua/plugins/completions.lua with:
  • Super-tab keybindings for intuitive navigation
  • Ghost text for inline suggestions
  • Auto-brackets for functions and methods
  • Database completion integration
  • LazyDev integration for Neovim Lua API completions

Key features

Super-tab preset

Tab and Shift-Tab for navigation with smart fallback

Ghost text

Inline completion previews as you type

Auto-brackets

Automatic bracket insertion for functions

LSP integration

Completions from all attached LSP servers

Keybindings

KeyActionDescription
<Tab>Next itemMove to next completion (super-tab)
<S-Tab>Previous itemMove to previous completion
<C-j>Next itemAlternative: move to next
<C-k>Previous itemAlternative: move to previous
<CR>AcceptAccept selected completion
The super-tab preset intelligently handles Tab for both completion navigation and snippet jumping.

Configuration

Keymap setup

lua/plugins/completions.lua
keymap = {
  preset = "super-tab",
  ["<C-j>"] = { "select_next" },
  ["<C-k>"] = { "select_prev" },
}

Completion menu

The completion menu uses a rounded border with custom column layout:
lua/plugins/completions.lua
completion = {
  menu = {
    auto_show = true,
    border = "rounded",
    scrollbar = false,
    scrolloff = 1,
    draw = {
      padding = 1,
      gap = 1,
      columns = {
        { "kind_icon" },
        { "label", "label_description", gap = 1 },
        { "kind" },
        { "source_name" },
      },
    },
  },
}

Ghost text

Ghost text shows completion previews inline:
lua/plugins/completions.lua
ghost_text = {
  enabled = true,
  show_with_menu = false,
  show_without_selection = false, -- only show when item is selected
}
Ghost text only appears when you have a completion item selected, preventing visual clutter.

Documentation window

Automatic documentation with syntax highlighting:
lua/plugins/completions.lua
documentation = {
  auto_show = true,
  auto_show_delay_ms = 200,
  treesitter_highlighting = true,
  window = {
    border = "rounded",
    scrollbar = true,
    winhighlight = "Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,EndOfBuffer:BlinkCmpDoc",
  },
}

Completion sources

Multiple sources provide completions from different contexts:

Default sources

lua/plugins/completions.lua
sources = {
  default = { "lazydev", "lsp", "path", "snippets", "buffer" },
}
1

LazyDev

Provides completions for Neovim Lua API (vim.*, require(), etc.) with higher priority (score_offset = 100)
2

LSP

Completions from all attached LSP servers with support for markdown_oxide keyword patterns
3

Path

File path completions for require statements and file paths
4

Snippets

Custom snippets from ~/.config/nvim/after/snippets
5

Buffer

Words from the current buffer and other open buffers

Database completions

Special configuration for SQL files:
lua/plugins/completions.lua
per_filetype = {
  sql = { "dadbod", "snippets", "buffer" },
  mysql = { "dadbod", "snippets", "buffer" },
  plpgsql = { "dadbod", "snippets", "buffer" },
}
When editing SQL files, completions come from vim-dadbod for table/column names from your connected databases.

Provider configuration

lua/plugins/completions.lua
providers = {
  lazydev = { 
    name = "LazyDev", 
    module = "lazydev.integrations.blink", 
    score_offset = 100 
  },
  dadbod = { 
    name = "Dadbod", 
    module = "vim_dadbod_completion.blink" 
  },
  snippets = {
    opts = {
      search_paths = { vim.fn.stdpath("config") .. "/after/snippets" },
    },
  },
  lsp = {
    name = "LSP",
    module = "blink.cmp.sources.lsp",
    opts = {
      markdown_oxide = {
        keyword_pattern = [[\(\k\| \|\/\|#\)\+]],
      },
    },
  },
}

Function signatures

Signature help appears automatically when typing function arguments:
lua/plugins/completions.lua
signature = {
  enabled = true,
  window = {
    show_documentation = true,
    border = "rounded",
  },
}

Auto-brackets

Functions and methods automatically insert brackets:
lua/plugins/completions.lua
accept = {
  auto_brackets = {
    enabled = true,
  },
}
When you accept a function completion, brackets are added automatically:
  • printprint(|) (cursor inside brackets)
  • requirerequire("|")

Command-line completion

Command-line completion is disabled in favor of mini.cmdline:
lua/plugins/completions.lua
cmdline = {
  enabled = false, -- mini.cmdline has better options, with previews
}
See the mini.nvim configuration for command-line completion with live previews.

Performance

Blink.cmp uses Rust-based fuzzy matching for speed:
lua/plugins/completions.lua
fuzzy = { implementation = "prefer_rust_with_warning" }

Dependencies

lua/plugins/completions.lua
dependencies = {
  "folke/lazydev.nvim",
  "nvim-mini/mini.nvim",
}

LazyDev

Provides Neovim Lua API completions for plugin development

Mini.nvim

Provides icons and additional utilities

Troubleshooting

  1. Check LSP is attached: :LspInfo
  2. Verify sources are loaded: Check for errors in :messages
  3. Try triggering manually with <C-Space> if configured
Ghost text only appears when:
  • A completion item is selected
  • The menu is not open (or show_with_menu = true)
This is intentional to reduce visual clutter.
  1. Ensure vim-dadbod and vim-dadbod-completion are installed
  2. Connect to a database using :DBUI
  3. Verify the buffer filetype is set to sql, mysql, or plpgsql

Editing helpers

Autopairs and snippet navigation

LSP configuration

LSP server setup and configuration