aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorJames Cash <james.nvc@gmail.com>2020-08-17 14:27:33 -0400
committerJames N. V. Cash <james.nvc@gmail.com>2020-08-21 12:59:21 -0400
commit0a1178d5e14fa561cd11cd456279136ea452624d (patch)
tree0006150168c6bd28f9b402a38daec71f44b731e7 /README.md
parent797357bf65952337627f2d0c594c2fef600aafae (diff)
Add implementation of vterm_cmd helper for fish
Diffstat (limited to 'README.md')
-rw-r--r--README.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/README.md b/README.md
index d206320..de5e04f 100644
--- a/README.md
+++ b/README.md
@@ -486,6 +486,8 @@ The commands that are understood are defined in the setting `vterm-eval-cmds`.
As `split-string-and-unquote` is used the parse the passed string, double quotes
and backslashes need to be escaped via backslash. A convenient shell function to
automate the substitution is
+
+`bash` or `zsh`:
```sh
vterm_cmd() {
local vterm_elisp
@@ -497,6 +499,17 @@ vterm_cmd() {
vterm_printf "51;E$vterm_elisp"
}
```
+`fish`:
+```sh
+function vterm_cmd --description 'Run an emacs command that\'s been defined in vterm-eval-cmds'
+ set -l vterm_elisp ()
+ for arg in $argv
+ set -a vterm_elisp (printf '"%s" ' (string replace -a -r '([\\\\"])' '\\\\\\\\$1' $arg))
+ end
+ vterm_printf '51;E'(string join '' $vterm_elisp)
+end
+```
+
Now we can write shell functions to call the ones defined in `vterm-eval-cmds`.
```sh