kakounedotcom / connect.kak

Connect a program to Kakoune clients
https://kakoune.org
The Unlicense
88 stars 18 forks source link

add connect-repl #34

Closed listentolist closed 3 years ago

alexherbo2 commented 3 years ago

How connect.kak can leverage the use of a REPL?

listentolist commented 3 years ago

When working on a script that uses connect.kak it is useful to be able to test parts of it by sending it to a connected REPL. It would be just convenient if I can simply use the repl-send-text command for that. Furthermore when having a connected terminal one can edit a long command in a scratch buffer and send it to the terminal.

alexherbo2 commented 3 years ago

But when you use the REPL, you use the connect.kak’s features?

listentolist commented 3 years ago

Yes. For example when writing a plugin that uses connect.kak commands I can run connect-repl bash in Kakoune and interactively test parts of it by sending a selection to the connected REPL.

alexherbo2 commented 3 years ago

I hesitate to merge it. We have the > (connect-terminal) and $ (connect-shell) commands. I would like to unify the implementations and make a connected terminal or program a REPL at any time.

alexherbo2 commented 3 years ago

@listentolist Can you test the latest commit 5ad59e5201d21ac1221be7c373bd25623efe8337 and implementation?

listentolist commented 3 years ago

Thank you! connect repl-new works as expected.

alexherbo2 commented 3 years ago

Very happy with that.

We can now use the explicit:

connect tmux-terminal-horizontal

and all other flavors.

useredsa commented 3 years ago

Yes. For example when writing a plugin that uses connect.kak commands I can run connect-repl bash in Kakoune and interactively test parts of it by sending a selection to the connected REPL.

I was also using it a lot. As a repl for bash scripts for example. :fifo is just great. Also as a connected repl for compilation: $(:get %opt{makecmd}) `:it`

alexherbo2 commented 3 years ago

I’ve added the @ (think kitty’s REPL) command, alongside the + popup command.

Example – Open a connected Janet REPL:

@ janet

Example – Open files with fzf in a popup window:

+ :fzf
useredsa commented 3 years ago

I’ve added the @ (think kitty’s REPL) command, alongside the + popup command.

Example – Open a connected Janet REPL:

@ janet

Example – Open files with fzf in a popup window:

+ :fzf

Default popup handling is very nice. I had this in my kakrc:

    define-command fzf-files -override -params .. -file-completion -docstring 'Open files with fzf' %{
        terminal-set global kitty kitty-terminal-tab kitty-focus
        > :fzf-files %arg{@}
        terminal-set global x11 x11-terminal x11-focus
    }
    define-command fzf-buffers -override -params ..1 -buffer-completion -docstring 'Open buffers with fzf' %{
        terminal-set global kitty kitty-terminal-tab kitty-focus
        > :fzf-buffers %arg{@}
        terminal-set global x11 x11-terminal x11-focus
    }

Connected repls are also useful.