kiyoon/treesitter-indent-object.nvim

Feature Request: New Text object

Opened this issue · 5 comments

This is an awesome plugin!

It would be useful to have a new text object that is similar to the existing text objects, but a new version that is restricted or bounded by newlines at the same indentation level:

Example:

    def sample_function():
        print("hello world")

        print("some text")
        print("more *text")      <--- cursor here
        print("even more text")

        print("some more text")

This would select:

        print("some text")
        print("more text")
        print("even more text")
kiyoon commented

Thanks for the feedback!

I think there are a lot of existing implementation for this one. For example

https://github.com/kana/vim-textobj-indent

This plugin should already have the feature you want.

kiyoon commented

Actually, if I remember correctly, maybe this is a default vim textobject?

Can you try ap and ip?

Here's why ap and ip don't work:

    def sample_function()
        print("hello world")

        print("some text")
        print("more text")
        print("even more text")

        print("some more *text")      <--- cursor here
    def another_function()
        print "random text"

will select this:

        print("some more text")
    def another_function()
        print "random text"

this is the ii textobject from https://github.com/kana/vim-textobj-indent