Git Product home page Git Product logo

Comments (4)

wellle avatar wellle commented on May 22, 2024

I will take a look.

from targets.vim.

wellle avatar wellle commented on May 22, 2024

I can reproduce the behavior and I was surprised as well. But it turns out that that is actually default Vim behavior. To verify that, use vim -Nu NONE to start Vim without any plugins and repeat your test.

I agree that this behavior seems strange. You could ask in the vim-dev mailing list why it works that way and whether it could be fixed. Let me know if you need any assistance with that.

targets.vim is just reusing Vim's tag text objects here to select tags. Only if that fails it seeks into a distant tag. And in this case Vim's tag text objects did work, but not as intended.

I could possibly rewrite the tag text objects without using Vim's tag text objects, but that seems like the wrong approach to me.

Thank you for the heads up and let me know if you want me to ask on vim-dev.

from targets.vim.

bentomas avatar bentomas commented on May 22, 2024

Interesting! I agree that it doesn't make sense for targets.vim to rewrite this. I may ask on the vim-dev mailing list, but I won't have a chance this weekend, so it'd have to be next weekend. We'll see if I remember!

from targets.vim.

wellle avatar wellle commented on May 22, 2024

Actually it is consistent with with the other default text objects. I just tested it on this example:

{
    { some text }
}

With the cursor on the beginning of the middle line, vi{ selects some text and not the full middle line. If you insert any non whitespace between the cursor and the opening { the behavior will change to select the full second line.

So apparently the default text objects seek into the next text object if there is only whitespace between the cursor and the text object.

from targets.vim.

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.