From bac8a5d2822835cf47175d1162030653fadd5c09 Mon Sep 17 00:00:00 2001 From: johannst Date: Thu, 15 Feb 2024 23:29:57 +0000 Subject: deploy: 4485708c972815bbb6df7f5a228683aa855d553d --- tools/zsh.html | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'tools/zsh.html') diff --git a/tools/zsh.html b/tools/zsh.html index acdc32f..e6ec715 100644 --- a/tools/zsh.html +++ b/tools/zsh.html @@ -198,11 +198,11 @@ $RBUFFER # Edit buffer content right to cursor # create zle widget which adds text right of the cursor function add-text() { - RBUFFER="some text $RBUFFER" + RBUFFER="some text $RBUFFER" } zle -N add-text -bindkey "^p" add-text +bindkey "^p" add-text

Parameter

Default value:

@@ -336,10 +336,10 @@ option should be stored.
#!/bin/zsh
 function test() {
     zparseopts -D -E -A opts f=flag o: -long:
-    echo "flag $flag"
-    echo "o    $opts[-o]"
-    echo "long $opts[--long]"
-    echo "pos  $1"
+    echo "flag $flag"
+    echo "o    $opts[-o]"
+    echo "long $opts[--long]"
+    echo "pos  $1"
 }
 
 test -f -o OPTION --long LONG_OPT POSITIONAL
@@ -361,9 +361,9 @@ The match results can be accessed via the $MATCH variable and
 
INPUT='title foo : 1234'
 REGEX='^title (.+) : ([0-9]+)$'
 if [[ $INPUT =~ $REGEX ]]; then
-    echo "$MATCH"       # title foo : 1234
-    echo "$match[1]"    # foo
-    echo "$match[2]"    # 1234
+    echo "$MATCH"       # title foo : 1234
+    echo "$match[1]"    # foo
+    echo "$match[2]"    # 1234
 fi
 

Completion

@@ -395,7 +395,7 @@ $words[CURRENT-1] # previous word (relative to cursor position)
function _foo() {
     local -a opts
@@ -436,16 +436,16 @@ function _foo_color() {
     colors+=('green:green color')
     colors+=('red:red color')
     colors+=('blue:blue color')
-    _describe "color" colors
+    _describe "color" colors
 }
 
 function _foo() {
     _arguments                              \
-        "-c[define color]:color:->s_color"  \
-        "-s[select sound]:sound:(low high)" \
-        "-f[select file]:file:_files"       \
-        "-d[select dir]:dir:_files -/"      \
-        "-h[help]"
+        "-c[define color]:color:->s_color"  \
+        "-s[select sound]:sound:(low high)" \
+        "-f[select file]:file:_files"       \
+        "-d[select dir]:dir:_files -/"      \
+        "-h[help]"
 
     case $state in
         s_color) _foo_color;;
@@ -459,9 +459,9 @@ arguments such as

function _foo() {
     _arguments              \
-        "1:opt 1:(a b c)"   \
-        ":opt next:(d e f)" \
-        "*:opt all:(u v w)"
+        "1:opt 1:(a b c)"   \
+        ":opt next:(d e f)" \
+        "*:opt all:(u v w)"
 }
 

Explanation:

-- cgit v1.2.3