Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep Notepad++ from automatically populating the search value with selected/adjacent text

In Notepad++, when you do Search -> Find, it automatically populates the "Find what:" field according to the behavior below (per the online documentation - emphasis mine)...

In the Find what field, type the text you want to find. This is automatically filled with the current selected text, or the word under the caret, or the last searched pattern, when the Find dialog is opened.

Is there a way to change or disable this behavior? I would prefer that it come up empty. I don't mind the last searched pattern as a reasonable default, but it drives me nuts when it keeps changing the search value by automatically selecting a word next to the cursor.

I've done quite a bit of digging (settings, help, web searches, etc.) and can't find a way to turn this off.

like image 977
Devon Biere Avatar asked Jul 17 '13 21:07

Devon Biere


People also ask

What does wrap around do in notepad?

Sometimes referred to as a run around and wrap around, word wrap is a feature in text editors and word processors. It moves the cursor to the next line when reaching the end without requiring you to press Enter .

What is Find Next in notepad?

You can click on Find Next and replace one at a time, or our favorite, Replace All, which will automatically search and replace everything. WordPad works the same as NotePad, except you can find Replace near the top-right.

How do I use Regular expression in Find and Replace in Notepad++?

Using Regex to find and replace text in Notepad++ In all examples, use select Find and Replace (Ctrl + H) to replace all the matches with the desired string or (no string). And also ensure the 'Regular expression' radio button is set.


2 Answers

This problem has been fixed since 2019. I downloaded version 7.8.8 and found an option to turn this feature off in Settings > Preferences > MISC > Don't fill find field in Find dialog with selected word.

like image 174
Ray Chakrit Avatar answered Sep 18 '22 12:09

Ray Chakrit


There is no standard option to do this but you can achieve it by:

  1. The harder way: download N++ sources and make your own N++ build with desired modification

  2. The easier way: using AutoHotKey tool, capture Ctrl+F shortcut (with condition only if N++ window is active, see #IfWinActive directive ) so when it is pressed, send keys Ctrl+F, Backspace. Similar for Ctrl+H (Replace)

The AHK macros which work for me are:

SetTitleMatchMode, RegEx

;--------------------------------- Hotkeys for Notepad++ only
#IfWinActive ahk_class Notepad\+\+

; present 'find' dialog with empty field
^f::Send ^f{Backspace}  

; present 'replace' dialog with empty field
^h::Send ^h{Backspace}  

; another example: close document with either ^F4 or ^W
^F4::Send ^w

#IfWinActive

For details regarding AutoHotkey macro setup, please check steps 1-5 in this answer.

like image 28
miroxlav Avatar answered Sep 20 '22 12:09

miroxlav