https://github.com/nschloe/tablign
Aligns columns in your ASCII tables on the command line or in vim.
https://github.com/nschloe/tablign
ascii pretty-print tables vim
Last synced: 3 months ago
JSON representation
Aligns columns in your ASCII tables on the command line or in vim.
- Host: GitHub
- URL: https://github.com/nschloe/tablign
- Owner: nschloe
- License: gpl-3.0
- Created: 2018-02-12T13:05:01.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2023-02-05T14:34:15.000Z (over 2 years ago)
- Last Synced: 2025-04-28T16:14:25.260Z (3 months ago)
- Topics: ascii, pretty-print, tables, vim
- Language: Python
- Homepage:
- Size: 208 KB
- Stars: 42
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Aligns columns in your ASCII tables.
[](https://pypi.org/project/tablign)
[](https://pypi.org/pypi/tablign/)
[](https://github.com/nschloe/tablign)
[](https://pypistats.org/packages/tablign)[](https://github.com/nschloe/tablign/actions?query=workflow%3Aci)
[](https://codecov.io/gh/nschloe/tablign)
[](https://github.com/psf/black)Install with
```sh
pip install tablign
``````sh
tablign in.txt out.txt
```you can convert your input file
```
| A | 1.34|-214.1|
|CCCC | 55.534| 1131.1|
```into
```
| A | 1.34 | -214.1 |
| CCCC | 55.534 | 1131.1 |
```Column widths are unified across the table, decimal dots are aligned, and tablign tries
to be smart about column separators. Works for CSV, LaTeX, Markdown etc. By default,
`tablign` reads from stdin and writes to stdout, so you can use pipes with tablign, too:```
head -n in.txt | tablign
```### Usage from vim
Simply mark the table (shift-V), and type
```
:'<,'>:!tablign
```
### Alternatives
[GNU's `column` command](https://man7.org/linux/man-pages/man1/column.1.html) is a mighty alternative:
```sh
column -t
```See [here](https://stackoverflow.com/q/1229900/353337) for more alternatives.