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
|**mappings**|`table`|| A table of key mappings for different modes. Each mode (like 'i' for insert mode, 'n' for normal mode) is a key in the table and maps to another table, where the key is the key combination (e.g., "<CR>") and the value is a table with the fields 'action' and 'exit_on_action'. The 'action' field is a function that will be called when the key combination is pressed, and 'exit_on_action' is a boolean that determines whether telescope should be exited after the action is performed. See Mappings for more info. |
86
+
|**mappings**|`table`|| A table of key mappings for different modes. Each mode (`i` for insert mode, `n` for normal mode) is a key in the table and maps to another table, where the key is the key combination (e.g., "<C-r>") and the value is a table with the fields `action` and `exit_on_action`. The `action` field is a function that will be called when the key combination is pressed, and `exit_on_action` is a boolean that determines whether telescope should be exited after the action is performed. See [Mappings](https://github.com/ryanmsnyder/toggleterm-manager.nvim/blob/readme/README.md#mappings) for more info. |
79
87
|**telescope_titles.preview**|`string`| "Preview" | Title of the preview buffer in telescope. Any string. |
80
88
|**telescope_titles.prompt**|`string`| " Pick Term" | Title of the prompt buffer in telescope. Any string. |
81
89
|**telescope_titles.results**|`string`| "Results" | Title of the results buffer in telescope. Any string. |
@@ -111,17 +119,71 @@ Note that each key in the table should correspond to the NeoVim mode that the ma
111
119
112
120
#### Actions
113
121
114
-
There are six pre-built actions that can be mapped to key bindings within the telescope window.
122
+
There are six pre-defined actions that can be mapped to key bindings within the telescope window.
123
+
124
+
> **Floating toggleterm windows:** When configuring `toggleterm` (not `toggleterm-manager`), there is a property called `direction`, which takes a value of `horizontal`, `vertical`, or `float`. Some of the actions behave differently if `direction = float`. This is because of how NeoVim handles floating windows. Telescope is already a floating window so if, for example, `direction = float`, and the `create_term` action is called with `exit_on_action = false`, there would normally be a flash caused by opening a `toggleterm` float and switching back to telescope really fast. To prevent this, the `toggleterm` window will be created as a `hidden` terminal. Note that the `open_mapping` in `toggleterm` config won't be able to toggle these terminals open/closed.
125
+
126
+
The below table displays the behavior of each action in `actions/init.lua` given different values for `exit_on_action` and `toggleterm`'s' `direction` property that's passed to its [`setup`](https://github.com/akinsho/toggleterm.nvim#setup) function.
<td>Create a <i>hidden</i> terminal and name it</td>
153
+
<td>Create and name a new terminal</td>
154
+
</tr>
155
+
<tr>
156
+
<td><code>rename_term</code></td>
157
+
<td>Rename and focus the terminal if open</td>
158
+
<td>Rename and focus the terminal if open</td>
159
+
<td>Rename the terminal</td>
160
+
<td>Rename the terminal</td>
161
+
</tr>
162
+
<tr>
163
+
<td><code>open_term</code></td>
164
+
<td>Open and focus the terminal</td>
165
+
<td>Open and focus the terminal</td>
166
+
<td>Nothing will happen</td>
167
+
<td>Open the terminal</td>
168
+
</tr>
169
+
<tr>
170
+
<td><code>toggle_term</code></td>
171
+
<td>Toggle terminal open or closed, focus if open</td>
172
+
<td>Toggle terminal open or closed, focus if open</td>
173
+
<td>Toggle terminal open or closed</td>
174
+
<td>Toggle terminal open or closed</td>
175
+
</tr>
176
+
<tr>
177
+
<td><code>delete_term</code></td>
178
+
<td>Delete the terminal</td>
179
+
<td>Delete the terminal</td>
180
+
<td>Delete the terminal</td>
181
+
<td>Delete the terminal</td>
182
+
</tr>
183
+
</table>
184
+
115
185
116
-
-`create_term`: Create a new terminal and open it. If `exit_on_action = true`, focus it. If `toggleterm`'s direction is `float` and `exit_on_action = false`, create a hidden terminal.
117
-
-`create_and_name_term`: Create and name a new terminal and open it. If `exit_on_action = true`, focus it. If `toggleterm`'s direction is `float` and `exit_on_action = false`, create a hidden terminal. The name will be reflected in the `term_name` field if it's provided in `results.field`.
118
-
-`rename_term`: Rename a terminal. If `exit_on_action = true` and the terminal is open, focus it. The name will be reflected in the `term_name` field if it's provided in `results.field`.
119
-
-`open_term`: Open a terminal. If `exit_on_action = true`, focus it. If `exit_on_action = false` and `toggleterm`'s direction is `float`, this action won't do anything.
120
-
-`toggle_term`: Toggle a terminal open or closed. If toggling open and `exit_on_action = true`, focus it.
121
-
-`delete_term`: Delete a terminal.
122
186
123
-
> [!Floating toggleterm windows]
124
-
> When configuring `toggleterm` (not `toggleterm-manager`), there is a property called `direction`, which takes a value of `horizontal`, `vertical`, or `float`. Some of the actions behave differently if `direction` is `float`. This is because of how NeoVim handles floating windows. Telescope is already a floating window so if, for example, `direction` is set to `float`, and the `create_term` action is called with `exit_on_action = false`, there would normally be a flash caused by opening a `toggleterm` float and switching back to telescope really fast. To prevent this, the `toggleterm` window will be created as a `hidden` terminal. Note that the `open_mapping` in `toggleterm` config won't be able to toggle these terminals open/closed.
125
187
126
188
#### Custom Actions
127
189
@@ -156,6 +218,8 @@ The background and foreground colors of the results fields can also be customize
156
218
157
219
#### Examples
158
220
221
+
Example of only providing fields (no highlight groups). When a highlight group is not specified for a field, `toggleterm-manager` chooses the highlight group:
Example of providing highlight groups for some fields and not for others. When a highlight group is paired with a field in a table, that highlight group overrides the default that `toggleterm-manager` chooses.
0 commit comments