nvim-autopairs icon indicating copy to clipboard operation
nvim-autopairs copied to clipboard

nvim-autopairs is breaking `i_CTRL-G_j` commands

Open polirritmico opened this issue 5 months ago • 0 comments

Description

The plugin is breaking the <C-g>j/<C-g>k behaviour in insert mode.

From :h insert-index:

i_CTRL-G_j CTRL-G CTRL-J line down, to column where inserting started i_CTRL-G_j CTRL-G j line down, to column where inserting started

But if the cursor begin the edit inside a pair, then <C-g>j is not moving to the column where inserting started.

Mapping bug

No response

Steps to reproduce

  1. Open a new file with nvim-autopairs enabled.
  2. Write this content:
1. ""
2. ""
  1. In normal mode move the cursor inside the first " pair.
  2. i and type test()
  3. Now, still in insert mode, press <C-g>j
  4. The cursor move outside the second " pair.

Expected behaviour:

  1. Open a clean nvim instance: $ nvim --clean foo Repeat steps 2 through 5.
  2. The cursor move inside the second " pair.

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',
      },
    },
    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()
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()]]

polirritmico avatar Aug 27 '24 17:08 polirritmico