Line Number Shortcut



  • New here…Hi! I have searched and googled, etc for a tab menu item to turn off line numbering or a keyboard shortcut…the ability to turn off and on quickly is more than just convenient. The only option I see or read about is going into preferences each time, a pain in the butt, not efficient. Why is there not this function in the View drop down with a shortcut? Am I missing something? Please help. Tx



  • Am I missing something?

    Yes you are i.e. Hide Line Number Margin in the View menu.



  • Hello Bill,

    Install the Customize Toolbar plugin and Hide Line Number Margin will be added to the View menu.

    You can then assign a shortcut to this command via Settings -> Shortcut Mapper.

    Best regards.



  • You can then assign a shortcut to this command via Settings -> Shortcut Mapper.

    Hide Line Number Margin is not available in the Shortcut Mapper. Sorry.



  • You can assign a shortcut to Hide Line Number Margin by installing Python Script or Lua Script and then:

    1. Create a script containing the following line: notepad.runMenuCommand("View", "Hide Line Number Margin").
    2. Create a shortcut to the script.


  • FWIW, this one-line Pythonscript will toggle line numbers on/off with each run, in case you don’t want to use the Customize Toolbar plugin:

    editor.setMarginWidthN(0, 0 if editor.getMarginWidthN(0) == 26 else 26)
    

    NOTE: For this to work, Display line numbers must be UNCHECKED in Settings (menu) -> Preferences -> Editing .



  • @Yaron Tx, and to all others that took time to respond. I discovered I had to have the line numbers turned on before I installed the plugin for it to work. I’m happy to have that and will try the scripts for a shortcut. @Scott-Sumner I’ll check that out too.



  • @Bill F,
    You’re welcome.


Log in to reply