TIL you can disable vim-sexp's insert-mode bindings. Which makes it compatible with vim parinfer plugins. And now I'm super happy.
I've not had issues?
By default, it prevents you from typing opening and closing parens, I thought?
Oh, it inserts close parens for your open parens, and prevents closing parens, moving you to the close of the form, right?
I haven't had that :thinking_face:
paredit maybe? let g:paredit_mode = 0
is in the nvim-parinfer.js readme
or and let g:sexp_enable_insert_mode_mappings = 0
So, here's an interesting problem that I'm not sure what to do with. Certain Vim operations are related to the cursor position, and certain ones aren't. Currently, I send the cursor position in for smart mode when in insert mode. This is kind of nice.
I don't send it for normal mode changes. If I indent a line with >>
for example, the cursor position is not important. I guess, because it's line-wise?
But there are various things in normal mode where it is important. x
to delete a character, for example.
If I send the cursor position when it isn't relevant, smart mode will adjust the indentation of more lines, which I think is bad. For example, with the >>
, I think if I send it, it will also indent successive lines within the form, if the cursor is to the left of the inserted spaces, but not if it is to the right of the inserted spaces.
what to do, what to do
I think that generally sending it is the right thing.
So far, I'm thinking it should not be sent for linewise commands or ex commands, but everything else. Unfortunately, I don't know how to detect which it is.
Cursor mode returns? ๐
@doglooksgood did we have a discussion about parinfer working with other languages? I canโt remember what we decided since the logs are lost: https://twitter.com/DevinRhode2/status/978715648703565824
would be nice if we moved those interesting conversations to our forum for posterity: https://talk.parinfer.io/
@eraserhd do you ever do r<enter>
that's a case where I'm guessing the cursor being "on" would help.
@eraserhd do you have a way to toggle cursor on/off for normal mode?
I don't, though there's an a line that looks roughly like if a:is_insert
that you could delete to play around with what it would do.
I tell you what. I think I'm going to send it the cursor all the time, and then fix any cases that come up.
Let me do that now.
suits me, I think.
I'm going to demo this tomorrow at a meetup, amongst the rest of my vim setup. Should be interesting.
i'll keep in the happy path.
Oh, neat!!
Let me know how it goes.
Also, of course, any feedback.
I'm definitely more excited now that I can show this stuff working ๐
Will do. Especially if I think of something around linewise & ex commands.
Ok, that commit is pushed.
:PlugUpdate awaaaayyy
>>
does the right thing, awesome!
heh, don't like it.
Is that your preference, or a hope that I won't like it? ๐
That's my preference.
Hmm, it does seem to be consistent, though.
How would we change the indentation of a single line, then? Hrmm. Well, I'll dogfood it anyway.
why would I want to do that? ๐ฎ
@eraserhd is there a :ParinferOn? I want to show vim-sexp first, including the slurp & barf stuff
https://github.com/eraserhd/parinfer-rust/blob/master/plugin/parinfer.vim#L22-L30 ah, looks like :ParinferToggle
will put me in smart mode straight away, cool ๐
Apparently not. Oh, that works.
There should probably be a :ParinferOn.
And on/off should probably be independent of mode.
that's what I thought when I saw it too ๐
It's no longer a toggle, either, with three modes. ๐
Also, it should be possible to disable for a buffer, for when you are editing that one ridiculous file.