10

Can you improve the visibility of whitespace using notepad++?

I tried Settings > Style > Whitespace Symbol, and am able to change the color as needed, but I still find the symbols incredibly small and hard to find.

My resolution is 1280x, so that might be a contributing factor, but there should be a way of replacing the symbol with something more visible than a tiny dot (perhaps a differently colored plus-sign). Is there a way?

  • i believe that you can't increase the size of the marker but you can increase the space if the tab from – vembutech Nov 21 '14 at 17:20
  • @phi: Did you have any luck with the solution I suggested? – James P Nov 25 '14 at 11:20
16

Based on this discussion I found there are two ways to increase the whitespace character size by sending commands to Scintilla which is the underlying editor component that Notepad++ is using. In the example below I have set the size to 3 which has increased the size of the dot rendered from 1 x 1 pixels to 3 x 3 pixels:

Before:

enter image description here

After:

enter image description here

Note that there seems to be a bug because the character is not centered, so you may have to experiment with the value based on what font size you are using.


Method A using Python

  1. Install the Python scripting add on for Notepad++ from SourceForge (the version from the Notepad++ add-on manager doesn't currently work)
  2. Run a new instance of normal Notepad as an administrator
  3. Use it to open the following path:

    [Notepad++ main install directory]\plugins\PythonScript\scripts\startup.py

  4. Append the following at the bottom:

    editor.setWhitespaceSize(3)
    
  5. Save the file.
  6. Open Notepad++
  7. Choose Plugins -> Python Script -> Configuration
  8. Ensure Initialisation is set to ATSTARTUP and save
  9. Restart Notepad++ and spaces should now show as much larger dots automatically

Method B using macros

It is also possible to do it purely with macros and no extra plugins. You could edit the shortcuts.xml file in %AppData%\Notepad++ using notepad and add the following before the closing </Macros> tag:

<Macro name="Increase Whitespace Size" Ctrl="yes" Alt="yes" Shift="no" Key="100">
   <Action type="0" message="2086" wParam="3" lParam="0" sParam="" />
</Macro>

This will give you a new macro called Increase Whitespace Size which will do the same thing as the Python script. It will show up under the Macro menu and can be given a shortcut using the Shortcut Mapper.

  • thanks, I finally got it to work! While I couldn't test the first method (no python at work), the second one works. What stumped me at first - it's explained in the thread you linked - is that npp rewrites shortcuts.xml when closing. Go figure... Thanks! – zuiqo Nov 25 '14 at 16:12
  • I'd like to add that the second method actually increases whitespace symbols permanently, so there's no need to run the macro every time you open it. For me that's great! (No idea about the first one though) – zuiqo Nov 27 '14 at 14:09
  • Strange, after restarting NPP it shouldn't take effect unless you run the macro - that's how it behaves on my PC and the original forum post mentions that this is how it will behave unless you have something like NppExec set to run it on startup. The first method is probably nicer - I had some problems with the Python scripting add-on until I downloaded the latest version directly from their SourceForge page. You shouldn't need to install a separate package for Python itself, but if you're not allowed to install anything at all then I guess it doesn't make a difference. – James P Nov 27 '14 at 15:16
  • Well, I didn't add anything else, but as long as it work, idc :D – zuiqo Nov 27 '14 at 15:30
  • PythonScript is nice. It's much more flexible as well. Thanks for the tip – Dio Phung Jun 30 '15 at 20:46
3

The OP explicitly said they can change the color, but color wasn't enough.

For me, color would be enough to achieve OP's goal of

Improve display of whitespace on notepad++

To change color, as it says here:

The colour for both can be set from the Styler Configurator, Global styles, White space symbol.

Specifically, in Notepad ++ v6.8.1

  1. Settings (Ctrl+t)
  2. Style Configurator
  3. Set "Language" to "Global Styles"
  4. Set "Style" to "White space symbol"
  5. Change Foreground Color, verify sufficient visibility / contrast
  6. Choose Save & Close

Before Before changing whitespace foreground color for visibility / contrast - barely visible After After changing whitespace foreground color for visibility / contrast - very distinct

-1

I believe that you can't increase the size of the marker but you can increase the space for the tab from

Preferences -> Language Menu/Tab Settings --> Tab settings and increase the tab space from preference in right side

  • 1
    How does that help in improving the visibility of whitespace without affecting the file contents or how many spaces a tab represents? – RobH Nov 21 '14 at 17:25
  • please read the question carefully before answer – Luke Jun 9 '16 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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