visidata 3.0.1__py3-none-any.whl → 3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. visidata/__init__.py +12 -10
  2. visidata/_input.py +208 -199
  3. visidata/_open.py +4 -1
  4. visidata/_types.py +4 -3
  5. visidata/aggregators.py +88 -39
  6. visidata/apps/vdsql/_ibis.py +9 -11
  7. visidata/apps/vdsql/clickhouse.py +2 -2
  8. visidata/apps/vdsql/snowflake.py +1 -1
  9. visidata/apps/vgit/status.py +1 -1
  10. visidata/basesheet.py +11 -4
  11. visidata/canvas.py +66 -24
  12. visidata/clipboard.py +13 -6
  13. visidata/cliptext.py +7 -6
  14. visidata/cmdlog.py +40 -27
  15. visidata/column.py +14 -49
  16. visidata/ddw/regex.ddw +3 -2
  17. visidata/deprecated.py +14 -2
  18. visidata/desktop/visidata.desktop +2 -2
  19. visidata/editor.py +1 -0
  20. visidata/errors.py +1 -1
  21. visidata/experimental/sort_selected.py +54 -0
  22. visidata/expr.py +69 -18
  23. visidata/features/change_precision.py +1 -3
  24. visidata/features/cmdpalette.py +23 -4
  25. visidata/features/colorsheet.py +1 -1
  26. visidata/features/dedupe.py +3 -3
  27. visidata/features/go_col.py +71 -0
  28. visidata/features/graph_seaborn.py +1 -1
  29. visidata/features/join.py +20 -10
  30. visidata/features/layout.py +18 -5
  31. visidata/features/ping.py +16 -12
  32. visidata/features/regex.py +5 -5
  33. visidata/features/slide.py +15 -17
  34. visidata/features/status_source.py +3 -1
  35. visidata/features/sysedit.py +1 -1
  36. visidata/features/transpose.py +2 -1
  37. visidata/features/type_ipaddr.py +2 -4
  38. visidata/features/unfurl.py +1 -0
  39. visidata/form.py +2 -2
  40. visidata/freqtbl.py +16 -11
  41. visidata/fuzzymatch.py +1 -0
  42. visidata/graph.py +173 -12
  43. visidata/guide.py +61 -25
  44. visidata/guides/ClipboardGuide.md +48 -0
  45. visidata/guides/ColumnsGuide.md +52 -0
  46. visidata/guides/CommandsSheet.md +28 -0
  47. visidata/guides/DirSheet.md +34 -0
  48. visidata/guides/ErrorsSheet.md +17 -0
  49. visidata/guides/FrequencyTable.md +42 -0
  50. visidata/guides/GrepSheet.md +28 -0
  51. visidata/guides/JsonSheet.md +38 -0
  52. visidata/guides/MacrosSheet.md +19 -0
  53. visidata/guides/MeltGuide.md +52 -0
  54. visidata/guides/MemorySheet.md +7 -0
  55. visidata/guides/MenuGuide.md +26 -0
  56. visidata/guides/ModifyGuide.md +38 -0
  57. visidata/guides/PivotGuide.md +71 -0
  58. visidata/guides/RegexGuide.md +107 -0
  59. visidata/guides/SelectionGuide.md +44 -0
  60. visidata/guides/SlideGuide.md +26 -0
  61. visidata/guides/SortGuide.md +0 -0
  62. visidata/guides/SplitpaneGuide.md +15 -0
  63. visidata/guides/TypesSheet.md +43 -0
  64. visidata/guides/XsvGuide.md +36 -0
  65. visidata/help.py +6 -6
  66. visidata/hint.py +2 -1
  67. visidata/indexsheet.py +2 -2
  68. visidata/interface.py +13 -14
  69. visidata/keys.py +4 -1
  70. visidata/loaders/api_airtable.py +1 -1
  71. visidata/loaders/archive.py +1 -1
  72. visidata/loaders/csv.py +9 -5
  73. visidata/loaders/eml.py +11 -6
  74. visidata/loaders/f5log.py +1 -0
  75. visidata/loaders/fec.py +18 -42
  76. visidata/loaders/fixed_width.py +19 -3
  77. visidata/loaders/grep.py +121 -0
  78. visidata/loaders/html.py +1 -0
  79. visidata/loaders/http.py +6 -1
  80. visidata/loaders/json.py +22 -4
  81. visidata/loaders/jsonla.py +8 -2
  82. visidata/loaders/mailbox.py +1 -0
  83. visidata/loaders/markdown.py +25 -6
  84. visidata/loaders/msgpack.py +19 -0
  85. visidata/loaders/npy.py +0 -1
  86. visidata/loaders/odf.py +18 -4
  87. visidata/loaders/orgmode.py +1 -1
  88. visidata/loaders/rec.py +6 -4
  89. visidata/loaders/sas.py +11 -4
  90. visidata/loaders/scrape.py +0 -1
  91. visidata/loaders/texttables.py +2 -0
  92. visidata/loaders/tsv.py +24 -7
  93. visidata/loaders/unzip_http.py +127 -3
  94. visidata/loaders/vds.py +4 -0
  95. visidata/loaders/vdx.py +1 -1
  96. visidata/loaders/xlsx.py +5 -0
  97. visidata/loaders/xml.py +2 -1
  98. visidata/macros.py +14 -31
  99. visidata/main.py +20 -15
  100. visidata/mainloop.py +17 -6
  101. visidata/man/vd.1 +74 -39
  102. visidata/man/vd.txt +73 -41
  103. visidata/memory.py +16 -5
  104. visidata/menu.py +14 -3
  105. visidata/metasheets.py +5 -6
  106. visidata/modify.py +4 -4
  107. visidata/mouse.py +2 -0
  108. visidata/movement.py +14 -28
  109. visidata/optionssheet.py +3 -5
  110. visidata/path.py +59 -37
  111. visidata/pivot.py +8 -5
  112. visidata/pyobj.py +63 -9
  113. visidata/rename_col.py +18 -1
  114. visidata/save.py +16 -9
  115. visidata/search.py +4 -4
  116. visidata/selection.py +10 -56
  117. visidata/settings.py +37 -35
  118. visidata/sheets.py +189 -118
  119. visidata/shell.py +23 -14
  120. visidata/sidebar.py +71 -16
  121. visidata/sort.py +21 -6
  122. visidata/statusbar.py +42 -5
  123. visidata/stored_list.py +5 -2
  124. visidata/tests/conftest.py +1 -0
  125. visidata/tests/test_commands.py +9 -1
  126. visidata/tests/test_completer.py +18 -0
  127. visidata/tests/test_edittext.py +3 -2
  128. visidata/text_source.py +7 -4
  129. visidata/textsheet.py +20 -6
  130. visidata/themes/ascii8.py +9 -6
  131. visidata/themes/asciimono.py +14 -4
  132. visidata/threads.py +13 -3
  133. visidata/tuiwin.py +5 -1
  134. visidata/type_currency.py +1 -2
  135. visidata/type_date.py +6 -1
  136. visidata/undo.py +10 -13
  137. visidata/utils.py +9 -3
  138. visidata/vdobj.py +21 -1
  139. visidata/wrappers.py +9 -1
  140. {visidata-3.0.1.data → visidata-3.1.data}/data/share/applications/visidata.desktop +2 -2
  141. {visidata-3.0.1.data → visidata-3.1.data}/data/share/man/man1/vd.1 +74 -39
  142. {visidata-3.0.1.data → visidata-3.1.data}/data/share/man/man1/visidata.1 +74 -39
  143. {visidata-3.0.1.dist-info → visidata-3.1.dist-info}/METADATA +33 -5
  144. visidata-3.1.dist-info/RECORD +284 -0
  145. visidata-3.0.1.dist-info/RECORD +0 -258
  146. {visidata-3.0.1.data → visidata-3.1.data}/scripts/vd +0 -0
  147. {visidata-3.0.1.data → visidata-3.1.data}/scripts/vd2to3.vdx +0 -0
  148. {visidata-3.0.1.dist-info → visidata-3.1.dist-info}/LICENSE.gpl3 +0 -0
  149. {visidata-3.0.1.dist-info → visidata-3.1.dist-info}/WHEEL +0 -0
  150. {visidata-3.0.1.dist-info → visidata-3.1.dist-info}/entry_points.txt +0 -0
  151. {visidata-3.0.1.dist-info → visidata-3.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,42 @@
1
+ # Frequency Tables are how you GROUP BY
2
+
3
+ Frequency Tables group rows into bins by column value, and includes summary columns for source columns with aggregators.
4
+
5
+ Set `--numeric-binning` to bin numeric rows into ranges instead of discrete values.
6
+
7
+ - {help.commands.freq_col}
8
+
9
+ - {help.commands.freq_keys}
10
+
11
+ - {help.commands.freq_summary}
12
+
13
+ ## Aggregators
14
+
15
+ A **Frequency Table** contains a summary columns for each aggregator added to a source column.
16
+ These aggregators need to be added before creating the Frequency Table.
17
+ Examples of aggregators include min, max, sum, distinct, count, and list.
18
+
19
+ - {help.commands.aggregate-col}
20
+
21
+ Note: set an appropriate type for the aggregator target column, for example {help.commands.type_float}.
22
+
23
+ ## Explore the data
24
+
25
+ Dive into a group to see the underlying row(s) using the **Frequency Table**:
26
+
27
+ - {help.commands.open_row}
28
+ - {help.commands.dive_selected}
29
+
30
+ Select a group to select all of its underlying rows in the source sheet.
31
+
32
+ ## Using Split Panes with Frequency Tables
33
+
34
+ Press `Shift+Z` to open a split pane, and then `Shift+F` to create a **Frequency Table**. The **Frequency Table** will automatically open in the other pane.
35
+
36
+ See the `SplitpanesGuide` for more.
37
+
38
+ #### Options
39
+
40
+ - {help.options.disp_histogram}
41
+ - {help.options.histogram_bins}
42
+ - {help.options.numeric_binning}
@@ -0,0 +1,28 @@
1
+ ---
2
+ sheettype: GrepSheet
3
+ ---
4
+
5
+ # Using grep sheet
6
+
7
+ The **GrepSheet** allows you to examine output of grep-like tools for line search.
8
+ The typical way to use it would be:
9
+ grep -H -n pat file1 file2 | vd -f grep
10
+ You can also load from a saved file ending in .grep:
11
+ grep -H -n pat file1 file2 > out.grep; vd -f grep out.grep
12
+
13
+ **GrepSheet** works with other grep-like searchers, like the best-in-class ripgrep:
14
+ rg --sort path --json pat file1 file2 | vd -f grep
15
+ or git-grep:
16
+ git grep -n class | vd -f grep
17
+
18
+ ## Editing files by pressing Enter
19
+
20
+ - {help.commands.sysopen_row}
21
+
22
+ If the file path is relative to a different directory from the current
23
+ directory, use [:code]options.grep_base_dir[/] to specify the base directory
24
+ for all relative paths. `$EDITOR` is a set environment variable.
25
+
26
+ ## Options to control GrepSheet behavior
27
+
28
+ - {help.options.grep_base_dir}
@@ -0,0 +1,38 @@
1
+ # Some special features for JSON
2
+
3
+ ## Working with nested data
4
+
5
+ VisiData uses these conventions to display nested data:
6
+
7
+ - {{2}} indicates a nested object with 2 keys
8
+ - [3] indicates a nested array with 3 elements
9
+
10
+ [:note_type]Expanding[/] unpacks nested data column-wise, often useful for nested objects:
11
+
12
+ - {help.commands.expand-col}
13
+ - {help.commands.expand-col-depth}
14
+ - {help.commands.expand-cols}
15
+ - {help.commands.expand-cols-depth}
16
+
17
+ To revert earlier `expand-` operations:
18
+
19
+ - {help.commands.contract-col}
20
+ - {help.commands.contract-col-depth}
21
+ - {help.commands.contract-cols}
22
+ - {help.commands.contract-cols-depth}
23
+
24
+ [:note_type]Unfurling[/] unpacks nested data row-wise, often useful for nested arrays:
25
+
26
+ - {help.commands.unfurl-col}
27
+
28
+ Note that `unfurl-col` creates a new sheet with `_unfurled` appended to the name. There is no command to revert an unfurl; instead, quit the unfurled sheet.
29
+
30
+ For particularly deep or complex nested data, it can be helpful to open an individual cell as a new sheet:
31
+
32
+ - {help.commands.open-cell}
33
+
34
+ ## Options to control JSON save behavior
35
+
36
+ - {help.options.json_indent}
37
+ - {help.options.json_sort_keys}
38
+ - {help.options.json_ensure_ascii}
@@ -0,0 +1,19 @@
1
+ # Macros
2
+ Macros allow you to bind a command sequence to a keystroke or longname, to replay when that keystroke is pressed or the command is executed by longname.
3
+
4
+ The basic usage is:
5
+ 1. {help.commands.macro_record}.
6
+ 2. Execute a series of commands.
7
+ 3. `m` again to complete the recording, and prompt for the keystroke or longname to bind it to.
8
+
9
+ The macro will then be executed everytime the provided keystroke or longname are used. Note: the Alt+keys and the function keys are left unbound; overriding other keys may conflict with existing bindings, now or in the future.
10
+
11
+ Executing a macro will the series of commands starting on the current row and column on the current sheet.
12
+
13
+ # The Macros Sheet
14
+
15
+ - {help.commands.macro_sheet}
16
+
17
+ - `d` (`delete-row`) to mark macros for deletion
18
+ - {help.commands.commit_sheet}
19
+ - `Enter` (`open-row`) to open the macro in the current row, and view the series of commands composing it'''
@@ -0,0 +1,52 @@
1
+ ---
2
+ sheettype: Sheet
3
+ ---
4
+ # Melt is just unpivot
5
+
6
+ Melt collapses the pivoted columns back into "Variable" and "Value" columns, converting from "wide" format into "long" format. After a melt, there is one row for each value in the pivot table.
7
+
8
+ 1. [Optional] remove a column from the output by hiding it: [:keys]-[/]
9
+ 2. [Optional] set key columns to keep them unmelted: [:keys]![/]
10
+
11
+ 3a. {help.commands.melt}
12
+
13
+ A regex melt partially melts the pivoted columns. Provide a regular expression to separate the key column from other columns.
14
+
15
+ 3b. {help.commands.melt_regex}
16
+
17
+ ## Examples
18
+
19
+ Start with a pivot table, created by pivoting a table with columns `R`,`B`, and key column `date`. There are two aggregators `sum` and `mean`:
20
+
21
+ date sum_R mean_R sum_B mean_B
22
+ ---------- ----- ------ ----- ------
23
+ 2024-09-01 30 30 0
24
+ 2024-09-02 0 28 28
25
+ 2024-09-03 100 100 132 66
26
+
27
+ Press `Shift+M` for a standard melt:
28
+
29
+ date Variable Value
30
+ ---------- -------- -----
31
+ 2024-09-01 sum_R 30
32
+ 2024-09-01 mean_R 30
33
+ 2024-09-01 sum_B 0
34
+ 2024-09-02 sum_R 0
35
+ 2024-09-02 sum_B 28
36
+ 2024-09-02 mean_B 28
37
+ 2024-09-03 sum_R 100
38
+ 2024-09-03 mean_R 100
39
+ 2024-09-03 sum_B 132
40
+ 2024-09-03 mean_B 66
41
+
42
+ Or press `gShift+M` and then type a `regex` of `(\w+)_(\w)` to separate the aggregator from the column. Only the aggregator will be fully melted. The columns `R` and `B` will remain:
43
+
44
+ date Variable B R
45
+ ---------- -------- --- ---
46
+ 2024-09-01 sum 0 30
47
+ 2024-09-01 mean 30
48
+ 2024-09-02 sum 28 0
49
+ 2024-09-02 mean 28
50
+ 2024-09-03 sum 132 100
51
+ 2024-09-03 mean 66 100
52
+
@@ -0,0 +1,7 @@
1
+ # The Memory Sheet
2
+
3
+ The **MemorySheet** provides a place to manually save cell values for later reference. It also automatically stores clipboard data when rows, cells or columns are copied.
4
+
5
+ - {help.commands.memo_cell}
6
+ - {help.commands.memo_aggregate}
7
+ - {help.commands.open_memos}
@@ -0,0 +1,26 @@
1
+ # The Menu System
2
+
3
+ The menu (on the first row of the window) contains most commands, organized within a tree of submenus.
4
+
5
+ Click on menu items to navigate the menu like a GUI.
6
+
7
+ With the keyboard:
8
+
9
+ - {help.commands.menu_help}
10
+ - [:keys]Arrow[/] keys to move between submenus
11
+
12
+ Additionally, each top-level menu name has a single letter underlined. [:keys]Alt+<underlined letter>[/] to open that menu. For example, [:keys]Alt+F[/] to open the **File** menu.
13
+
14
+ Each non-submenu item is a command. It shows the description of the current command, along with the command name and its keyboard shortcut (if available). Click on the item or [:keys]Enter[/] to execute it.
15
+
16
+ Indicators:
17
+
18
+ - {help.options.disp_menu_more}
19
+ - {help.options.disp_menu_push}
20
+ - {help.options.disp_menu_input}
21
+
22
+ Some commands are only available on a specific sheet type, and appear [:color_menu_spec]highlighted[/] in the menu when the current sheet is that type. If the command is not available, it will not appear at all.
23
+
24
+ ## Options
25
+
26
+ - {help.options.disp_menu}
@@ -0,0 +1,38 @@
1
+ # Adding, Editing, Deleting Rows
2
+
3
+ In addition to cutting and pasting (see **Clipboard Guide**), rows can be created from scratch, edited and deleted.
4
+
5
+ - {help.commands.add-row}
6
+ - {help.commands.add-rows}
7
+
8
+ - {help.commands.delete-row}
9
+ - {help.commands.delete-selected}
10
+
11
+ - {help.commands.sysedit-selected}
12
+ - {help.commands.edit_cell}
13
+
14
+ While editing a cell, press `Ctrl+G` to cycle through the sidebar guides to see the **Input Keystroke Help**.
15
+
16
+ A sample of available commands:
17
+ - [:code]Ctrl+O[/] to edit the cell in a text editor.
18
+ - [:code]Tab[/] to finish editing and go to the next cell
19
+ - [:code]Shift+Tab[/] to finish editing and go to the previous cell
20
+
21
+ Modifying a sheet displays a `[M]` in the lower right status.
22
+
23
+ ## Deferred Sheets
24
+
25
+ Some sheet types support *deferred* saving. Examples include **SQLiteSheet** and **Dir Sheet**. Changes are colored for [:add_pending]added rows[/], [:delete_pending]deleted rows[/], [:change_pending]modified cells[/].
26
+
27
+ Commit the sheet to reflect changes on the filesystem.
28
+
29
+ - {help.commands.commit_sheet}
30
+
31
+ ### Relevant options
32
+
33
+ - {help.options.quitguard}
34
+
35
+ - {help.options.color_add_pending}
36
+ - {help.options.color_delete_pending}
37
+ - {help.options.color_change_pending}
38
+
@@ -0,0 +1,71 @@
1
+ ---
2
+ sheet: PivotSheet
3
+ ---
4
+ # Pivot Tables are just Frequency Tables with more columns
5
+
6
+ Pivot Tables group rows by key columns, summarizing aggregated columns for each distinct value in the current column.
7
+
8
+ See the **MeltGuide** to unpivot.
9
+
10
+ ## Create a Pivot Table
11
+
12
+ 1. Set the primary column(s) as *key columns*. The values in this column will appear along the left side as row headings, and will be the values the dataset is grouped by.
13
+
14
+ - {help.commands.key_col}
15
+
16
+ 2. (OPTIONAL) The default aggregation method for pivot cells is `count`. Add other aggregations to columns before building the pivot table. Each aggregation adds a column for every pivot column. See **Examples** below.
17
+
18
+ Note: Custom aggregations replace the default `count` aggregation.
19
+
20
+ - {help.commands.aggregate_col}
21
+
22
+ 3. Move the cursor to the column containing the pivot values to be aggregated for each group.
23
+
24
+ 4. Create the pivot table:
25
+
26
+ - {help.commands.pivot}
27
+
28
+ ## Pivot Sheet
29
+
30
+ Each cell in the pivot table, as in a **Frequency Table**, links to the underlying rows. Dive into a row to open a new sheet containing the linked rows.
31
+
32
+ - {help.commands.open-row}
33
+
34
+ ## Examples
35
+
36
+ Sample input sheet **sales**:
37
+
38
+ date color price
39
+ ---------- ----- -----
40
+ 2024-09-01 R 30
41
+ 2024-09-02 B 28
42
+ 2024-09-03 R 100
43
+ 2024-09-03 B 33
44
+ 2024-09-03 B 99
45
+
46
+
47
+ 1. [:keys]![/] (`key-col`) on the **date** column to set it as a key column.
48
+ 2. [:keys]Shift+W[/] (`pivot`) on the **color** column to open a **Pivot Table** grouped by **date**, and summarizing **color**.
49
+
50
+ date R B
51
+ ---------- - -
52
+ 2024-09-01 1 0
53
+ 2024-09-02 0 1
54
+ 2024-09-03 1 2
55
+
56
+ Note that each cell contains the row count because of the default `count` aggregation.
57
+
58
+ 3. [:keys]q[/] (`quit-sheet`) to return to the original **sales** sheet.
59
+ 4. [:keys]#[/] (`type-float`) on the **price** column to set its type to float.
60
+ 5. [:keys]+[/] (`aggregate-col`) to add a `sum` aggregate to the **price** column.
61
+ 6. [:keys]+[/] (`aggregate-col`) to add an `avg` aggregate to the **price** column.
62
+ 7. [:keys]Shift+W[/] (`pivot`) on the **color** column to create the **PivotSheet**.
63
+
64
+ This generates each aggregation for all of the pivot columns. As mentioned above, any custom aggregations replace the default `count` aggregation:
65
+
66
+
67
+ date sum_R avg_R sum_B avg_B
68
+ ---------- ------ ------ ------ -----
69
+ 2024-09-01 30.00 30.00 0.00
70
+ 2024-09-02 0.00 28.00 28.00
71
+ 2024-09-03 100.00 100.00 132.00 66.00
@@ -0,0 +1,107 @@
1
+ ---
2
+ sheet: Sheet
3
+ ---
4
+ # Matching and Transforming Strings with Regex
5
+
6
+ Some commands for selecting, searching, and transforming data, accept a regular expression as input.
7
+
8
+ ## Select Rows
9
+
10
+ - {help.commands.select-col-regex}
11
+ - {help.commands.select-cols-regex}
12
+
13
+ - {help.commands.unselect-col-regex}
14
+ - {help.commands.unselect-cols-regex}
15
+
16
+ ## Search
17
+
18
+ - {help.commands.go-col-regex}
19
+
20
+ - {help.commands.search-col}
21
+ - {help.commands.search-cols}
22
+
23
+ - {help.commands.searchr-col}
24
+ - {help.commands.searchr-cols}
25
+
26
+ - {help.commands.search-next}
27
+ - {help.commands.searchr-next}
28
+
29
+ - {help.commands.search-keys}
30
+
31
+ ## Substitution
32
+
33
+ - {help.commands.setcol-regex-subst}
34
+ - {help.commands.setcol-regex-subst-all}
35
+
36
+ `Tab` to move between `search` and `replace` inputs.
37
+ An empty `replace` removes the matching string.
38
+
39
+ # Column Creation
40
+
41
+ - {help.commands.addcol-regex-subst}
42
+ - {help.commands.addcol-split}
43
+ - {help.commands.addcol-capture}
44
+
45
+ ## Examples
46
+
47
+ ### Split
48
+
49
+ Sample input sheet **sales**:
50
+
51
+ date price
52
+ ---------- -----
53
+ 2024-09-01 30
54
+ 2024-09-02 28
55
+ 2024-09-03 100
56
+
57
+ 1. [:code]:[/] (`addcol-split`) on **date** column, followed by `-` to split on hyphens.
58
+
59
+ date date_re price
60
+ ---------- ---------------- -----
61
+ 2024-09-01 [3] 2024; 09; 01 30
62
+ 2024-09-02 [3] 2024; 09; 02 28
63
+ 2024-09-03 [3] 2024; 09; 03 100
64
+
65
+ Note that the results in the `date_re` column are lists of length 3.
66
+
67
+ 2. [:code]([/] (`expand-col`) to expand a column with lists into multiple columns with the list elements.
68
+
69
+ date date_re[0] date_re[1] date_re[2] price
70
+ ---------- ---------- ---------- ---------- -----
71
+ 2024-09-01 2024 09 01 30
72
+ 2024-09-02 2024 09 02 28
73
+ 2024-09-03 2024 09 03 100
74
+
75
+ ### Substitution
76
+
77
+ 1. On the **date** column, [:code]*[/] (`addcol-regex-subst`) and type `-`, then `Tab` to "replace" and type `,`. Then `Enter` to replace all `-` with `,`.
78
+
79
+ date date_re price
80
+ ---------- ---------- -----
81
+ 2024-09-01 2024,09,01 30
82
+ 2024-09-02 2024,09,02 28
83
+ 2024-09-03 2024,09,03 100
84
+
85
+ ### Capture
86
+
87
+ 1. On the **date** column, [:code];[/] (`addcol-capture`) and type `(\d\d\d\d)` to capture and pull out the year.
88
+
89
+ date date_re price
90
+ ---------- -------- -----
91
+ 2024-09-01 [1] 2024 30
92
+ 2024-09-02 [1] 2024 28
93
+ 2024-09-03 [1] 2024 100
94
+
95
+ Note that the results in the `date_re` column are lists of length 1.
96
+
97
+ 2. [:code]([/] (`expand-col`) to expand a column with lists into multiple columns with the list elements.
98
+
99
+ date date_re[0] price
100
+ ---------- ---------- -----
101
+ 2024-09-01 2024 30
102
+ 2024-09-02 2024 28
103
+ 2024-09-03 2024 100
104
+
105
+ #### Options
106
+
107
+ - {help.options.regex_maxsplit}
@@ -0,0 +1,44 @@
1
+ # Selecting and filtering
2
+
3
+ Some commands operate only on "selected rows". For instance, a common command to filter is {help.commands.dup_selected}.
4
+
5
+ Many g-prefixed commands are like this. For example, use {help.commands.edit_cell}, but use {help.commands.setcol_input}. Search for "selected rows" in the [:onclick help-commands-all]commands list[/] or the [:onclick sysopen-help]manpage[/] for a full list.
6
+
7
+ Rows on the **Frequency Table** or **Pivot Table** reference a group of rows from the source sheet. Selecting a row on those sheets also selects the referenced rows on the underlying source sheet.
8
+
9
+ Select and unselect rows with these commands:
10
+
11
+ ## One row at a time
12
+
13
+ - {help.commands.select_row}
14
+ - {help.commands.unselect_row}
15
+ - {help.commands.stoggle_row}
16
+
17
+ ## All rows at the same time
18
+
19
+ - {help.commands.select_rows}
20
+ - {help.commands.unselect_rows}
21
+ - {help.commands.stoggle_rows}
22
+
23
+ ## By matching patterns
24
+
25
+ - {help.commands.select_col_regex}
26
+ - {help.commands.unselect_col_regex}
27
+ - {help.commands.select_cols_regex}
28
+ - {help.commands.unselect_cols_regex}
29
+
30
+ - {help.commands.select_equal_cell}
31
+ - {help.commands.select_equal_row}
32
+
33
+ ## Select by Python expression
34
+
35
+ Python expressions can use a column value by the column name, if the
36
+ column name is a valid Python identifier (with only letters, digits, and underscores).
37
+
38
+ - {help.commands.select_expr}
39
+ - {help.commands.unselect_expr}
40
+
41
+ ## Options
42
+
43
+ - {help.options.bulk_select_clear}
44
+ - {help.options.some_selected_rows}
@@ -0,0 +1,26 @@
1
+ # The Slide Guide
2
+
3
+ The key bindings are based on the vi movement keys (hjkl).
4
+
5
+ ## How to move columns
6
+
7
+ - {help.commands.slide_left}
8
+ - {help.commands.slide_right}
9
+
10
+ - {help.commands.slide_leftmost}
11
+ - {help.commands.slide_rightmost}
12
+
13
+ - {help.commands.slide_left_n}
14
+ - {help.commands.slide_right_n}
15
+
16
+ ## How to move rows
17
+
18
+ - {help.commands.slide_down}
19
+ - {help.commands.slide_up}
20
+
21
+ - {help.commands.slide_bottom}
22
+ - {help.commands.slide_top}
23
+
24
+ - {help.commands.slide_down_n}
25
+ - {help.commands.slide_up_n}
26
+
File without changes
@@ -0,0 +1,15 @@
1
+ # Split VisiData into two panes
2
+
3
+ Use split panes to view two sheets at once.
4
+
5
+ ## Open and Close a new split
6
+
7
+ - {help.commands.splitwin_half}
8
+ - {help.commands.splitwin_close}
9
+ - {help.commands.splitwin_input}
10
+
11
+ ## Modify the split plane view
12
+
13
+ - {help.commands.splitwin_swap}
14
+ - Additionally, click on the inactive pane with the mouse to jump to it.
15
+ - {help.commands.splitwin_swap_pane}
@@ -0,0 +1,43 @@
1
+ # Types
2
+
3
+ Columns usually begin as untyped (`anytype`), but can be set to specific types.
4
+
5
+ - {help.commands.type-any}
6
+ - {help.commands.type-currency}
7
+ - {help.commands.type-date}
8
+ - {help.commands.type-float}
9
+ - {help.commands.type-int}
10
+ - {help.commands.type-len}
11
+ - {help.commands.type-string}
12
+
13
+ ## Type formatting
14
+
15
+ VisiData pre-set defaults for formatting types:
16
+
17
+ - `currency` removes non-numeric characters and parses the remainder as `float`.
18
+ - `date` parses dates into date object (shown as ISO8601).
19
+ - `vlen` formats the cell value to the length of the content
20
+ - `float` uses the decimal seperator, keeping two significant digits.
21
+
22
+ Change float precision with:
23
+ - {help.commands.setcol-precision-less}
24
+ - {help.commands.setcol-precision-more}
25
+
26
+ To change the default fmtstr for a type:
27
+
28
+ - {help.options.disp_currency_fmt}
29
+ - {help.options.color_currency_neg}
30
+ - {help.options.disp_date_fmt}
31
+ - {help.options.disp_float_fmt}
32
+ - {help.options.disp_int_fmt}
33
+
34
+
35
+ ## Importance of typing
36
+
37
+ Certain commands behave differently depending on how the column is typed.
38
+
39
+ Grouping by a numeric column in a Frequency table can result in numeric range binning. Grouping by a string results in categorical binning.
40
+
41
+ Un-typed columns (`anytype`) often default to `string`-like behaviour. Errors when working with numerical or datetime data is often due to values being considered as strings.
42
+
43
+ For example. [:code]addcol-expr col1+col2[/] results in a concatenation of the two columns when they are `anytype`, and addition when they are numerical.
@@ -0,0 +1,36 @@
1
+ CSV/TSV options
2
+
3
+ ## `tsv` (Tab Separated Values), as simple as it gets
4
+
5
+ - {help.options.delimiter}
6
+ - {help.options.row_delimiter}
7
+ - {help.options.tsv_safe_newline}
8
+ - {help.options.tsv_safe_tab}
9
+
10
+ Use `-f usv` for Unicode separators U+241F and U+241E.
11
+ Use `-f lsv` for awk-like records.
12
+ Use `--delimiter=` (an empty string) to make '\0' the value separator.
13
+ Use `--row-delimiter=` to make '\0' the row separator.
14
+
15
+ ## `csv` (Comma Separated Values) for maximum computibility
16
+
17
+ .csv files are a scourge upon the earth, and still regrettably common.
18
+ All csv_* options are passed unchanged into csv.reader() and csv.writer().
19
+
20
+ - {help.options.csv_dialect}
21
+ - Accepted dialects are `excel-tab`, `unix`, and `excel`.
22
+ - {help.options.csv_delimiter}
23
+ - {help.options.csv_quotechar}
24
+ - {help.options.csv_skipinitialspace}
25
+ - {help.options.csv_escapechar}
26
+ - {help.options.csv_lineterminator}
27
+
28
+ ## Saving TSV/CSV files
29
+
30
+ - {help.options.save_filetype}
31
+ - {help.options.safety_first}
32
+
33
+ ## Useful options for text formats in general
34
+
35
+ - {help.options.regex_skip}
36
+ - {help.options.save_encoding}
visidata/help.py CHANGED
@@ -2,13 +2,13 @@ import functools
2
2
  import collections
3
3
 
4
4
  from visidata import VisiData, MetaSheet, ColumnAttr, Column, BaseSheet, VisiDataMetaSheet, SuspendCurses
5
- from visidata import vd, asyncthread, ENTER, drawcache, AttrDict
5
+ from visidata import vd, asyncthread, ENTER, drawcache, AttrDict, TextSheet
6
6
 
7
- vd.option('disp_help', 2, 'show help panel during input')
7
+ vd.option('disp_expert', 0, 'max level of options and columns to include')
8
8
 
9
9
  @BaseSheet.api
10
10
  def hint_basichelp(sheet):
11
- return 0, '`Alt+[:underline]H[/]` to open the [:underline]H[/]elp menu'
11
+ return 0, 'Alt+H to open the [:underline]H[/]elp menu'
12
12
 
13
13
 
14
14
  @VisiData.api
@@ -43,12 +43,12 @@ class HelpSheet(MetaSheet):
43
43
  ColumnAttr('sheet'),
44
44
  ColumnAttr('module'),
45
45
  ColumnAttr('longname'),
46
- Column('menupath', width=0, cache=True, getter=lambda col,row: vd.menuPathsByLongname[row.longname]),
46
+ Column('menupath', width=0, cache=True, getter=lambda col,row: vd.menuPathsByLongname.get(row.longname, None)),
47
47
  Column('keystrokes', getter=lambda col,row: col.sheet.revbinds.get(row.longname, [None])[0]),
48
48
  Column('all_bindings', width=0, cache=True, getter=lambda col,row: list(set(col.sheet.revbinds.get(row.longname, [])))),
49
- Column('description', width=40, getter=lambda col,row: col.sheet.cmddict[(row.sheet, row.longname)].helpstr),
49
+ Column('description', width=70, getter=lambda col,row: col.sheet.cmddict[(row.sheet, row.longname)].helpstr),
50
50
  ColumnAttr('execstr', width=0),
51
- Column('logged', width=0, getter=lambda col,row: vd.isLoggableCommand(row.longname)),
51
+ Column('logged', width=0, getter=lambda col,row: vd.isLoggableCommand(row)),
52
52
  ]
53
53
  nKeys = 2
54
54
 
visidata/hint.py CHANGED
@@ -26,8 +26,8 @@ def getHint(sheet, *args, **kwargs) -> str:
26
26
  n = 1
27
27
  v = r
28
28
 
29
+ results.append((n, v))
29
30
  if v not in sheet.prevHints:
30
- results.append((n, v))
31
31
  sheet.prevHints[v] += 1
32
32
  except Exception as e:
33
33
  vd.debug(f'{f.__name__}: {e}')
@@ -35,5 +35,6 @@ def getHint(sheet, *args, **kwargs) -> str:
35
35
  if results:
36
36
  return sorted(results, reverse=True)[0][1]
37
37
 
38
+ return ''
38
39
 
39
40
  vd.addCommand('', 'help-hint', 'status(getHint() or pressMenu("Help"))', 'get context-dependent hint on what to do next')
visidata/indexsheet.py CHANGED
@@ -100,8 +100,8 @@ IndexSheet.addCommand('g^R', 'reload-selected', 'reloadSheets(selectedRows or ro
100
100
 
101
101
  # when diving into a sheet, remove the index unless it is precious
102
102
  SheetsSheet.addCommand('gC', 'columns-selected', 'vd.push(ColumnsSheet("all_columns", source=selectedRows))', 'open Columns Sheet with all visible columns from selected sheets')
103
- SheetsSheet.addCommand('z^C', 'cancel-row', 'cancelThread(*cursorRow.currentThreads)', 'abort async thread for current sheet')
104
- SheetsSheet.addCommand('gz^C', 'cancel-rows', 'for vs in selectedRows: cancelThread(*vs.currentThreads)', 'abort async threads for selected sheets')
103
+ IndexSheet.addCommand('^C', 'cancel-row', 'cancelThread(*cursorRow.currentThreads)', 'abort async thread for current sheet')
104
+ IndexSheet.addCommand('gz^C', 'cancel-rows', 'for vs in selectedRows: cancelThread(*vs.currentThreads)', 'abort async threads for selected sheets')
105
105
  SheetsSheet.addCommand('Enter', 'open-row', 'dest=cursorRow; vd.sheets.remove(sheet) if not sheet.precious else None; vd.push(openRow(dest))', 'open sheet referenced in current row')
106
106
 
107
107
  vd.addGlobals(IndexSheet=IndexSheet,