Those of you that use Kakoune over SSH could give me some tips about your setup?
I’m thinking of things like making new and terminal commands work. And clipboard integration (if possible) would be a plus. And, obviously, any other clever trick you currently use and I couldn’t anticipate would be nice.
Regarding new, I don’t have tmux installed on the remote machine. Is there another way? More specifically, would it be possible to configure my remote Kakoune to communicate to my local Kitty to handle that?
Ow man so many questions I can’t answer. But when I’m editing remote I try to use mosh. It’s great for connections which aren’t rock solid (all of them here).
I haven’t personally used it myself, but I have heard a lot of good things about sshfs. It essentially allows for mounting a remote filesystem. That should allow you to use kitty with your local kakoune config. Apart from that, I don’t know how to help, but I would second harrts’ suggestion with mosh - it’s a lifesaver on unstable networks.
sshfs tends to not do great with lots of small files. I much prefer the experience of SSH over sshfs. Even using it locally (to a VM on the same machine) made it very slow.
One thing I discovered recently is the ControlMaster configuration option of ssh that allows to share a single connection for multiple sessions. This means ssh wont ask you for a password if you already have an active session, making opening a new client on the existing session faster (just ssh user@host kak -c session, no password asked, no connection delay).
I would love to find a way to have a terminal implementation that works through ssh (new uses terminal as a backend so we would get that for free), for this to work we would need the kakoune server running remotely to somehow launch a new terminal emulator on the local machine, I can think of a couple ways to achieve this:
Use a remote -> local ssh session, ControlMaster would help again here avoiding the need to enter a password, but that is not always practical (the local machine might not have a sshd)
Emit some escape sequence to notify the local terminal emulator to open a new client, this would be terminal emulator dependent, it looks like kitty and iterm2 could support that.
One think that puzzles me is that Kitty advertises in different places that many of its features work even over ssh, but don’t explain how can we use it. I’ve even found an issue in which someone asked for clarifications on this regard, but the answer from the developer wasn’t satisfatory.
No tips as such, but you could use a raspberry-pi as a server with a large thumb drive for storage and test, test, test or ‘use a [Docker] container terminal in a browser, attach to someone else’s terminal, and share control’ (Docker in Practice, p.32). Docker-Terminal: a terminal for Docker containers.
As you probably know SSH is the sledgehammer protocol as bypasses firewall and mounts an entire file system (cool, but very heavy). If your use case is just files not the traversal of an entire filesystem you could try Syncthing SSH Tunneling if firewall is the issue.
Read more here or here if you like. You can also get on board here. Ah nondescript here links, an internet bloggers gem (google analytics it’s all on you).
Side note: I actually got into an argument with another student over having to click reference links to do some research gathering as there was no search term box to enter a phrase into. It’s official, clicking links is just too damn hard work! Bye .
I have a remote development server on which I can’t install too many dependencies.
To get my local development environment while offloading work to the remote server I scp individual files for editing and have adjusted all other commands to run remotely (make, grep, git, repl, etc). This requires a lot of configuration but I am happy with the result. I get low-latency typing, my local kakoune setup/tooling, and offload any serious tasks to the server.
For commands to execute remotely, I have a project_host and project_path option that specify the current directory. Then I edit grep and the like to execute remotely. For example:
define-command -params .. -override -docstring %{
project_grep [<arguments>]: grep utility wrapper
All optional arguments are forwarded to the grep utility
Passing no argument will perform a literal-string grep for the current selection
} project_grep %{ evaluate-commands %sh{
if [ $# -eq 0 ]; then
case "$kak_opt_grepcmd" in
ag\ * | git\ grep\ * | grep\ * | rg\ * | ripgrep\ * | ugrep\ * | ug\ *)
set -- -F "${kak_selection}"
;;
ack\ *)
set -- -Q "${kak_selection}"
;;
*)
set -- "${kak_selection}"
;;
esac
fi
output=$(mktemp -d "${TMPDIR:-/tmp}"/kak-grep.XXXXXXXX)/fifo
mkfifo ${output}
if [ -z "${kak_opt_project_host}" ]
then
( { trap - INT QUIT; cd $kak_opt_project_path; ${kak_opt_grepcmd} "$@" 2>&1 | tr -d '\r' | awk -v var="${kak_opt_project_path}/" '{ print var $0}'; } > ${output} 2>&1 & ) > /dev/null 2>&1 < /dev/null
else
( { trap - INT QUIT; echo "cd $kak_opt_project_path; ${kak_opt_grepcmd} \"$@\" '.' " | ssh -t $kak_opt_project_host 2>&1 | tr -d '\r' | awk -v var="/ssh:${kak_opt_project_host}:${kak_opt_project_path}/" '{ print var $0}'; } > ${output} 2>&1 & ) > /dev/null 2>&1 < /dev/null
fi
printf %s\\n "evaluate-commands -try-client '$kak_opt_toolsclient' %{
edit! -fifo ${output} *grep*
set-option buffer filetype grep
set-option buffer jump_current_line 0
hook -always -once buffer BufCloseFifo .* %{ nop %sh{ rm -r $(dirname ${output}) } }
}"
}}
I don’t have a package published for any of this because it is a series of poorly scripted temporary fixes that became permanent for me.