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

Textobject for mini.indentscope which does not include blank lines #1233

Closed
2 tasks done
srghma opened this issue Sep 19, 2024 · 5 comments
Closed
2 tasks done

Textobject for mini.indentscope which does not include blank lines #1233

srghma opened this issue Sep 19, 2024 · 5 comments
Labels
feature-request Request for a feature to existing module mini.indentscope

Comments

@srghma
Copy link

srghma commented Sep 19, 2024

Contributing guidelines

Module(s)

mini.indentscope

Description

I lack ii from https://github.com/kana/vim-textobj-indent

(N.B. ia from https://github.com/kana/vim-textobj-indent is ai from mini.indentscope)

in

def foo:
  bar
  bar
end

cursor on bar should select

  bar
  bar

in

def foo:
  bar
  bar
        end

cursor on bar should select

  bar
  bar
        end

too


in

def foo:
  bar
  bar

  foo
  foo
        end

cursor on bar should select

  bar
  bar

too


having

:lua print(vim.inspect(MiniIndentscope.config))
{
  draw = {
    animation = <function 1>,
    delay = 100,
    priority = 2
  },
  mappings = {
    goto_bottom = ",J",
    goto_top = ",K",
    object_scope = "ii",
    object_scope_with_border = "ai"
  },
  options = {
    border = "both",
    indent_at_cursor = true,
    try_as_border = false
  },
  symbol = ""
}

cursor on [g]oto_top

      mappings = {



        -- Textobjects
        object_scope = 'ii',
        object_scope_with_border = 'ai',

        -- Motions (jump to respective border line; if not present - body line)
        goto_top = ',K',
        goto_bottom = ',J',
      },

if I vii

currently - selects

      mappings = {
[


        -- Textobjects
        object_scope = 'ii',
        object_scope_with_border = 'ai',

        -- Motions (jump to respective border line; if not present - body line)
        goto_top = ',K',
        goto_bottom = ',J',]
      },

the vii from https://github.com/kana/vim-textobj-indent would select only

      mappings = {



        -- Textobjects
        object_scope = 'ii',
        object_scope_with_border = 'ai',

[       -- Motions (jump to respective border line; if not present - body line)
        goto_top = ',K',
        goto_bottom = ',J',]
      },
@srghma srghma added the feature-request Request for a feature to existing module label Sep 19, 2024
@srghma

This comment was marked as resolved.

Repository owner deleted a comment from AhmadMahmoodRana Sep 19, 2024
@echasnovski echasnovski changed the title Feature: new textobject for mini.indentscope like https://github.com/kana/vim-textobj-indent has -> indentation breaked by different indentation Textobject for mini.indentscope which does not include blank lines Sep 19, 2024
@echasnovski
Copy link
Owner

Thanks for the suggestion!

If I understood correctly, the suggestion is to have an "inner scope" textobject which does not include blank lines.

This is out of scope for 'mini.indentscope' as I don't think this is behavior is that useful: in most cases it is similar to ip. The way 'mini.indentscope' handles blank lines is described here and allows adjusting only the top and bottom sets of blank lines (by adjusting config.options.border; see effect here).

Closing as not planned.

@srghma
Copy link
Author

srghma commented Sep 19, 2024

having

:lua print(vim.inspect(MiniIndentscope.config))
{
  draw = {
    animation = <function 1>,
    delay = 100,
    priority = 2
  },
  mappings = {
    goto_bottom = "<C-j>",
    goto_top = "<C-k>",
    object_scope = "ii",
    object_scope_with_border = "ai"
  },
  options = {
    border = "none",
    indent_at_cursor = true,
    try_as_border = false
  },
  symbol = ""
}

cursor on [g]oto_top

      mappings = {



        -- Textobjects
        object_scope = 'ii',
        object_scope_with_border = 'ai',

        -- Motions (jump to respective border line; if not present - body line)
        goto_top = ',K',
        goto_bottom = ',J',
      },

if I vii or vai

currently - selects

      mappings = {



[        -- Textobjects
        object_scope = 'ii',
        object_scope_with_border = 'ai',

        -- Motions (jump to respective border line; if not present - body line)
        goto_top = ',K',
        goto_bottom = ',J',]
      },

thus, there is no way to accomplish vii from https://github.com/kana/vim-textobj-indent IIUC


About ip

it will select

      mappings = {



        -- Textobjects
        object_scope = 'ii',
        object_scope_with_border = 'ai',

[       -- Motions (jump to respective border line; if not present - body line)
        goto_top = ',K',
        goto_bottom = ',J',
      },]

not the same (just as kevintraver wrote here kiyoon/treesitter-indent-object.nvim#1 (comment))

@echasnovski
Copy link
Owner

thus, there is no way to accomplish vii from https://github.com/kana/vim-textobj-indent IIUC

Yes, this is what was meant by "out of scope for 'mini.indentscope". I don't think this particular textobject is useful enough to be worth adding extra complexity to 'mini.indentscope' module.

not the same (just as kevintraver wrote here

Yes, that's why it was "in most cases it is similar to ip".

@srghma
Copy link
Author

srghma commented Sep 19, 2024

is useful enough

:( at least two people search for it

I used often :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for a feature to existing module mini.indentscope
Projects
None yet
Development

No branches or pull requests

2 participants