Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 17 days 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 6 years ago)
- Default Branch: main
- Last Pushed: 2023-02-05T14:34:15.000Z (almost 2 years ago)
- Last Synced: 2024-10-10T09:15:48.175Z (28 days ago)
- Topics: ascii, pretty-print, tables, vim
- Language: Python
- Homepage:
- Size: 208 KB
- Stars: 43
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Aligns columns in your ASCII tables.
[![PyPi Version](https://img.shields.io/pypi/v/tablign.svg?style=flat-square)](https://pypi.org/project/tablign)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/tablign.svg?style=flat-square)](https://pypi.org/pypi/tablign/)
[![GitHub stars](https://img.shields.io/github/stars/nschloe/tablign.svg?style=flat-square&logo=github&label=Stars&logoColor=white)](https://github.com/nschloe/tablign)
[![PyPi downloads](https://img.shields.io/pypi/dm/tablign.svg?style=flat-square)](https://pypistats.org/packages/tablign)[![gh-actions](https://img.shields.io/github/actions/workflow/status/nschloe/tablign/tests.yml?branch=main)](https://github.com/nschloe/tablign/actions?query=workflow%3Aci)
[![codecov](https://img.shields.io/codecov/c/github/nschloe/tablign.svg?style=flat-square)](https://codecov.io/gh/nschloe/tablign)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](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
```![](https://nschloe.github.io/tablign/tty-capture.gif)
### 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.