Skip to content
Send selections to python while keeping history of previous commands
Branch: master
Clone or download
Latest commit f288e12 Jun 16, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information. Update Jun 16, 2019 Better exception handling, dropped dependency on code Jun 12, 2019
python.kak Add support for writing the output to a second fifo Jun 15, 2019

This bridge runs a python shell in the background and can send selections through the shell. This way you can do calculations while keeping memory of previous variables, so this enables you to use variables in later calculations.


Add this repository to your autoload dir: ~/.config/kak/autoload/.

Or via plug.kak:

plug 'JJK96/kakoune-python-bridge' %{
  # Suggested mapping
  map global normal = ': python-bridge-send<ret>'
  # run some python code initially
  python-bridge-send %{
from math import *


  1. Select a piece of text that can be interpreted by python, then run python-bridge-send.


  1. run :python-bridge-send expr where expr can be any python code.

This will automatically start the interpreter if it is not running. Then it will execute the code using python and return the output in place of the selection or using an info box for option 1 and 2 respectively

The interpreter will first try to run the code interactively line by line, if that fails, the whole code will be executed at once.

If python_bridge_fifo_enabled is set to true the output will also be written to a second fifo, for example to keep track of previous outputs.

set global option python_bridge_fifo_enabled true

The python interpreter will be shut down when the kakoune server is closed.


python-bridge-start Start the python bridge
python-bridge-stop Stop the python bridge
python-bridge-send Send the current selections through the python bridge


python_bridge_fifo_enabled Whether the output should be written to a second fifo (for keeping track of previous outputs)

You can’t perform that action at this time.