Take the 2-minute tour ×

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

Would be nice extra if a toolbar button could be added to toggle showing whitespace characters on/off (but no new lines).

Is this possilbe?

share|improve this question
add comment

1 Answer

up vote 1 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 http://www.scintilla.org/ScintillaDoc.html#SCI_GETVIEWWS

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? –  naxa Mar 8 '13 at 15:38
add comment

Your Answer


