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

Modify start pair after typing

Open Anaritus opened this issue 3 months ago • 1 comments

Is your feature request related to a problem? Please describe. I want to be able to add symbols before cursor after I have hit a pair trigger, for example let | .I press $, and text becomes let $ | $, where | is cursor position.

Describe the solution you'd like A way to make rule modify symbols before cursor, or simply move the cursor to the right

Describe alternatives you've considered Maybe you can just move cursor somehow, haven't found a way to do that

Anaritus avatar Apr 01 '24 14:04 Anaritus

on readme file

-- you can do anything with regex +special key
-- example press tab to uppercase text:
-- press b1234s<tab> => B1234S1234S

npairs.add_rules({
  Rule("b%d%d%d%d%w$", "", "vim")
    :use_regex(true,"<tab>")
    :replace_endpair(function(opts)
          return
              opts.prev_char:sub(#opts.prev_char - 4,#opts.prev_char)
              .."<esc>viwU"
    end)
})

windwp avatar Apr 06 '24 04:04 windwp