Skip to content

New editing command proposal: align

Hello all :),

I'm in the process of switching from Emacs to Kate, and I still miss a few things from Emacs. Among them was this align command.

Below is are illustrations of its behavior.

Let's start with this text:

  - foobar: lala
- baz: lili
 - quux: lulu

By default the align command will align selected lines or the whole document on the first non-blank character, so here calling the align command will result in:

  - foobar: lala
  - baz: lili
  - quux: lulu

We can also provide a simple pattern (which is a JavaScript RegExp string) to align on, so for example calling align : here will result in:

  - foobar: lala
  - baz   : lili
  - quux  : lulu

Another possibility is to give it a pattern with a capturing group in the RegExp, and it will align on the captured group, so for example instead of the previous command if we had called align :\\s+(.) it would have resulted in:

  - foobar: lala
  - baz:    lili
  - quux:   lulu

I hope other will find this useful =).

Cheers,

Edited by Pablo Rauzy

Merge request reports