tables
vimwiki
just make pipes it auto aligns
pipe and 3 dashes will do horizontal lines
== VIMWIKITABLE CMDS ==
- :VimwikiTableAddRowAbove
- :VimwikiTableAddRowBelow
- :VimwikiTableDeleteRow
- :VimwikiTableAddColBefore
- :VimwikiTableDeleteCol
== markdown-toc ==
:Tabularize: /<regular_expression>: Align lines based on a regular expression.
For example, to align lines by spaces or tabs, use :Tabularize /\s+.
Align by a Range:
:Tabularize: / : Align lines within a specified range.
For example, to align lines within a visual selection, use :'<,'>Tabularize /=.
Custom Alignment:
-
You can specify a custom alignment character or string. For example, :Tabularize: / / will align lines using spaces.
Automatic Alignment with Operators:
-
In normal mode, select the lines you want to align.
Then, use the :Tabularize: command to automatically align the selected lines based on the delimiter, regex, or alignment character you specify.
Repeat the Last Tabularize Command:
:Tabularize (without any arguments) will repeat the last Tabularize command with the same arguments.
Visual Mode Alignment:
- In visual mode, select the text you want to align.
Then, press :, and Vim will automatically add '<,'> to the command for aligning the selected visual block.
Custom Mappings:
You can create custom mappings in your .vimrc to quickly apply Tabularize to common delimiters or regex patterns. For example:
nnoremap a :Tabularize /,
- This mapping allows you to align text by commas by typing a in normal mode.
== table mode ==
| name | price |
| phil | 3 |
| susan | 5 |
| janice | 8 |
| doreen | 39 |
| cordelia | 12 |
| --------------------+------- | |
| total | 67.0 |
%% tmf: $8,2=Sum(2:-1)
leader tt = csv to table
:Tableize
leader tm = :TableModeToggle
- then you can pipe away
- double pipe does horiz sep
== moving ==
bracket / curly brace + pipe
== editing ==
ci| = change in cell /
ca| = change around cell
leader tdd = delete row
leader tdc = delete column
leader tic = insert col
== formulas ==
leader tfa =:TableAddFormula
leader tfe = evaluate
leader t? also eval (no need it auto evaluates)
Sum(2:-1) that means col 2 and -1 = row above current line
Sum(2,2:-1) 2,2 is start at col 2 row 2
when you specify a pair of values eg 2,2 its specific to that row
when you just have 1 its the whole column.
:TableModeEnable:
Enables table mode for the current buffer.
:TableModeDisable: Disables table mode for the current buffer.
:TableModeRealign: Realigns the table columns.
:TableModeAutoFormat: Automatically formats the table by aligning columns.
:TableModeToggle: Toggles between enabling and disabling table mode.
:TableModeToggleInsertMode: Toggles between insert mode and normal mode for a table cell.
ta: Toggle table alignment (e.g., left-align, center-align, right-align).
tr: Toggle table row alignment.
tt: Toggle table text wrapping.
Table Navigation:
|: Move to the next cell in the table.
j and k (in Normal mode): Move between rows.
H and L (in Normal mode): Move to the first and last cells in the current row, respectively.
gh and gl (in Normal mode): Navigate between columns.
[[ and ]]: Jump to the previous and next table.
Text Objects:
iat: Select the entire table.
iab: Select the current cell.
a|: Select the current column.
ir: Select the current row.
Other Useful Shortcuts:
ti: Inserts a new row above the current row.
tI: Inserts a new row below the current row.
td: Deletes the current row.
tD: Deletes the current column.
tc: Change the contents of the current cell.