Skip to content

FastWrap $ (end_key) places closing pair after ; instead of before it #540

@comiluv

Description

@comiluv

Description

When using FastWrap in a C-like language, pressing <M-e> followed by $ places the closing pair character at the absolute end of the line, past the ;. The expected behavior is for $ to place the closing pair before the ;, since the semicolon is a statement terminator and not part of the expression being wrapped.

Actual behavior:

int sum = (|1 + 2;    →    int sum = (1 + 2;)

Expected behavior:

int sum = (|1 + 2;    →    int sum = (1 + 2);

It appears that $ bypasses the pattern entirely and jumps to the absolute end of the line rather than to the last pattern-matched position. I attempted adding %; to the pattern option in setup, but the behavior remained unchanged.

This affects common C-like patterns where lines end with ;, such as variable declarations, assignments, and function calls.

Mapping bug

1.If you report a bug about indent. Please remember that plugin doesn't do anything about indent.
It just trigger the indent of your vim config so if you have wrong indent config then it will do wrong indent.
You can check by select a block of code and press ==
2. provide result of command :verbose imap <cr>.

Steps to reproduce

2026-02-26.052014.mp4

Minimal config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      {
        'windwp/nvim-autopairs',
      },
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
      display = { non_interactive = true },
    },
  }
end
_G.load_config = function()
  require('nvim-autopairs').setup(fast_wrap = {})
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing nvim-autopairs and dependencies.")
  vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions