Kakoune: Add a -client switch to open files in a specific client

Created on 24 Nov 2020  路  4Comments  路  Source: mawww/kakoune

Example

kak -c kanto -client main file.txt +25:1

This feature would be useful for [connect.kak] to avoid parsing the arg-list (see [:edit]) and for setting the EDITOR environment variable.

EDITOR='kak -c kanto -client main'

Related issues:

feature request

Most helpful comment

I imagine one issue is that piping to kak -p does not lend itself very well to setting EDITOR.

I am not keen to add -client but I think we could have nice alternative to kak -p, say kak -P (not necessarily the actual switch) that would forward its shell arguments as kakoune commands.

kak -P kanto -- eval -try-client main edit file.txt 25 1 would be equivalent to piping. This would also save one fork for the usual case (by avoiding the pipe) and make it easier to forward shell variables (as there is no need to kak-quote them).

All 4 comments

Why not use printf 'eval -try-client main "edit file.txt 25 1" | kak -p kanto? It doesn't look like a new CLI flag is necessary.

I imagine one issue is that piping to kak -p does not lend itself very well to setting EDITOR.

I am not keen to add -client but I think we could have nice alternative to kak -p, say kak -P (not necessarily the actual switch) that would forward its shell arguments as kakoune commands.

kak -P kanto -- eval -try-client main edit file.txt 25 1 would be equivalent to piping. This would also save one fork for the usual case (by avoiding the pipe) and make it easier to forward shell variables (as there is no need to kak-quote them).

edit is not compatible with EDITOR, as the command edits a single file and have a different syntax for setting the cursor position.

I noticed we have to expand each file to their absolute path to ensure Kakoune will open the correct files. It does matter when the server directory differs from the directory where we run the command.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lenormf picture lenormf  路  3Comments

vbauerster picture vbauerster  路  3Comments

lenormf picture lenormf  路  4Comments

radare picture radare  路  3Comments

dpc picture dpc  路  4Comments