jalvesaq / vimcmdline

Send code to command line interpreter
GNU General Public License v2.0
223 stars 38 forks source link

[prolog] consult/1 file when opening REPL #80

Closed yochem closed 2 years ago

yochem commented 5 years ago

Hi!

It would be nice to automatically consult the current file in the prolog REPL for testing the written code. You have to type consult('file.pl'). now everytime you want to open the repl for testing.

This option would be nice for every language, by the way.

jalvesaq commented 5 years ago

The support for prolog was added four years ago by @ahovgaard: https://github.com/jalvesaq/vimcmdline/commit/600021875206b883ee9417570d5f5bb1a591a60c

yochem commented 5 years ago

I know, but thank you for your answer. My question was if the current file can be loaded into the program, which makes it possible to run functions from the current file. With python:

test.py:

def hi(name):
    print(f'hi, {name}!')

Opening REPL with current version:

>>> hi('jalvesaq')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'hi' is not defined

What my idea would be:

>>> hi('jalvesaq')
hi, jalvesaq!

With python, this can be done with python3 -i test.py.

It would be an easy way to very quickly test the current file. I hope I've explained it well enough. Please tell me if you don't understand :)

jalvesaq commented 5 years ago

The problem is that the support for programming languages that I don't use depend on people who know both the other language and Vim Language to contribute code to vimcmdline. Even for languages that I eventually use, such as Python, I can only maintain code that reflects my own usage. For example, I can't fix issues with the integration of vimcmdline with either IPython or Jupyte because I don't use them. I'm sorry, but I have never used and I have no plans to use prolog.