Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to have either a keyboard shortcut or a toolbar button that toggles if I use tabs (ie tab for indentation) or make notepad++ use spaces instead.

It would be a nice extra if a toolbar button could be added to toggle showing whitespace characters on/off, but no new lines.

Is this possible?

share|improve this question
up vote 3 down vote accepted

When toggling space/tabs for indentation, would you like the change to only apply to future indentation or all indents, including already existing ones?

To Convert All Existing Spaces to Tabs and Vice Versa

Hotkey: Settings -> Shortcut Mapper -> Main Menu and set hotkeys for the TAB to Space and vice options

Toolbar Button: Install plugin "Customize Toolbar" from Plugins -> Plugin Manager. After installation, Plugins -> Customize Toolbar -> Customize will allow you to add the "Tab to Space" and "Space to Tab" buttons

Toggle indentation character (space or tab) for subsequent indents

  • Install the Python Script plugin and from its menu, Create new script.
  • Choose a file name and save in the given directory
  • In the blank script file add: editor.setUseTabs(not editor.getUseTabs()) and save

From the Python Script -> Configuration menu:

Hotkey: Add a menu item and restart N++. From Shortcut Mapper -> Plugin Commands, set a shortcut for your toggle script.

Button: Add a button. Restart N++. If the toolbar button is not clickable, a conflict with the Customize Toolbar plugin is occuring, so you might have to remove that plugin. If there is a way to get Customize Toolbar and Python Script to add buttons to the toolbar simultaneously, I haven't found it.

Toggling Whitespace Character Visibility

Hotkey: Shortcut Mapper -> Main Menu -> "Show Whitespace and Tab" or

Set Hotkey and/or Toolbar Button for the following N++ Python Script:

# Toggle whitespace visibilty through the following modes
# 0: The normal display mode with white space displayed as an empty background colour
# 1: White space characters are drawn as dots and arrows
# 2: White space used for indentation is displayed normally but after the first visible character, it is shown as dots and arrows
# Mode descriptions from

editor.setViewWS( (editor.getViewWS()+1)%3 )
share|improve this answer
I've set a keyboard shortcut for the "subsequent_indents toggler", but every time I use it and then switch to another file tab and back, the setting is reset (without me doing anything). any ideas? – n611x007 Mar 8 '13 at 15:38
Nice work protongun. @naxa: I assume this is because it reloads the tab setting from the per-filetype setting (Settings > Preferences > Tab Settings > Filetype > Replace by space). Do you want a script which toggles this global setting? Might be the only way. – Nigel Touch Sep 9 '15 at 19:43
@NigelTouch it's a plausible theory, yes. I have no idea how to toggle the global 'replace by tab' setting, yet. – n611x007 Sep 9 '15 at 21:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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