hchbaw / zrv.zsh

# toy zle server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

toy zle server

Author: Takeshi Banse <takebi@laafc.net>

License: MIT

Thank you very much tarruda! I appreciate the zsh-autosuggestions’s codes a lot.

Usage

Please start a server by autoload and call zrv.

% tmux
(It is mandatory on the server side, sorry)
% git clone https://github.com/hchbaw/zrv.zsh.git
% fpath+="$(echo ${:-./zrv.zsh}(:A))"
% autoload -Uz zrv
% zrv

Typical client side’s code looks like below.

zrv-client () {
  local -i REPLY;
  setopt localoptions errreturn
  zmodload zsh/net/socket
  zsocket /tmp/zrv-${UID}/default
  print -u $REPLY "$1"
  exec {REPLY}>&- # Please don't forget to close this file descriptor.
}

Then, communicate to the zrv server.

% zrv-client "echo hi"
⇒ This sends "echo hi" to the server and the server evaluates it.
% zrv-client "sleep 5
echo hihi"
⇒ This sends these commands and the server evaluates each line one-by-one.

About

# toy zle server

License:MIT License