0
votes

How can I make Notepad++ convert my tabs into exactly 4 spaces regardless of position or context?

This question explains the general way to configure Notepad++ to use spaces instead of tabs. However, it still forces the spaces to adhere to the tab grid, meaning that if you're set to replace a tab with 4 spaces, it will actually replace it with up to 4 spaces and bring align it with the next column that is a multiple of 4. I do not desire this - I want exactly 4 spaces regardless of tab alignment.

For example: If I have typed 6 characters on a line and press tab, it currently inserts 2 spaces instead of 4, bringing me to column 8 (because this is the next multiple of 4).

How can I make it such that pressing tab does not take the tab alignment into account, and simply inserts 4 spaces no matter what?

1
I'm afraid that's not possible. Tab stops are absolute, not relative by definition.Toto

1 Answers

1
votes

You request to overwrite the intrinsic TAB functionality. Which is about strict alignment.

What you want is a keyboard shortcut that will insert (2,4,6...) spaces.

I suggest you :

  1. Record a simple macro that will insert 4 spaces.
  2. Give the macro name, for example m4spaces
  3. Assign an available keyboard combination to macro m4spaces.

This way you do not disrupt the current TAB behavior, and extend behavior with your keyboard shortcut.