Footer Sel: to include word count

  • Hi,

    In the footer of Notepad++, can someone modify Sel: to include a word count please?

    Yes, I know word count is in “Find” but wouldn’t it be great if you could highlight a selection and know straight away how many times that selection occurs. Currently “Sel:” shows how may letters and how many lines are selected. Someone must have a use for that but I can’t figure out why.

    It would be great to see if I have declared variables that I haven’t used, or to see quickly if the variable I have used is just in the local block or elsewhere in the code.

    Thanks :-)

  • @WhoCanDo said:

    …see if I have declared variables that I haven’t used, or to see quickly if the variable I have used is just in the local block or elsewhere in the code

    So this part it totally different from your topic title and the rest of your posting, and for it you have a few options currently available:

    • Use the Smart Highlighting feature (double-click a word/variable to smart-highlight it, then use the mouse ONLY to navigate to other regions of the file to see (or not) other occurrences of the same word/variable highlighted); must be enabled in Settings (menu) -> Preferences… -> Highlighting (box on left) -> stuff on right
    • Use the Search (menu) -> Mark… feature to see all of your desired text highlighted in red
    • Use one of the Search (menu) -> Mark All -> Using ___ Style features to see all of your current word/selection text highlighted in one of 5 different colors

  • @Scott-Sumner said

    So this part it totally different…

    Okay, so on 2nd thought I can see how your entire post ties together but the earlier recommendations still stand as good techniques for the “variables” thing.

    If you are looking for comments or workarounds:

    As far as dynamic updating goes, you are currently out of luck for having this happen without scripting help (see below); concerning on-demand techniques (where you do something to get the data you seek) I see the following options:

    • Word count is NOT in Find directly…match count is…of course if you tell it to match a regular expression of \w+ you will get a word count of the entire doc
    • For a word count in a selection you can do a Replace All (with In selection ticked of course) and regex replace \w+ with $0…then take note of the status bar of the Find/Replace window and it will show you the word count in the form of replacements made (text itself won’t be changed although the document will be modified). You can record this as a macro to lessen the pain, but you still have to run the macro so this is still and “on-demand” thing.
    • View (menu) -> Summary will give you a word count (not in selection but rather in the whole document); just pointing that out in case you didn’t know


    If you are open to using the Pythonscript plugin (currently 32-bit only):

    • For something similar but a little bit different, see

    • I thought I had posted the code below before but I can’t find a link to it now; anyway I think it does exactly what you want, I call it

      import re
      def WCISAISB__callback_sci_UPDATEUI(args):
      if args[‘updated’] & UPDATE.SELECTION:
      text = editor.getSelText()
      notepad.setStatusBar(STATUSBARSECTION.DOCTYPE, ‘Word count in selection: {}’.format(len(re.findall(r’\w+’, text))) if len(text) > 0 else ’ ')

    If you are just making a feature request here is some advice:

    Your best option is to make a feature request or a change-in-functionality request here: by opening a “New issue”.
    However, please spend a little time searching to see if your specific request already exists, in which case you can “up-vote” that Open Issue so that in theory it gets more attention. You may also add to an already open Issue any new information you think relevant.
    You may search open issues (at the above link) as follows:

    • Make sure the Issues “tab” is active
    • The box to the right of the Filters dropdown (with the magnifying glass in it) should already have is:issue is:open in it
    • Add a space and then your search term to that box and press Enter

  • Excellent information Scott. Thanks for the great ideas.

Log in to reply