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
* test(config): add more fields to the config file to test the new behavior
* feat(command): add more option fields to the commands struct to config the navigation key bindings
* feat(config): add more fields to the config object to read the navigation keybindings from the config file
* feat(tui): add a way to read the navigation keybindings rather than the constant values from tcell
* feat(root): add default keybindings to keep backward compatibility
* docs(readme): add documentation for the key bindings configuration
* chore(form): ignore key bindings field so dblab can enter in form mode
* fix: fix typo
* refactor: move non-navigation key bindings a level above on the KeyBinding structs
* docs(mkdocs): add key binding config documentation to the mkdocs
Key bindings can be configured through the `.dblab.yaml` file. There is a field called `keybindings` where key bindings can be modified. See the example to see the full list of the key bindings subject to change. The file shows the default values. The list of the available key bindings belongs to the [tcell](https://github.com/gdamore/tcell) library. Specifically, see the [KeyNames map](https://github.com/gdamore/tcell/blob/781586687ddb57c9d44727dc9320340c4d049b11/key.go#L83), for an accurate reference.
260
+
261
+
#### .dblab.yaml example
257
262
258
263
```yaml
259
264
database:
@@ -310,6 +315,17 @@ database:
310
315
ssh-pass: "password"
311
316
# should be greater than 0, otherwise the app will error out
312
317
limit: 50
318
+
keybindings:
319
+
run-query: 'Ctrl-Space'
320
+
structure: 'Ctrl-S'
321
+
indexes: 'Ctrl-I'
322
+
constraints: 'Ctrl-T'
323
+
clear-editor: 'Ctrl-D'
324
+
navigation:
325
+
up: 'Ctrl-K'
326
+
down: 'Ctrl-J'
327
+
left: 'Ctrl-H'
328
+
right: 'Ctrl-L'
313
329
```
314
330
315
331
Or for sqlite:
@@ -325,6 +341,8 @@ Only the `host` and `ssl` fields are optionals. `127.0.0.1` and `disable`, respe
325
341
326
342
## Navigation
327
343
344
+
The key bindings are now configurable, see [Key bindings configuration](#key-bindings-configuration) to learn how to replace existing key bindings. It's worth noting that key bindings are only configurable through the configuration file, there is no flags to do so. If you don't replace them through the configuration file, the information below remains the same, otherwise, just replace the new key binding with the existing information for the default one.
345
+
328
346
If the query panel is active, type the desired query and press <kbd>Ctrl+Space</kbd> to see the results on the rows panel below.
329
347
Otherwise, you might me located at the tables panel, then you can navigate by using the arrows <kbd>Up</kbd> and <kbd>Down</kbd> (or the keys <kbd>k</kbd> and <kbd>j</kbd> respectively). If you want to see the rows of a table, press <kbd>Enter</kbd>. To see the the schema of a table, locate yourself on the `rows` panel and press <kbd>Ctrl+S</kbd> to switch to the `structure` panel, then switch <kbd>Ctrl+S</kbd> to switch back.
330
348
The same can be achieved for the `constraints` view by pressing <kbd>Ctrl+F</kbd> to go back and forth between the `rows` and the `constraints` panels.
Copy file name to clipboardExpand all lines: docs/usage.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -265,7 +265,12 @@ dbladb --config
265
265
dblab --config --cfg-name "prod"
266
266
```
267
267
268
-
`.dblab.yaml` example:
268
+
#### Key bindings configuration
269
+
270
+
Key bindings can be configured through the `.dblab.yaml` file. There is a field called `keybindings` where key bindings can be modified. See the example to see the full list of the key bindings subject to change. The file shows the default values. The list of the available key bindings belongs to the [tcell](https://github.com/gdamore/tcell) library. Specifically, see the [KeyNames map](https://github.com/gdamore/tcell/blob/781586687ddb57c9d44727dc9320340c4d049b11/key.go#L83), for an accurate reference.
271
+
272
+
273
+
#### .dblab.yaml example
269
274
270
275
```{ .yaml .copy }
271
276
database:
@@ -322,6 +327,17 @@ database:
322
327
ssh-pass: "password"
323
328
# should be greater than 0, otherwise the app will error out
0 commit comments