How to align text to the right with notepad++?

15,853

I think you'll need two main steps here. In Notepad++, select Plugins -> Plugin Manager and check if the TextFX Characters plugin is installed.

Solution for use case 1

  1. Search for the longest line,
  2. set cursor to the end of the longest line,
  3. press and hold Alt,
  4. click left mouse button and move mouse to upper left corner,
  5. go to Menu TextFX > TextFX Edit > Pad rectangular selection with space,
  6. repeat steps for lower left corner (select empty last line too),
  7. save the file looking like upper left corner shown in the screenshot below.

enter image description here

Solution for use case 1 (continue)

  • Ctrl+H
  • Find what: ^(.+?)(\h+)
  • Replace with: \2\1
  • check Wrap around
  • check Regular expression
  • Replace all

Solution for use case 2

Copy the character used as a delimiter ";" to the clipboard and select all rows.

Select TextFX -> TextFX Edit -> Line up multiple lines by (Clipboard Character):

enter image description here

Special use case 3

BTW - you may want to use Ctrl+Alt+R for viewing and writing right align and switch back by using Ctrl+Alt+L for left align.

Share:
15,853

Related videos on Youtube

flyingbird013
Author by

flyingbird013

Updated on July 20, 2022

Comments

  • flyingbird013
    flyingbird013 4 months

    I have text like this:

    1;a;3;;
    2;abc;4;;
    3;abcde;5;;
    

    I want to align texts to the right with notepad++, so become like this:

        1;a;3;;
      2;abc;4;;
    3;abcde;5;;
    

    How to do this?

  • lsalamon
    lsalamon over 2 years
    CTRL+ALT+R and select all lines and SHIFT+TAB.....multiple times
  • Toto
    Toto over 1 year
    Where do you find CodeWright? A screenshot is welome.

Related