jpalardy / vim-slime

A vim plugin to give you some slime. (Emacs)
http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/
MIT License
1.83k stars 223 forks source link

Fix wezterm #375

Closed jpalardy closed 1 year ago

jpalardy commented 1 year ago

diff is easier to follow, one commit at a time

albheim commented 1 year ago

Works fine except for python/ipython where if you send multiple lines it will either indent them incorrectly (if brackets paste is off) or it will require a manual enter after inserting them (if bracket paste is on).

Seems to be since python requires two newlines in a row for multiline things to mark that input is done.

MadFisa commented 1 year ago

@jpalardy I am away from my pc for few days, I will take a look as soon as I get back.

jpalardy commented 1 year ago

@albheim have you tried this with tmux? I wonder how it behaves 🤔

albheim commented 1 year ago

It's the same for tmux.

Not saying it is something that has to be fixed, just reflected on it since it was part of the discussion in #373 with regards to double enters. I can't really think of any good way to fix it since it would probably require different handling of different targets, and I don't think you have any way of seeing what the target is (at least currently)?

I'm also questioning if having bracketed paste off by default is the right choice? I agree it should be consistent, and tmux already do it this way, though I don't really see many cases when I would prefer it that way. Manually pasting some code in e.g. ipython or julia repl seems to use bracketed paste for me (don't really know anything about this, but tried copying from some different sources so it wasn't that which made it), and staying consistent with "the normal experience" is also worth regarding.

jpalardy commented 1 year ago

Hi @albheim

Good point about bracketed_paste — it seems like a reasonable default now, but it certainly wasn't in play when vim-slime first came around.

I think the "fix" for this will be to add a strongly worded comment in the wezterm section of the documentation

MadFisa commented 1 year ago

@jpalardy It works as expected as with bracketed_paste on (does not require manual enter for me ) with wezterm and tmux with both ipython mode on and off. Interestingly I do not require the manual enter as observed by @albheim .

Switching off bracketed paste creates extra indents when sending multiple lines which have indents in them. But I think that is the expected behavior with bracketed_pasteoff.

So overall this seems to work as expected for me. Also I agree with @albheim about bracketed_paste being enabled should be the sensible default now.

albheim commented 1 year ago

You tried with both single and multiline entries?

Single worked fine for me (no extra enter needed), but for multiline it was needed. And this seems to be how the python repl works normally as well, since for single line you just enter once to run, but for multiline the first enter is just new line while second runs the entry.

MadFisa commented 1 year ago

@albheim It is working for me without any problems as long as bracketed_paste is on (irrespective of ipython mode). Just to clarify, lines are sent to Wezterm by visually selecting them in neovim and then using SlimeSend to send them to the terminal.

albheim commented 1 year ago

Hmm, interesting. I use vim so maybe a vim/neovim difference? Though that also seems a bit odd.

Well, either way I think this PR is an improvement so if anyone has problems with this in the future it can be looked at then.

jpalardy commented 1 year ago

I'll merge this in for now — please let me know if we can improve (and fix) this more.