randy3k / SendCode

Send code and text to macOS and Linux Terminals, iTerm, ConEmu, Cmder, Tmux, Terminus; R (RStudio), Julia, IPython.
MIT License
204 stars 28 forks source link

Blocks of code encapsulated in "~0 .... 1~" #77

Closed kuchenrolle closed 6 years ago

kuchenrolle commented 6 years ago

When I use sendtext to send to a tmux window, it works fine as long as I send individual lines, but when I try to send a function or some block of code, the code is sent to the terminal encapsulated by a leading "\~0" and a trailing "1~", so

def fun(arg):
  print(arg)

arrives at the terminal as

~0def fun(arg):
  print(arg)1~

This problem occurs for R and for python. The only sublime key binding I changed is for ctrl+#, to comment out lines. The other packages I have installed are Anaconda, Git, GitGutter, Markdown Extended, SFTP, SublimeLinter-pep8, SublimeLinter-pyflakes, SublimeREPL and Terminal.

randy3k commented 6 years ago

Are you not using IPython?

kuchenrolle commented 6 years ago

No, I'm not.

randy3k commented 6 years ago

You should use iPython as the native python console doesn't support bracket paste mode.

kuchenrolle commented 6 years ago

Okay, using iPython solved the problem for python, but what about R?

randy3k commented 6 years ago

Did you turn on bracketed paste mode for R syntax in the setting? The built in R console doesn’t support BPM. So either turn it off or try another R console such as rice.

kuchenrolle commented 6 years ago

It seems to be turned-on by default, so turning it off in the settings solved the problem. Thank you!

randy3k commented 6 years ago

That's odd. The default should be false https://github.com/randy3k/SendCode/blob/0a2281798242f2a3999549e127a59a365f1d9f36/SendCode%20(Linux).sublime-settings#L6

Maybe you have changed it accidentally.

kuchenrolle commented 6 years ago

I have not. It also says false for me, but somehow it would send it in bracketed mode anyway and it only stopped when I added it to the user specific settings for R. Today, though, when I remove that line from the user settings for R, it still works. Random.