You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/aliases.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,12 +62,16 @@ displaying all listed files and folders in a grid.
62
62
63
63
## Replacing Existing Commands Using Aliases
64
64
65
-
> Caution! When replacing commands it is best to "back up" the command first and avoid recursion error.
65
+
::: warning Caution!
66
+
When replacing commands it is best to "back up" the command first and avoid recursion error.
67
+
:::
66
68
67
69
How to back up a command like `ls`:
70
+
68
71
```nu
69
72
alias core-ls = ls # This will create a new alias core-ls for ls
70
73
```
74
+
71
75
Now you can use `core-ls` as `ls` in your nu-programming. You will see further down how to use `core-ls`.
72
76
73
77
The reason you need to use alias is because, unlike `def`, aliases are position-dependent. So, you need to "back up" the old command first with an alias, before re-defining it.
Copy file name to clipboardExpand all lines: book/custom_completions.md
+28-27Lines changed: 28 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,25 +138,25 @@ def my_commits [] {
138
138
}
139
139
```
140
140
141
-
> **Note**
142
-
>
143
-
> with the following snippet
144
-
>
145
-
> ```nu
146
-
> def my-command [commit: string@my_commits] {
147
-
> print $commit
148
-
> }
149
-
> ```
150
-
>
151
-
> be aware that, even though the completion menu will show you something like
152
-
>
153
-
> ```nu
154
-
> >_ my-command <TAB>
155
-
> 5c2464 Add .gitignore
156
-
> f3a377 Initial commit
157
-
> ```
158
-
>
159
-
> only the value, i.e. "5c2464" or "f3a377", will be used in the command arguments!
141
+
::: tip Note
142
+
With the following snippet:
143
+
144
+
```nu
145
+
def my-command [commit: string@my_commits] {
146
+
print $commit
147
+
}
148
+
```
149
+
150
+
... be aware that, even though the completion menu will show you something like
151
+
152
+
```nu
153
+
>_ my-command <TAB>
154
+
5c2464 Add .gitignore
155
+
f3a377 Initial commit
156
+
```
157
+
158
+
... only the value (i.e., "5c2464" or "f3a377") will be used in the command arguments!
159
+
:::
160
160
161
161
## External Completions
162
162
@@ -165,21 +165,22 @@ External completers can also be integrated, instead of relying solely on Nushell
165
165
For this, set the `external_completer` field in `config.nu` to a [closure](types_of_data.md#closures) which will be evaluated if no Nushell completions were found.
166
166
167
167
```nu
168
-
> $env.config.completions.external = {
169
-
> enable: true
170
-
> max_results: 100
171
-
> completer: $completer
172
-
> }
168
+
$env.config.completions.external = {
169
+
enable: true
170
+
max_results: 100
171
+
completer: $completer
172
+
}
173
173
```
174
174
175
175
You can configure the closure to run an external completer, such as [carapace](https://github.com/rsteube/carapace-bin).
176
176
177
-
When the closure returns unparsable json (e.g. an empty string) it defaults to file completion.
177
+
When the closure returns unparsable json (e.g., an empty string) it defaults to file completion.
178
178
179
179
An external completer is a function that takes the current command as a string list, and outputs a list of records with `value` and `description` keys, like custom completion functions.
180
180
181
-
> **Note**
182
-
> This closure will accept the current command as a list. For example, typing `my-command --arg1 <tab>` will receive `[my-command --arg1 " "]`.
181
+
::: tip Note
182
+
This closure will accept the current command as a list. For example, typing `my-command --arg1 <tab>` will receive `[my-command --arg1 " "]`.
183
+
:::
183
184
184
185
This example will enable carapace external completions:
Copy file name to clipboardExpand all lines: book/dataframes.md
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,10 +37,9 @@ Pandas](https://pandas.pydata.org/) commands. For the time being don't pay too
37
37
much attention to the [`Dataframe` commands](/commands/categories/dataframe.md). They will be explained in later
38
38
sections of this page.
39
39
40
-
> System Details: The benchmarks presented in this section were run using a
41
-
> Macbook with a processor M1 pro and 32gb of ram
42
-
>
43
-
> All examples were run on Nushell version 0.97 using `nu_plugin_polars 0.97`
40
+
::: tip System Details
41
+
The benchmarks presented in this section were run using a Macbook with a processor M1 pro and 32gb of ram. All examples were run on Nushell version 0.97 using `nu_plugin_polars 0.97`.
Copy file name to clipboardExpand all lines: book/variables.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,13 +59,11 @@ There are a couple of assignment operators used with mutable variables
59
59
|`/=`| Divides the variable by a value and makes the quotient its new value |
60
60
|`++=`| Appends a list or a value to a variable |
61
61
62
-
> **Note**
63
-
>
64
-
> 1.`+=`, `-=`, `*=` and `/=` are only valid in the contexts where their root operations
65
-
> are expected to work. For example, `+=` uses addition, so it can not be used for contexts
66
-
> where addition would normally fail
67
-
> 2.`++=` requires that either the variable **or** the argument is a
68
-
> list.
62
+
::: tip Note
63
+
64
+
1.`+=`, `-=`, `*=` and `/=` are only valid in the contexts where their root operations are expected to work. For example, `+=` uses addition, so it can not be used for contexts where addition would normally fail
65
+
2.`++=` requires that either the variable **or** the argument is a list.
0 commit comments