altermo / ultimate-autopair.nvim

A treesitter supported autopairing plugin with extensions, and much more
MIT License
504 stars 5 forks source link

Undo mappings in insert mode don't work as expected #82

Open phanen opened 7 months ago

phanen commented 7 months ago
for _, char in ipairs({ '<space>', '-', '_', ':', '.', '/' }) do
  vim.keymap.set('i', char, char .. '<c-g>u')
end

After mappings, insert <space> or - cannot insert a undo point as expected.

altermo commented 7 months ago

The feature to solve this, which is falling back to keymapping, is on the TODO list. But until I get to that part of the TODO list, you can use this config:

require'ultimate-autopair'.init({
    require'ultimate-autopair'.extend_default({
        --Your config
    }),
    {profile='map',p=-1,
        {'i',' ',function () return vim.api.nvim_replace_termcodes(' <C-g>u',true,true,true) end},
        {'i','-',function () return vim.api.nvim_replace_termcodes('-<C-g>u',true,true,true) end},
    },
})
phanen commented 7 months ago

This workaround seems also adding cmap. image

altermo commented 7 months ago

Fixed