parinfer

eraserhd 2018-03-27T13:58:20.000586Z

TIL you can disable vim-sexp's insert-mode bindings. Which makes it compatible with vim parinfer plugins. And now I'm super happy.

dominicm 2018-03-27T14:17:16.000718Z

I've not had issues?

eraserhd 2018-03-27T14:38:17.000490Z

By default, it prevents you from typing opening and closing parens, I thought?

eraserhd 2018-03-27T14:38:44.000708Z

Oh, it inserts close parens for your open parens, and prevents closing parens, moving you to the close of the form, right?

dominicm 2018-03-27T15:04:51.000693Z

I haven't had that :thinking_face:

snoe 2018-03-27T15:17:17.000744Z

paredit maybe? let g:paredit_mode = 0 is in the nvim-parinfer.js readme

snoe 2018-03-27T15:17:37.000069Z

or and let g:sexp_enable_insert_mode_mappings = 0

eraserhd 2018-03-27T18:22:28.000610Z

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.

eraserhd 2018-03-27T18:23:19.000759Z

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?

eraserhd 2018-03-27T18:23:55.000553Z

But there are various things in normal mode where it is important. x to delete a character, for example.

eraserhd 2018-03-27T18:26:33.000385Z

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.

eraserhd 2018-03-27T18:26:38.000384Z

what to do, what to do

dominicm 2018-03-27T18:33:33.000298Z

I think that generally sending it is the right thing.

eraserhd 2018-03-27T18:37:44.000319Z

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.

dominicm 2018-03-27T18:41:01.000333Z

Cursor mode returns? ๐Ÿ˜›

shaunlebron 2018-03-27T20:01:24.000487Z

@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

shaunlebron 2018-03-27T20:04:02.000180Z

would be nice if we moved those interesting conversations to our forum for posterity: https://talk.parinfer.io/

dominicm 2018-03-27T20:32:03.000547Z

@eraserhd do you ever do r<enter> that's a case where I'm guessing the cursor being "on" would help.

dominicm 2018-03-27T20:32:24.000452Z

@eraserhd do you have a way to toggle cursor on/off for normal mode?

eraserhd 2018-03-27T20:33:21.000134Z

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.

eraserhd 2018-03-27T20:33:53.000640Z

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.

eraserhd 2018-03-27T20:33:59.000573Z

Let me do that now.

dominicm 2018-03-27T20:37:33.000392Z

suits me, I think.

dominicm 2018-03-27T20:37:55.000192Z

I'm going to demo this tomorrow at a meetup, amongst the rest of my vim setup. Should be interesting.

dominicm 2018-03-27T20:38:02.000434Z

i'll keep in the happy path.

eraserhd 2018-03-27T20:40:08.000598Z

Oh, neat!!

eraserhd 2018-03-27T20:40:12.000084Z

Let me know how it goes.

eraserhd 2018-03-27T20:40:24.000077Z

Also, of course, any feedback.

dominicm 2018-03-27T20:40:27.000308Z

I'm definitely more excited now that I can show this stuff working ๐Ÿ™‚

dominicm 2018-03-27T20:40:40.000439Z

Will do. Especially if I think of something around linewise & ex commands.

eraserhd 2018-03-27T20:44:52.000520Z

Ok, that commit is pushed.

dominicm 2018-03-27T20:49:15.000141Z

:PlugUpdate awaaaayyy

dominicm 2018-03-27T20:54:27.000267Z

>> does the right thing, awesome!

eraserhd 2018-03-27T21:15:15.000609Z

heh, don't like it.

dominicm 2018-03-27T21:15:42.000176Z

Is that your preference, or a hope that I won't like it? ๐Ÿ˜›

eraserhd 2018-03-27T21:16:04.000490Z

That's my preference.

eraserhd 2018-03-27T21:16:46.000096Z

Hmm, it does seem to be consistent, though.

eraserhd 2018-03-27T21:17:45.000590Z

How would we change the indentation of a single line, then? Hrmm. Well, I'll dogfood it anyway.

dominicm 2018-03-27T21:17:56.000347Z

why would I want to do that? ๐Ÿ˜ฎ

dominicm 2018-03-27T21:18:56.000544Z

@eraserhd is there a :ParinferOn? I want to show vim-sexp first, including the slurp & barf stuff

dominicm 2018-03-27T21:19:41.000040Z

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 ๐Ÿ™‚

eraserhd 2018-03-27T21:19:52.000613Z

Apparently not. Oh, that works.

eraserhd 2018-03-27T21:20:31.000343Z

There should probably be a :ParinferOn.

eraserhd 2018-03-27T21:20:48.000274Z

And on/off should probably be independent of mode.

dominicm 2018-03-27T21:20:56.000528Z

that's what I thought when I saw it too ๐Ÿ™‚

eraserhd 2018-03-27T21:23:11.000541Z

It's no longer a toggle, either, with three modes. ๐Ÿ™‚

eraserhd 2018-03-27T21:23:46.000010Z

Also, it should be possible to disable for a buffer, for when you are editing that one ridiculous file.