Giter Club home page Giter Club logo

Comments (2)

tuurep avatar tuurep commented on August 11, 2024 1

Don't remap _ which is a built-in textobject for line.

Ah, that's it. I didn't know it's a text object. (confusion: I did know but thought 'textobject' meant it would be used as i_ and a_)

Thank you!

I'm stubborn with my mappings though so your second suggestion will do :)

Didn't expect the solution to look like this but here it is:

vim.keymap.set("o", "💩", "_")
vim.keymap.set("n", "grr", "gr💩", {remap=true})
vim.keymap.set("n", "gmm", "gm💩", {remap=true})
vim.keymap.set("n", "gxx", "gx💩", {remap=true})
vim.keymap.set("n", "g==", "g=💩", {remap=true})

from mini.nvim.

echasnovski avatar echasnovski commented on August 11, 2024

Thanks for the issue!

This is an expected and documented behavior. Line variants are usually a direct mapping which relies on _ built-in textobject. You can see it by :nmap grr, for example. This is not the case for gss which maps to ^gsg_, which is also documented.

I'm wondering, is there like some ! (bang) missing somewhere in the code where re-mappings should be ignored? Or some similar small thing like this.

Using normal! won't work here as mapping relies on remapped meaning of operator prefixes (so that it will be as if user pressed gr_, etc.).

I don't think rewriting the whole mapping logic is worth in this case. So my suggestion would be:

  • Don't remap _ which is a built-in textobject for line.
  • Make custom mappings for grr, gmm, gxx, g== which eventually uses textobject for current line.

Closing as not planned.

from mini.nvim.

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.