-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running the current buffer in Iron Repl by pressing <F5> ? #135
Comments
That's interesting. The easiest way for us to do that is to dump the whole buffer into the repl, like so: map <F5> <Cmd>lua require("iron").core.send(vim.api.nvim_buf_get_option(0,"ft"), vim.api.nvim_buf_get_lines(0, 0, -1, false))<Cr> Try that and let me know what do you think. Sorry for not answering before. Best regards, |
Thank you very much for this reply, and sorry for getting back late as well. The solution works only for a single line file. Three print statements in a row don't make it: translate in the REPL to: Thanks again. |
Weird. I just tested against master version, on linux, running nvim from the terminal and it pasted the whole file in in the repl. What's your setup? |
Hello again, I'm working on Windows. Having setting up IronREPL from scratch on my Windows laptop, it works better:
The following screen capture illustrates the three problems I encounter:
The mapping :
The lua file
|
Also having some trouble on Windows 10 with extra characters and no automatic carriage return. If I have some time I may try to jump in here with you and figure some stuff out. Been meaning to learn about vim plugins but I am starting from zero. @HkUmpy you're doing God's work by the way. Update (2019-11-19): I've managed to get rid of the bad characters and I have automatic execution by changing my custom command to "ipython --simple-prompt". Unfortunately now I've lost the carriage returns, exactly like @evoludigit in his first post. |
New strategy I'm working on here: loop through the lines and send them one by one to the REPL. The code below sends only lines 4 through 8. Notice the "\n\r" send at the end which forces the execution on Windows:
Seems like it should be simple but I'm having trouble getting start and end rows for a visual selection. Working with this vimscript function:
It seems like it's giving me the right numbers, but it's looping through every line which isn't great. Going to see if I can hook this up today. |
I've got two lua functions that work with iPython in Windows. Use them with ipython --simple-prompt as the custom command. The first runs the entire file top to bottom:
The second runs a visual selection, and depends on the Show_position() vimscript function from my last post:
The first command works fine either as a directly entered command or mapped to a key. The second command works beautifully every time when I run it manually but is always one command set behind when it's mapped to a key sequence in init.vim. I feel like I just can't win here! |
First of all, sorry for taking this long to answer. Couldn't get much time to devote attention to my projects, unfortunately. I found this line on
Would you mind @baogorek trying the branch Best regards and sorry once again, |
Hi @hkupty, Here's the verdict on the branch
Henry, I finally have a set of keymappings for this set of tasks that works. Along with the plugins.lua that uses the One final note is that, for whatever reason, the nmap-ed Ben Update after a few hours of developing: I am feeling the limitations of |
It's nice to see that it improved the situation. I'm planning to do the following:
Out of curiosity, have you tried the mapping I suggested as answer to this issue with my branch? Regarding your keymaps, I think your mapping |
|
It looks like I might have got the order wrong. In linux it's |
@hkupty I wish I had good new for you. I stayed on the same branch and ran :PlugUpdate and I saw a small change indicated. I disabled my custom functionality, restarted vim and tried everything over again. Unfortunately, it just didn't seem any different. I'm happy to keep testing changes as long as you keep sending them, but I am bearish on the default iPython doing what we want it to, at least in its current incarnation. I bet if we went back to version 4 it'd be a delight. |
There might be a way, based on prompt-toolkit's documentation:
I'll try to implement esc+enter for ipython and I'll let you know :D |
Great news. I found another hardcoded linefeed ( I'm really glad you're helping me out here as I don't have a windows machine to test this. |
Glad there are still unexplored avenues. I updated this morning. iPython is still acting the same (had to manually press enter to get the syntax error). I tried it with ordinary python 3.6.8 and it behaved more like simple-prompt mode on iPython, executing automatically but no line breaks. Screenshots at the bottom. You'll see I have a few shell commands in the mix. These work perfectly when visually highlighting and pressing ctr to send to Powershell. Happy to help and you're doing me a huge solid by building these tools. I've been looking for something that gets me Slimux-like functionality on Windows. Cygwin makes most REPLs unusable and WSL makes me go through 20 steps to see a plot. If you'd like to interactively debug over Hangouts or something, I'm free most of the weekend (on Eastern Standard Time). |
Based on what you described, I might have actually swapped CR and LF when implementing the windows version. I just pushed yet another commit (hopefully the last one). If this doesn't work, then I think we'll be faster doing a Hangouts sessions. As iron provides APIs, as well as other projects I have, like nvimux, we might think of a way of integrating them to get some functionality like that. :) |
Let's jump on Hangouts. Nothing is changing for me when I make these updates. My gmail id is the same as the github id. |
One of the things I'm learning about is this "Prompt Toolkit," which I think is causing all the issues for iPython. The rlipython tries to bring readline back but it's got some issues with IPython 7. |
Hello,
congratulations for your plugin, I could open the ipython terminal using my virtualenv in a splitted horizontal view and I'm grateful for that :-).
now, I would like to mimic the Python IDLE editor, and run the active buffer entirely, by pressing
F5
.I could not find what mapping nor the command I should use for that.
thanks a lot.
The text was updated successfully, but these errors were encountered: