Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • K KTextEditor
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Service Desk
    • Milestones
  • Bugzilla
    • Bugzilla
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FrameworksFrameworks
  • KTextEditor
  • Merge requests
  • !391

New editing command proposal: align

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Pablo Rauzy requested to merge pablorackham/ktexteditor:work/pablo/commands-utils-align into master Jul 28, 2022
  • Overview 25
  • Commits 15
  • Pipelines 14
  • Changes 18

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 Aug 10, 2022 by Pablo Rauzy
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: work/pablo/commands-utils-align