Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify start pair after typing #447

Open
Anaritus opened this issue Apr 1, 2024 · 1 comment
Open

Modify start pair after typing #447

Anaritus opened this issue Apr 1, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Anaritus
Copy link

Anaritus commented Apr 1, 2024

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 Anaritus added the enhancement New feature or request label Apr 1, 2024
@windwp
Copy link
Owner

windwp commented Apr 6, 2024

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)
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants