A modern and feature-rich Neovim configuration built with lazy.nvim package manager.
Issue: After using blink.cmp completion engine, auto-brackets are not added when completing Python code.
Cause: blink.cmp is a newer completion engine that doesn't have official nvim-autopairs integration support like nvim-cmp. blink.cmp lacks the event:on('confirm_done') event system, and the nvim-autopairs.completion.cmp module depends on the nvim-cmp plugin.
Solution: This configuration uses a combination approach where the two plugins work together. Use the complete auto_brackets configuration to ensure it works across all file types:
-- Configuration in lua/plugins/cmp.lua
{
"saghen/blink.cmp",
opts = {
completion = {
accept = {
auto_brackets = {
enabled = true,
default_brackets = { "(", ")" },
override_brackets_for_filetypes = {},
-- Use kind field to determine bracket insertion
kind_resolution = {
enabled = true,
blocked_filetypes = {}, -- Clear blocklist to support all languages
},
-- Use semantic tokens for async resolution (more accurate)
semantic_token_resolution = {
enabled = true,
blocked_filetypes = {}, -- Clear blocklist
timeout_ms = 400,
},
},
},
},
-- ... other options
},
}How it works:
- blink.cmp built-in auto_brackets: Automatically adds
()when selecting functions or methods from completion menukind_resolution: Immediately determines based on completion item'skindfieldsemantic_token_resolution: Asynchronously uses LSP semantic tokens for more accurate determination (400ms timeout)- Clear
blocked_filetypesto ensure it works in all languages (including Python, TS, Vue, etc.)
- nvim-autopairs: Handles all other bracket pairing scenarios
- Auto-completes
)when manually typing( - Formats to multiline when pressing
<CR>at{|}position - Auto-deletes closing bracket when deleting opening bracket
- Auto-completes
Test scenarios:
# 1. Auto-brackets after completion
# Type pri, select print → print(|)
# 2. Manual bracket pairing
# Type ( → (|)
# 3. Format on enter between brackets
# Press <CR> at {|} →
# {
# |
# }Note:
- Currently nvim-autopairs hasn't added native support for blink.cmp (GitHub Issue #477 still open)
- The combination approach used in this configuration is the most stable solution available
- If bracket completion stops working after plugin updates, check if you need to clear the
blocked_filetypeslist (by default blockstypescriptreact,javascriptreact,vue, etc.)
- Package Manager: lazy.nvim (Auto-check for updates)
- Theme: nord.nvim (Nord theme)
- Leader Key: Space (LocalLeader:
\) - Transparency: Enabled
- Completion Engine: blink.cmp (Modern completion system with GitHub Copilot integration)
- Test Runner: neotest (Python / Go / Vitest, with DAP integration)
- Git Workflow: gitsigns.nvim (hunk preview, stage/reset, blame, diff)
- Search & Files: fzf-lua + neo-tree (native fzf search + file tree)
- AI Assistant: GitHub Copilot (currently kept as an optional completion source)
- nord.nvim - Nord theme with italic comments and bold lualine support
- lualine.nvim - Status line using nord theme with Copilot status integration
- nvim-colorizer.lua - Color highlighter, custom version (Starslayerx/nvim-colorizer.lua)
- nvim-web-devicons - File icons
- mini.nvim - Icon support
- window-picker.nvim - Window selector (version 2.*)
- which-key.nvim - Keybinding hints, use
<leader>?for local mappings
- blink.cmp - Modern completion engine (version 1.*) with default preset keybindings and Copilot integration, built-in auto_brackets feature for function/method completion
- blink-copilot - Copilot integration for Blink.cmp
- copilot.lua - GitHub Copilot support (lazy-loaded, use
:Copilotcommand to start) - copilot-lualine - Copilot status display in Lualine
- nvim-autopairs - Auto bracket completion, works in combination with blink.cmp to handle manual bracket input, enter formatting, and other scenarios, disabled in macros and replace mode
- nvim-lspconfig - LSP configuration using new API (vim.lsp.config/enable), supporting pyright (type checking disabled) and lua_ls
- mason.nvim - LSP server management with custom icons
- mason-lspconfig.nvim - Auto-install LSP (clangd, pyright, gopls, eslint, ts_ls, lua_ls, rust_analyzer, marksman, html, cssls, jsonls, yamlls, bashls, dockerls, taplo, emmet_language_server, jinja_lsp)
- trouble.nvim - Diagnostic interface with multiple view modes
- tiny-inline-diagnostic.nvim - Inline diagnostics with ghost preset and multiline support
- lspsaga.nvim - LSP UI enhancement with rounded borders, lightbulb disabled
- noice.nvim - Enhanced messages and cmdline with multiple presets
- friendly-snippets - Code snippets support
- nvim-treesitter - Advanced syntax highlighting (main branch) with built-in progressive selection and folding support
- rainbow-delimiters.nvim - Rainbow parentheses using Nord and Catppuccin Frappé colors
- vim-illuminate - Current word/reference highlighting with LSP, Treesitter, and regex providers plus reference navigation
- Built-in treesitter selection - Progressive code selection using
<CR>/<BS>/<TAB> - wildfire.nvim - Quick bracket content selection (custom version)
- nvim-surround - Quick operations: surround selections with delimiters
- gitsigns.nvim - Inline Git hunk signs with preview, stage/reset, blame, diff, and quickfix support
- neotest - Unified test runner
- neotest-python - Python / pytest adapter
- neotest-go - Go adapter
- neotest-vitest - Vitest adapter
- fzf-lua - Native fuzzy finder powered by system
fzf, used as the primary search layer for files, buffers, command history, live grep, and recent files - neo-tree.nvim - Current file explorer implementation, opened with
<leader>e
- conform.nvim - Code formatter with auto-format on save
- vim-python-pep8-indent - Python PEP8 indentation
S- Save fileQ- QuitY- Select all and copy to system clipboard<leader><CR>- Clear search highlightK/J- Move 5 lines up/down quickly</>/- Indent/Unindent
tn- New tabtN- Split current buffer in new tabth/tl- Previous/Next tabtmh/tml- Move tab left/right
<C-w>t- Open terminal (horizontal split)<C-w>T- Open terminal (vertical split)<Esc>- Exit to normal mode in terminal
<C-w>h- Switch to left window<C-w>j- Switch to bottom window<C-w>k- Switch to top window<C-w>l- Switch to right window<C-w>w- Cycle to next window<C-w>p- Switch to previous window
<C-w>=- Equalize all window sizes<C-w>_- Maximize current window height<C-w>|- Maximize current window width<C-w>+- Increase current window height<C-w>-- Decrease current window height<C-w>>- Increase current window width<C-w><- Decrease current window width
<C-w>H/J/K/L- Move current window to far left/bottom/top/right<C-w>r- Rotate windows clockwise<C-w>R- Rotate windows counter-clockwise<C-w>x- Exchange window with next one<C-w>o- Close all other windows (only)<C-w>q- Quit current window<C-w>c- Close current window
<leader>gj- Next hunk<leader>gk- Previous hunk<leader>gs- Stage current hunk<leader>gr- Reset current hunk<leader>gS- Stage current buffer<leader>gR- Reset current buffer<leader>gp- Preview current hunk<leader>gi- Preview current hunk inline<leader>gb- Show line blame<leader>gd- Diff against index<leader>gD- Diff against~<leader>gq- Send hunks to quickfix<leader>gl- Toggle current line blame<leader>gw- Toggle word diffih- Hunk text object
<leader>tn- Run nearest test<leader>tf- Run current file<leader>ta- Run current project<leader>td- Debug nearest test with DAP<leader>tm- Debug current test method (Python only)<leader>tc- Debug current test class (Python only)<leader>ts- Toggle neotest summary<leader>to- Open latest test output<leader>tO- Toggle output panel<leader>tw- Watch current file<leader>tS- Stop current test run
normal mode:
<C-f>- forward Page down one full screen<C-b>- backward Page up one full screen<C-d>- down half Page down half screen<C-u>- up half Page up half screen
insert mode:
<C-j>- forward Page down one full screen<C-k>- backward Page up one full screen
<C-f>- Move to end of line<C-l>- Move one character to the right<C-b>- Move to beginning of line
<CR>- Initialize/Expand selection (normal and visual modes)<BS>- Shrink selection (visual mode)<TAB>- Scope incremental selection (visual mode)
ys{motion}{char}- Add surrounding to specified rangeysiw"- Add double quotes around current wordysa")- Add parentheses around quotes contentyst;}- Add braces from cursor to semicolon
yss{char}- Add surrounding to entire line (ignoring leading/trailing whitespace)yS{motion}{char}- Add surrounding on new linesySS{char}- Add surrounding to entire line on new lines<C-g>s{char}- Insert mode: add surrounding at cursor<C-g>S{char}- Insert mode: add surrounding at cursor on new linesS{char}- Visual mode: add surrounding to selectiongS{char}- Visual mode: add surrounding to selection on new lines
ds{char}- Delete specified surroundingds"- Delete double quotesds)- Delete parenthesesdst- Delete HTML tag
cs{old}{new}- Change surroundingcs"'- Change double quotes to single quotescs)}- Change parentheses to bracescst<div>- Change HTML tag to div tag
cS{old}{new}- Change surrounding on new lines
- Parentheses/Brackets/Braces/Angle brackets:
- Use closing char (
),],},>) - tight:{text} - Use opening char (
(,[,{,<) - add space:{ text }
- Use closing char (
- HTML tags (
t/T):ysiwt- Add tag (prompts for tag name and attributes)dst- Delete tagcst- Change only tag type (preserves attributes)csT- Change entire tag (including attributes)
- Function calls (
f):ysiwf- Add function call (prompts for function name)dsf- Delete function call, keep argumentscsf- Change function name
- Custom surroundings (
i):yssi- Custom left/right surroundings (prompts for each side)
b→)(parentheses)B→}(braces)r→](brackets)a→>(angle brackets)q→",',`(any quote)s→},],),>,",',`(any surrounding)
Old text Command New text
-------- ------- --------
local str = H*ello ysiw" local str = "Hello"
require"nvim-surroun*d" ysa") require("nvim-surround")
*sample_text ysiw} {sample_text}
*sample_text ysiw{ { sample_text }
local x = ({ *32 }) ds) local x = { 32 }
'*some string' cs'" "some string"
"Nested '*quotes'" dsq "Nested quotes"
div cont*ents ysstdiv <div>div contents</div>
<div>d*iv contents</div> dst div contents
arg*s ysiwffunc func(args)
f*unc_name(a, b, x) dsf a, b, x
<C-y>- Accept completion<C-Space>- Open menu or toggle documentation<C-n>/<C-p>orUp/Down- Select next/previous item<C-e>- Hide menu<C-k>- Toggle signature help
<leader><space>- Global picker (files / buffers / LSP symbols)<leader>bb- Buffer list<leader>/- Live grep<leader>:- Command history<leader>ff- Find files<leader>fg- Find git files<leader>fb- Find buffers<leader>fc- Find configuration files<leader>fr- Recent files<leader>fs- Current file symbols, preferring LSP document symbols with Treesitter/ctags fallback<leader>fS- Project symbols, preferring LSP workspace symbols with ctags fallback<leader>ft- Current file Treesitter symbols<leader>fT- Project tags<leader>fR- Resume the last fzf-lua picker
<leader>e- File explorer
<CR>/l- Open file or expand directoryh- Close directoryo- Open in new tabs- Open in vertical splitS- Open in horizontal splitP- Toggle floating previewH- Toggle hidden and gitignored files
<leader>F- Format code<leader>bn- Next buffer<leader>bp- Previous buffer<leader>bd- Delete buffer<leader>cR- Rename file
]r- Jump to next reference[r- Jump to previous reference<leader>ch- Toggle reference highlighting for the current buffer
gh- View documentation (auto-focus to floating window, scrollable)gd- Go to definition (open in vertical split)gp- Peek definition (floating window, no jump, presst/s/vto open in new tab/split)gr- Find all references and implementations (floating window list)
<leader>rn- Rename variable/function<leader>ca- Code actions<leader>o- Toggle file outline (show all symbols)
[d- Jump to previous diagnostic]d- Jump to next diagnostic
<leader>xx- Toggle diagnostics panel<leader>xX- Buffer diagnostics<leader>cs- Symbols list<leader>cl- LSP information<leader>xL- Location list<leader>xQ- Quickfix list
- Line numbers + relative numbers
- Cursor line highlight
- 100-column marker
- Auto wrap
- Sign column always visible
- Scroll offset: 8 lines
- Tab width: 4 spaces
- Smart indent: Disabled (nosmartindent)
- C indent: Disabled (nocindent)
- Fold method: Treesitter expr (level 99, not folded by default)
- Auto indent: Enabled
- Show invisible characters: Enabled (tabs as two spaces, trailing spaces as ▫)
- Auto comments: Disabled
- Undo files: Enabled (persistent)
- Cursor position memory: Enabled
- Case sensitive (ignorecase = false)
- Smart case: Disabled (smartcase = false)
- Live search preview (inccommand = "split")
- Search highlight: Enabled
- Vertical split: Opens to the right
- Horizontal split: Opens below
- Backup and swap files disabled
- Hidden buffers enabled
- Update time: 300ms
- Timeout: 50ms
- Regex engine: Modern engine (re=0)
- Backup directory: ~/.config/nvim/tmp/backup
- Undo directory: ~/.config/nvim/tmp/undo
- Disable lazyredraw to prevent UI plugin issues
- Complete options: longest, noinsert, menuone, noselect, preview
- Virtual edit: Block mode enabled
- GitHub Copilot: Integrated into blink.cmp for smart completion
- Main window background transparent (Normal, NormalFloat)
- Sign column transparent (SignColumn)
- Non-current windows transparent (NormalNC)
- Message area transparent (MsgArea)
- Telescope interface transparent (TelescopeNormal, TelescopeBorder, TelescopePromptBorder)
- Search Workflow: Uses fzf-lua as the primary search interface together with neo-tree for file browsing
- Modern LSP: Complete language server support with auto-installation and UI enhancement
- Code Formatting: Auto-formatting for multiple languages (triggers on save)
- Transparent Interface: Window transparency effects automatically applied to color themes
- Smart Completion: Modern completion system based on blink.cmp with LSP, path, snippets, buffer, and GitHub Copilot support
- Auto Bracket Completion: blink.cmp built-in auto_brackets handles function/method completion brackets, nvim-autopairs handles manual bracket pairing, enter formatting, etc., disabled in specific filetypes, macros, and replace mode
- Rainbow Parentheses: Colorful parentheses highlighting using Nord and Catppuccin Frappé color schemes
- Quick Content Selection: Use
<CR>/<BS>/<TAB>for progressive code selection with scope detection - Surrounding Operations: Use nvim-surround for quick surrounding operations
- Support for adding, deleting, changing brackets, quotes, HTML tags
- Smart space handling (different behavior for opening/closing characters)
- Built-in alias shortcuts (e.g.,
b→),q→any quote) - Support for function calls and custom surroundings
- Full support across visual, insert, and normal modes
- Inline Diagnostics: Show diagnostic information within code lines using ghost preset style with multiline support
- Window Selector: Quickly switch and manage windows (version 2.*)
- Keybinding Hints: Real-time display of available keybindings, use
<leader>?for local mappings - Reference Highlighting: Uses vim-illuminate to highlight other references of the current word and jump between them
- Enhanced File Explorer: Uses neo-tree for file browsing, split/tab opening, preview, and hidden file toggling
- Auto LSP Installation: Mason automatically installs and configures multiple language servers
- Cursor Position Memory: Restores last cursor position when reopening files
- Treesitter Folding: Intelligent code folding based on syntax tree
- GitHub Copilot: AI code completion and suggestions (lazy-loaded)
~/.config/nvim/
├── init.lua # Main configuration file
├── lua/
│ ├── config/
│ │ ├── lazy.lua # Package manager setup
│ │ ├── keymaps.lua # Key mappings
│ │ ├── options.lua # General settings
│ │ └── transparency.lua # Transparency settings
│ └── plugins/
│ ├── cmp.lua # Completion plugins
│ ├── lsp.lua # LSP plugins
│ ├── snacks.lua # fzf-lua and neo-tree config
│ ├── tools.lua # Utility plugins
│ └── ui.lua # UI plugins
└── README.md # Chinese documentation
└── README-en.md # This file
-
Environment Setup:
- Ensure you have Neovim 0.10+ installed
- Perl and Ruby providers are automatically disabled (configured in init.lua)
-
Installation:
- Clone this configuration to
~/.config/nvim/ - On first launch, lazy.nvim will automatically install all plugins
- Clone this configuration to
-
Initialization:
- Mason will automatically install configured LSP servers
- Treesitter will automatically install syntax parsers
- Transparency effects will be automatically applied after color theme loading
-
Usage Guide:
- Use
<leader>?to see available keybindings - Use
<leader>eto open file explorer - Use
<leader><space>for smart file finding
- Use
- Auto Completion: Code completion triggers automatically, including LSP, snippets, path, and buffer completion. Copilot requires manual start using
:Copilotcommand - Auto Formatting: Code auto-formats on file save (supports Python, JS/TS, Lua, Shell)
- Auto Diagnostics: LSP diagnostics display in real-time with multiline inline support
- File Type Detection: Automatically enables corresponding syntax highlighting and LSP
- Auto Folding: Intelligent code folding based on Treesitter
- Auto Terminal Start: Automatically enters insert mode on TermOpen
lua/config/options.lua- General settings (display, editing, search, etc.)lua/config/keymaps.lua- Key mappingslua/config/transparency.lua- Transparency effects settingslua/config/lazy.lua- Package manager initialization (Leader key setup)
lua/plugins/ui.lua- UI-related plugins (theme, status bar, icons, Treesitter, rainbow brackets, etc.)lua/plugins/cmp.lua- Completion system configuration (blink.cmp, Copilot, auto-pairs)lua/plugins/lsp.lua- LSP and diagnostics configuration (lspconfig, Mason, Trouble, diagnostics display)lua/plugins/snacks.lua- fzf-lua and neo-tree configurationlua/plugins/tools.lua- Formatting and other tools (conform, wildfire, PEP8 indent)
- Change Theme: Edit nord.nvim configuration in
lua/plugins/ui.lua - Add LSP: Add servers to ensure_installed in
lua/plugins/lsp.lua - Modify Keybindings: Edit
lua/config/keymaps.luato add custom mappings - Adjust Formatting: Modify formatters_by_ft in
lua/plugins/tools.lua - Disable Transparency: Comment out
require("config.transparency")loading ininit.lua - Configure Copilot: Adjust Copilot settings in
lua/plugins/cmp.lua - Customize File Explorer: Modify neo-tree configuration in
lua/plugins/snacks.lua
This configuration provides a complete, modern development environment with excellent performance and usability. All components have been carefully tuned to ensure compatibility and stability.
Configuration automatically installs the following LSP servers:
- clangd - C/C++ language server
- pyright - Python language server (type checking disabled, basic LSP features only)
- gopls - Go language server
- eslint - JavaScript/TypeScript linting
- lua_ls - Lua language server (specially configured for Neovim API support)
- rust_analyzer - Rust language server
- marksman - Markdown language server
Automatically installs the following language parsers:
- Lua, Vim, Vimdoc (Neovim core)
- Python, JavaScript, TypeScript
- HTML, CSS, JSON, Markdown
- Bash, C, C++, Rust, Go, Java
- Python: ruff (ignores F401 unused import warnings)
- JavaScript/TypeScript: prettier
- JavaScript React (JSX): prettier
- TypeScript React (TSX): prettier
- HTML: prettier
- CSS/SCSS: prettier
- JSON: prettier
- Markdown: prettier
- YAML: prettier
- Lua: stylua (2-space indentation)
- Shell: shfmt (2-space indentation)
All formatting tools support auto-format on save with 500ms timeout, LSP as fallback formatting option.
# Format all supported files using prettier
npx prettier --write .
# Format specific file types
npx prettier --write "**/*.{js,jsx,ts,tsx,html,css,scss,json,md}"
# Check which files need formatting (without modifying files)
npx prettier --check .# Check all files
npx eslint .
# Auto-fix fixable issues
npx eslint . --fix
# Show only errors, hide warnings
npx eslint . --quietTip: It's recommended to create .eslintignore and .prettierignore files in your project root to exclude directories that shouldn't be checked (such as node_modules/, .next/, dist/, build/, etc.).