The tabular plugin

The tabular vim plugin can be used for some cool text manipulation. Say we have some command output we want to make more readable:

~/forks/tektoncd/pipeline/docs
❯ grep -rHin 'weight:'
variables.md:4:weight: 15
taskruns.md:4:weight: 2
labels.md:4:weight: 10
metrics.md:4:weight: 14
pipelineruns.md:4:weight: 4
runs.md:4:weight: 2
resources.md:4:weight: 6
workspaces.md:4:weight: 5
install.md:4:weight: 1
migrating-v1alpha1-to-v1beta1.md:4:weight: 18
deprecations.md:4:weight: 19
auth.md:4:weight: 7
tekton-controller-performance-configuration.md:4:weight: 16
conditions.md:4:weight: 11
podtemplates.md:4:weight: 12
events.md:4:weight: 2
container-contract.md:4:weight: 8
tekton-bundle-contracts.md:4:weight: 8
tasks.md:4:weight: 1
migrating-from-knative-build.md:4:weight: 17
pipelines.md:4:weight: 3
logs.md:4:weight: 9
enabling-ha.md:4:weight: 13

If we put it in a vim buffer, it's as easy as calling:

Bonus: buffer filtering

After some block selection editing,

we can use the external sort program to sort the entries based on their respective weights:

Source: tabular

Last updated

Was this helpful?