Notepad++ Settings

2 minute read

Description:

This post is just for my notes on my Notepad++ install.

To Resolve:

  1. Go to Style Configurator – Obsidian

Verdana 12

Global font size

Global font

  1. Enable the Explorer plugin and set to my scripts path.

  2. Tasks to do in NPP:

Sort by line and remove the duplicate lines at the same time:

  1. Get the TextFX plugin. This used to be included in older versions of Notepad++, but if you have a newer version, you can add it from the menu by going to Plugins -> Plugin Manager -> Show Plugin Manager -> Available tab -> TextFX -> Install. In some cases it may also be called TextFX Characters, but this is the same thing.

  2. Then check boxes and buttons required will now appear in the menu under: TextFX -> TextFX Tools.

  3. Make sure “sort outputs only unique…” is checked.

  4. Next, select a block of text (Ctrl+A to select the entire document). Finally, click “sort lines case sensitive” or “sort lines case insensitive”

To Replace Spaces on Each Line:
# This happens when you copy multiple columns from Excel to Npp

  1. Copy the amount of spaces in between each word to your clipboard
  2. Press Ctrl+A to select all text
  3. Press Ctrl+H to bring up find/replace
  4. Paste in the blank spaces in the “find what” dialog
  5. In the replace with, make sure it is completely blank
  6. Select the option to replace all

To insert text at the beginning of each line:

  1. Press Ctrl+A to select all text
  2. Press Ctrl+H to bring up find/replace
  3. Select the third radio button on the bottom left (search mode) for “regular expression”
  4. In the “find what” type: ^
  5. In the “replace with” type: (whatever text you want at the beginning of each line)

To insert text at the end of each line:

  1. Press Ctrl+A to select all text
  2. Press Ctrl+H to bring up find/replace
  3. Select the third radio button on the bottom left (search mode) for “regular expression”
  4. In the “find what” type: $
  5. In the “replace with” type: (whatever text you want at the end of each line)

To Clear the text after a certain character on each line (for example a double quotation mark):

  1. Search for the regular expression: “.*
  2. Replace with (blank)
    NOTE: Another example, to remove everything after / on each line the search would be: /.*

To remove trailing spaces for each line:
Edit – Blank Operations – Trim trailing space

To remove leading space for each line:
Edit – Blank Operations – Trim leading space

To remove empty lines:
Edit – Line Operations – Remove Empty Lines
or in Extended mode:
Search: \n\r
Replace: (blank)

To sort lines alphabetically:
Edit – Line Operations – Sort Lines Lexi Ascending


To Try Things Using Only Regex:

 

Remove duplicates:

Find: ^(.*?)$\s+?^(?=.*^\1$)

Replace with: (blank) / Check the box “. matches new line”

 

Remove Empty lines:

Find: \r\n\W*\r\n

Replace with: \r\n

 

Remove just numbers (good for copying code):

Find: [0-9]

Replace: (blank)

 

Clear everything after a character, in this case, the double quotation mark

Find: “.*

Replace: (blank)

 

To Add something at the beginning of every line

Find: ^

Replace: (YourText)

 

To Add something at the end of every line

Find: $

Replace: (YourText)

 

To remove trailing spaces:

Find: [ \t]+$

Replace: (blank)

 

To remove leading line spaces:

Find: ^[ \t]+

Replace: (blank)

 

To remove leading and trailing line spaces:

Find: ^[ \t]+ [ \t]+$

Replace: (blank)

 

Remove spaces in middle of a string:

Find: \s+(?=\s)

Replace: (blank)

 

Remove trailing spaces:

Find what:
([^ \t])[ \t]+$

Replace with:
\1