Fork me on GitHub
#vim
<
2024-02-29
>
gtbono03:02:25

is there any way to do parinfer (I've used parinfer-rust and nvim-parinfer) but turn off automatic insertion of closing bracket so that if I have the following code '(let [test (fn :foobar..' and when I insert for example a parenthesis between the fn and the :foobar, instead of doing this: '(let [test (fn () :foobar..' it does this: '(let [test (fn (:foobar)..' cursive does this with parinfer smart mode and automatic closing bracket insertion turned off, is there a way to get this behavior on vim too? (can use iced or conjure)

Noah Bogart04:02:33

I use nvim-paredit, and that allows me to hit >) which moves the closing ) forward/to the right.

practicalli-johnny05:02:41

Is it as simple as ensuring there is more space between :foobar and the () insertion point (e.g. add another space then move back and insert parens)

practicalli-johnny06:02:50

I'm using https://github.com/gpanders/nvim-parinfer branch master, commit 5ca0928 and don't get the same behavior. If it's a Clojure keyword the parens doesn't wrap. If it's a symbol name, then it is wrapped by parens

practicalli-johnny17:02:38

With parinfer, typing the closing parens ) where it should go will automatically update the structure correctly.

practicalli-johnny14:03:18

Not sure if this makes a difference, but I set parinfer_force_balance = true

{
    "gpanders/nvim-parinfer",
    ft = { "clojure" },
    init = function()
      vim.g.parinfer_force_balance = true
      vim.g.parinfer_comment_chars = ";;"
    end,
  },

gtbono14:03:17

hey @U05254DQM thanks for the replies! I installed gpanders/nvim-parinfer and I can't get the same behavior as cursive, I tried the parinfer_force_balance configuration too but it didn't change a thing :white_frowning_face: if you have the following map: {:foo bar} by typing ( after the right-side space of :foo, does the parens enclose the bar? becoming (bar) like cursive?

practicalli-johnny19:03:42

To get (bar) in that expression I put the cursor on top of b and press i for insert mode, then ( will wrap to give (bar) If the cursor is on top of the space between :foo and bar then I get {:foo() bar}