litrepl : Markdown/LaTeX code section execution plugin
script karma |
Rating 7/3,
Downloaded by 480 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Sergei Mironov |
|
script type |
utility |
|
description |
This script interfaces the Litrepl tool which executes Markdown/LaTeX code snippets by forking standalone interpreters.
For instance, when entering `:LEval` on the following Python code snippet:
``` python
print("Hello!")
```
the contents of the next result section (which should also exist in the document) will be replaced with the string "Hello!" :
``` result
Hello!
```
In other words, this is a text-mode Jupyter Notebook with no custom JSONs or web-servers involved.
The interpreter will be running in the background waiting for new snippets to evaluate. By default, the
interpreter is shared among the files of the same directory. For LaTeX code section formatting, please
check the repository docs.
The supported code section labels and interpreters are:
* `python` sections - get redirected to the default `Python` or to the enhanced `IPython` interpreter
* `sh` sections - a Bourne Shell family of the interpreters, defaulting to the `/bin/sh`
* `ai` sections - a minimalistic `Aicli` interpreter for talking with AI language models
Command basics:
* `:LEval` - Evaluate the section under the cursor.
* `:LStatus` - Show the status of the interpreters.
* `:LRestart (python|sh|ai)` - Restart the background interpreter.
* `:LTerm (python|sh|ai)` - Attach to the interpreter using Vim terminal
Recently, several AI-related commands were introduced in `litrepl_extras.vim`, showcasing the power
of litrepl's session management capabilities. These commands require the third-party Aicli
interpreter where the GPT-4o model is set as default:
* `:LAICode` - Asks the AI model to revise a selected code snippet.
* `:LAIStyle` - Requests the AI to enhance the style of selected text.
* `:LAICont` - Asks the AI model to modify the previous AI-related change.
* `:LAITell` - Proceeds with the dialogue with the AI model within the Vim terminal.
These commands are built upon the base `LitReplAIQuery()` function. They can be seen as examples
demonstrating how you might create additional commands tailored to your project's needs.
|
|
install details |
1. Install the Litrepl tool using the Python's default package manager: `pip install litrepl`.
2. Unpack the plugin tarball and put `litrepl.vim` and `litrepl_extras.vim` into the `~/.vim/plugin` folder.
3. Optionally install socat tool using your system package manager, e.g. `sudo apt-get install socat`.
4. Optionally install Aicli interpreter by `pip install sm_aicli`. Create the suitable `.aicli` config setting
up a GPT-4o model as the default actor.
For other installation methods and additional options please visit https://github.com/sergei-mironov/litrepl
For details on the Aicli interpreter, check https://github.com/sergei-mironov/aicli
Note: Litrepl tool relies on POSIX OS interface and was tested on Linux only. The author is interested in getting
feedback from MacOS and WSL users! In any case, feel free to open Github issues. |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 18.97.9.168
|