|
1 | | -*luasnip.txt* For NVIM v0.5.0 Last change: 2022 September 28 |
| 1 | +*luasnip.txt* For NVIM v0.5.0 Last change: 2022 October 08 |
2 | 2 |
|
3 | 3 | ============================================================================== |
4 | 4 | Table of Contents *luasnip-table-of-contents* |
@@ -1049,6 +1049,31 @@ is only a short outline, their usage is shown more expansively in |
1049 | 1049 | < |
1050 | 1050 |
|
1051 | 1051 |
|
| 1052 | + |
| 1053 | +- `conditions.show`: Contains typical predicats/functions used as |
| 1054 | + `show`-condition. Currently this is just `line_end` |
| 1055 | +- `conditions.expand`: Contains typical predicats/functions used as |
| 1056 | + `expand`-condition. Currently this is just `line_begin` Contains everything |
| 1057 | + from `conditions.show` as well. |
| 1058 | +- `conditions`: Provides a function `make_condition(foo)` which takes a function |
| 1059 | + as argument and returns a _condition object_ for which several operators are |
| 1060 | + defined: |
| 1061 | + - `c1 + c2 -> c1 or c2` |
| 1062 | + - `c1 * c2 -> c1 and c2` |
| 1063 | + - `-c1 -> not c1` |
| 1064 | + - `c1 ^ c2 -> c1 xor/!= c2` |
| 1065 | + - `c1 % c2 -> c1 xnor/== c2`: This decision may look weird but as we weren’t |
| 1066 | + able to use `==`, we decided to take something that makes one scratch ones |
| 1067 | + head (and thus avoid making false assumptions). |
| 1068 | + For more details look at this comment <https://github.com/L3MON4D3/LuaSnip/pull/612#issuecomment-1264487743>. |
| 1069 | + `conditions.show`s and `conditions.expand`s members all are also condition |
| 1070 | + objects so you can work with those too. |
| 1071 | + Thus you can easily combine existing predicats. Like in |
| 1072 | + `conditions.expand.line_end + conditions.expand.line_begin` instead of doing |
| 1073 | + something like `function(...) return conditions.expand.line_end(...) or |
| 1074 | + conditions.expand.line_begin(...) end`. |
| 1075 | + |
| 1076 | + |
1052 | 1077 | FMT *luasnip-fmt* |
1053 | 1078 |
|
1054 | 1079 | `require("luasnip.extras.fmt").fmt` can be used to create snippets in a more |
|
0 commit comments