How do I create a shortcut for setting tabstop size ?

  • Anonymous - 2014-02-26

    I frequently have to edit documents that contain tabs of different sizes (e.g. 4 spaces, 8 spaces) and find it time consuming to have to adjust tab stop sizing each time via the settings dialog (Settings / Preferences / Tab Settings / Tab Size).

    I tried to create a macro for this key sequence but NPP (6.5.3) wouldn't let me save it as a valid macro.

    Is there any way I can create a keyboard shortcut that will either embed the tab stop size in its definition, or have a shortcut open up the Tab-Sizing dialog so that I can just type in a number to set the tab stop size?

    Defining different file types with different tab stop definitions is not a valid solution for my situation.


  • cchris

    cchris - 2014-03-01

    It won't work with macros, if only because they don't take parameters.
    You may have more luck with a script, using Python, JS, PHP or anything else currently available.


  • Loreia2

    Loreia2 - 2014-03-03

    Hi DK,

    instal Python script plugin, create new script, call it say "", and paste this text into it:

    import re
    size = notepad.prompt("Input TAB size.", "Set TAB manually.")

    if size:
    editor.setTabWidth(int(re.sub("\D", "", size)))


    Assign some shortcut to it, and enjoy.