Git Product home page Git Product logo

Comments (5)

hkupty avatar hkupty commented on June 14, 2024

In iron you can send multiple lines together as a chunk of text using the the mapping for send motion, just like in the example config:

iron.setup {
  config = {
  -- ...
  },
  -- Iron doesn't set keymaps by default anymore.
  -- You can set them here or manually add keymaps to the functions in iron.core
  keymaps = {
    send_motion = "<space>sc",
    -- ...
  }
}

In this case, if you run <space>scap you'll send the whole paragraph. If you use treesitter, you can use nvim-treesitter-textobjects' af to send a function: <space>scaf.

I hope this helps.

Best regards,
Henry

from iron.nvim.

Bubobubobubobubo avatar Bubobubobubobubo commented on June 14, 2024

Hi, <space>scap is perfect. This is exactly what I needed. I also found the following technique but I don't really know why it works. It is less immediate compared to the command you were suggesting though. Sardine is the name of a custom Python interpreter I am running (see my repo):

python = {
    command = { "sardine" },
    format = require("iron.fts.common").bracketed_paste,
},

How would you remap <space>scap on something like <space><CR>?

from iron.nvim.

hkupty avatar hkupty commented on June 14, 2024

ap is a vim text object that would read as around paragraph, just like iw would read `inner word.

You should be able to use regular nmap <space><CR> <space>scap, but bear in mind that it is usually preferred to use text objects and motions as each case is different. If, for example, you have a function with an empty line, say, for better readability, you'd probably want to use treesitter's af instead, or at least <space>sc2ap, for sending two whole paragraphs instead.

I hope this solves your issue, but feel free to reopen if you have any further questions!

from iron.nvim.

hkupty avatar hkupty commented on June 14, 2024

For reference, here is the link to treesitter's text-object: https://github.com/nvim-treesitter/nvim-treesitter-textobjects

from iron.nvim.

henrikmunch avatar henrikmunch commented on June 14, 2024

I am facing a similar problem regarding the ap key binding.
I have send_motion = "<c-s>" , and indeed I can send a paragraph of text by typing <c-s>ap.

However, I am unable to abbreviate this sequence of keys to <c-z>.
I attempted the latter by writing vim.keymap.set("n", "<c-z>", "<c-s>ap").
Which mistake am I making?

Thanks in advance!

from iron.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.