Fork me on GitHub
#parinfer
<
2018-03-27
>
eraserhd13:03:20

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

dominicm14:03:16

I've not had issues?

eraserhd14:03:17

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

eraserhd14:03:44

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

dominicm15:03:51

I haven't had that :thinking_face:

snoe15:03:17

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

snoe15:03:37

or and let g:sexp_enable_insert_mode_mappings = 0

eraserhd18:03:28

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.

eraserhd18:03:19

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?

eraserhd18:03:55

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

eraserhd18:03:33

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.

eraserhd18:03:38

what to do, what to do

dominicm18:03:33

I think that generally sending it is the right thing.

eraserhd18:03:44

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.

dominicm18:03:01

Cursor mode returns? ๐Ÿ˜›

shaunlebron20:03:24

@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

shaunlebron20:03:02

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

dominicm20:03:03

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

dominicm20:03:24

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

eraserhd20:03:21

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.

eraserhd20:03:53

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.

eraserhd20:03:59

Let me do that now.

dominicm20:03:33

suits me, I think.

dominicm20:03:55

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

dominicm20:03:02

i'll keep in the happy path.

eraserhd20:03:12

Let me know how it goes.

eraserhd20:03:24

Also, of course, any feedback.

dominicm20:03:27

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

dominicm20:03:40

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

eraserhd20:03:52

Ok, that commit is pushed.

dominicm20:03:15

:PlugUpdate awaaaayyy

dominicm20:03:27

>> does the right thing, awesome!

eraserhd21:03:15

heh, don't like it.

dominicm21:03:42

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

eraserhd21:03:04

That's my preference.

eraserhd21:03:46

Hmm, it does seem to be consistent, though.

eraserhd21:03:45

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

dominicm21:03:56

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

dominicm21:03:56

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

dominicm21:03:41

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

eraserhd21:03:52

Apparently not. Oh, that works.

eraserhd21:03:31

There should probably be a :ParinferOn.

eraserhd21:03:48

And on/off should probably be independent of mode.

dominicm21:03:56

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

eraserhd21:03:11

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

eraserhd21:03:46

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