Git Product home page Git Product logo

Comments (8)

kana avatar kana commented on May 21, 2024

Thank you for the feedback. I'll investigate the problem. Please wait a moment.

from vim-textobj-user.

kana avatar kana commented on May 21, 2024

textobj-user doesn't consider about using the same pattern to express the beginning and the end of a range. I'll fix it later.

As a workaround, use the following configuration instead. It emulates the original configuration you wrote, though it may not work as you expect in a specific situation.

call textobj#user#plugin('handyobjects', {
\   'underscores_a': {
\     'select': 'au',
\     '*pattern*': '_[^_]*_'
\   },
\   'underscores_i': {
\     'select': 'iu',
\     '*pattern*': '_\zs[^_]\+\ze_'
\   },
\ })

from vim-textobj-user.

 avatar commented on May 21, 2024

Great, thanks for help.
I'll watch this repository for updates ;)

Btw, I also tried to change text between pipes "|" using "ci|" but pipe character isn't allowed unfortunately. But I suspect this won't be easy to workaround, am I right?

Anyway, awesome plugin, good work man.

from vim-textobj-user.

ku1ik avatar ku1ik commented on May 21, 2024

Oops, previous comment was mine, but I forgot that I'm using different GH account :)

from vim-textobj-user.

kana avatar kana commented on May 21, 2024

Btw, I also tried to change text between pipes "|" using "ci|" but pipe character isn't allowed unfortunately. But I suspect this won't be easy to workaround, am I right?

It's not hard as you imagined. Use the following:

call textobj#user#plugin('handyobjects', {
\   'pipes_a': {
\     'select': 'a<Bar>',
\     '*pattern*': '|[^_]*|'
\   },
\   'pipes_i': {
\     'select': 'i<Bar>',
\     '*pattern*': '|\zs[^_]\+\ze|'
\   },
\ })

I suspect that you wrote a|/i| for select. It doesn't work. You have to wrote a<Bar>/i<Bar> instead.

Because |, the pipe character is used to separate multiple commands in a line. Essentially, textobj-user just executes a bunch of :map commands. For example, if a| is given for select, textobj-user will execute :map commands like the following:

vnoremap a|  (((magical stuff to select a specific text)))
onoremap a|  (((magical stuff to select a specific text)))
...

But Vim interprets the above commands as follows:

vnoremap a
(((magical stuff to select a specific text)))
onoremap a
(((magical stuff to select a specific text)))
...

So it doesn't work.

from vim-textobj-user.

ku1ik avatar ku1ik commented on May 21, 2024

Thanks! You made my day ;)

from vim-textobj-user.

AndrewRayCode avatar AndrewRayCode commented on May 21, 2024

I had the same problem making a regex matcher. I am completely astounded no one has made a vim-textobj-regex yet. I was able to get it working with this:

call textobj#user#plugin('regex', {
\   'regex_a': {
\     'select': 'a/',
\     '*pattern*': '\/.*\/[gicm]\{0,}'
\   },
\   'regex_i': {
\     'select': 'i/',
\     '*pattern*': '\/\zs.\+\ze\/'
\   },
\ })

I don't know if it's worthy to make a repo just for that, but maybe it is just so people can find it.

from vim-textobj-user.

throughnothing avatar throughnothing commented on May 21, 2024

@delvarworld make it a repo!

from vim-textobj-user.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.