0

In Notepad++, I have it set to insert 4 spaces instead of tab. I am working in a file format (robot framework) where it is important that some things be separated by multiple (more than 1) spaces.

Notepad++, when I push tab, will first move the cursor however many of spaces to get to the next multiple of 4, i.e., trying to automatically keep everything lined up, and then tab 4 spaces after. If it just so happens that the last thing I typed ends 1 space character away from the next aligned position, when I tab, it only puts in that single space...and my automation fails. (If it happens to be 2, 3, or 4 spaces away, those cases all work, but really for consistency, it would be nice if 'tab' always meant '4 spaces from the current cursor position'.)

Is there a way to make Notepad++ ignore alignment and always, no matter what, insert exactly 4 spaces if I press tab? I want to preserve auto-indent functionality, but I don't think that should matter for what I'm asking. I'm sure there has to be some setting somewhere that does this, but I'm at a loss on where to look for it.

  • 1
    I don't believe that is possible (without modifying the source code) as it is a requirement that is need by probably zero other people. – DavidPostill Oct 31 '17 at 16:44
  • @DavidPostill I'll gladly prove you wrong then. :) – LPChip Oct 31 '17 at 16:46
  • 1
    @LPChip lol. Well done ;) I wonder what functionality that macro will break ... – DavidPostill Oct 31 '17 at 17:10
  • @DavidPostill it breaks Scintilla command: SCI_TAB. whatever that is. :) And in the scintilla tab, you can actually give that a different key to resolve the conflict. – LPChip Oct 31 '17 at 17:57
  • 1
    @LPChip Hmm. scintilla - and I've never seen a Scintilla tab whatever that is ... not that I care, because I'm not going to redefine <tab>, but it might affect the OP. – DavidPostill Oct 31 '17 at 18:02
3

Yes, this is possible. New versions of Notepad++ offer the macro recording tool, which you can use to bind common tasks to a key.

What you want to do is start a new macro recording, and press space 4 times, then stop the recording.

Then press Macro->Save Macro, select TAB as the key and give it a name.

It will say at the bottom: key found, but it will still work.

Now, every time you press tab, it will insert 4 spaces instead of a tab.

Alternatively you can bind it to a different keyboard combination, such as ctrl-tab so you have both options.

  • 1
    ctrl+tab is used to switch between tabs ... – DavidPostill Oct 31 '17 at 17:15
  • Yeah, it was just meant as an example. :) – LPChip Oct 31 '17 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.