CRAG666 / code_runner.nvim

Neovim plugin.The best code runner you could have, it is like the one in vscode but with super powers, it manages projects like in intellij but without being slow
MIT License
539 stars 38 forks source link

Presumable bug with code segments prompting for user input and multiple terminals #17

Closed kqvanity closed 2 years ago

kqvanity commented 2 years ago

Hello, i'm currently facing two "issues" Firstly I have to press i every single time a piece of the code prompt the user for input . Like for instance if i have a python code with input function and run the whole file, then the terminal opens up but not place the cursor for input right away . Secondly every single time i run , a new terminal windows pops up , so i constantly have to close them to have just one . Can't it be just one terminal window with the option to clear the previous output or even leave the previous output , but all within one single terminal window ?

CRAG666 commented 2 years ago

First of all. None of the things you mention are problems. For the first point do this if you want any command to start in insert mode. example: "python3 % && :startinsert"

The second point occurs because the commands are oriented to terminals, that is to say that for each execution a new terminal is created, it would be interesting to use a single terminal for everything, it is probably a useful feature I will try to implement it over the weekend

kqvanity commented 2 years ago

First of all. None of the things you mention are problems. For the first point do this if you want any command to start in insert mode. example: "python3 % && :startinsert"

I've tried to substitute my filetype of the python property value with this "python3 % && :startinsert", i still had to press either i or a and additionally got prompted with this error /bin/bash: :startinsert: command not found Can i get to know where this rightfully place this command ?

it would be interesting to use a single terminal for everything, it is probably a useful feature I will try to implement it over the weekend

Thanks for considering that !

CRAG666 commented 2 years ago

"python": "python -u $fileName | :startinsert"

CRAG666 commented 2 years ago

you can add the mode = "startinsert" option to setup. That will make the terminal when you run a command start in mod insert https://github.com/CRAG666/code_runner.nvim/commit/1c9bd9e415bf202cf66831b41771d70b65a94a99

CRAG666 commented 2 years ago

@z0xyz pleace check README

kqvanity commented 2 years ago

you can add the mode = "startinsert" option to setup.

Thanks ! Insert mode works just fine right now !

kqvanity commented 2 years ago

I don't know if i should open a new issue to suggest a feature or continue with the current thread , but by tinkering with the configuration of the plugin , i've noticed that predefined variables lack additional ones like for instance a version of fileName and fileNameWithoutExt with an absolute path, which can be very convenient solution for compiling and running a file whilst being in another shell path . The current workaround for now is cd to dir then using other variables , or the concatenated variables $dir$fileNameWithoutExt .

CRAG666 commented 2 years ago

This is easy to answer, it was not my decision that it be so, in fact if you check the vscode plugin with the same name it behaves the same, so this plugin aims to make the migration from vscode to neovim as similar as possible. but if you want that behavior, modify yourself, make a pr and I will gladly accept it

kqvanity commented 2 years ago

Understandable. But How about code running without automatically saving or including the content of the current unsaved buffer ! does the equivalent VsCode extension have the same behavior ?

CRAG666 commented 2 years ago

yes I understand, but there are already many plugins with those characteristics to include this is to use some repl service which is really not very useful considering that it is normally used for debugging and well for debugging it is already dap and it is very good at this, but how I tell you I am open to live prs

CRAG666 commented 2 years ago

@z0xyz By the way I already solved the problem so I opened the issue so you could check if it is what you wanted and secondly if it is yes close this issue and open some others with features that could be useful. Remember that code runner aims to be as simple as possible without losing its usefulness. Greetings

kqvanity commented 2 years ago

code runner aims to be as simple as possible without losing its usefulness. Noted . Thanks for the time considering it .