Find and replace no longer shows 'replace with' - replace

Has anyone run into this issue?
I use to be able to right click on the current folder (or Shift + CMD + F) and 'replace with' whatever text. Doesn't seem like it's there anymore.
However, I do see it if I search within the current file.

It actually ended up being hidden and I had to vertically resize the find/replace section.
http://www.sublimetext.com/forum/viewtopic.php?f=3&t=18554&p=68826#p68826

Related

Refactoring quickly all the variables without UI

In Sublime Text 3, I could press Ctrl + D twice while variable is highlighted and I could rename them on the fly while I see them changed as I type without opening any UI like Shift + F6 does in WebStorm.
Is this possible in WebStorm I mean pressing a shortcut twice and renaming all occurrences quickly?
ShiftF6 will rename all possible occurrences in your proj.
CtrlSHIFTALTJ will select all the occurrence of the word you selected without UI.
CTRLR will do a search and replace in the current active editor.
Please refer to the official docs of Jetbrains Webstorm for more info: https://www.jetbrains.com/webstorm/documentation/

Find and replace in Visual Studio code in a selection

I have the following line in a file I'm editing in VSCode:
...............111.........111.............111..
I want to replace all .s with 0s. However, when I highlight the line and do a find/replace for .s, all the .s in the document are replaced, not just the ones in the line I've select, even when I toggle the "Find in selection" button. Is this a bug? In other editors, if I select a chunk of text and then do a find/replace, it will only find/replace matches within the selected block.
Below is a snippet that you should be able to reproduce the issue with. The ...............111.........111.............111.. line is inside the test_unicode function.
def test_simple2(self):
"""Simple CSV transduction test with empty fields, more complex idx, different pack_size.
100011000001000 ->
..........111....................111..........11111..........111..
"""
field_width_stream = pablo.BitStream(int('1000110001000001000', 2))
idx_marker_stream = pablo.BitStream(int('11101', 2))
pack_size = 4
target_format = TransductionTarget.JSON
csv_column_names = ["col1", "col2", "col3", "col4", "col5"]
pdep_marker_stream = pablo.BitStream(generate_pdep_stream(field_width_stream,
idx_marker_stream,
pack_size, target_format,
csv_column_names))
self.assertEqual(pdep_marker_stream.value, 63050402300395548)
def test_unicode(self):
"""Non-ascii column names.
Using UTF8. Hard coded SON boilerplate byte size should remain the same, column name
boilerplate bytes should expand.
100010010000000 ->
2 + 4 + 9 2 + 4 + 6 2 + 4 + 7
...............111.........111.............111..
"""
field_width_stream = pablo.BitStream(int('100010001000', 2))
idx_marker_stream = pablo.BitStream(1)
pack_size = 64
target_format = TransductionTarget.JSON
csv_column_names = ["한국어", "中文", "English"]
pdep_marker_stream = pablo.BitStream(generate_pdep_stream(field_width_stream,
idx_marker_stream,
pack_size, target_format,
csv_column_names))
self.assertEqual(pdep_marker_stream.value, 1879277596)
I'm using VSCode 1.12.2 in Ubuntu 16.04.
I was able to get it to work but the workflow is poor:
control + H to open Find/Replace
Select your line of text
Click the "Find in selection" icon to the right Alt L or ⎇ ⌘ L on macOS)
Enter your find and replace characters in their inputs
Click the Replace all icon
It works but you have to go through the workflow all over again for each new selection (except for CTR + H of course). BTW I have the exact same behavior in Sublime Text.
Could you go with a regExp to find your lines? Do they contain only .'s and 1's?
This is a more general answer for other users who come here just wanting to use basic find and replace functionality.
On Mac you can press Command + Option + F to open Find and Replace:
Alternatively, you can press Command + F to open Find and then click the little triangle on the left to show the Replace field:
From the VSCode devs:
We used to enable find in selection automatically when opening the
find widget with a selection, but it was too easy to trigger
accidentally and produced a lot of complaints. You probably want to
set "editor.find.autoFindInSelection": true which will make it work
the way you expect.
The VSCode GitHub issue has more details if anyone is interested.
EDIT: The autoFindInSelection option is available starting from VSCode 1.13. That version is currently in development (as of 6/7/2017), so this fix won't work until the new version is released.
I found the following workflow to be fairly painless:
Select text region with mouse or keyboard.
Ctrl+H to toggle find and replace
Alt+L to toggle find in selection
Ctrl+Alt+Enter to replace all (or enter to replace individually)
Since sometimes we might have similarly named things so you don't want to select everything, one of my favorites shortcut sequences is to select the next occurrence:
Use shift and arrows to highlight the term you want to match.
Use Ctrl + d to highlight the next occurrence of the term.
The Basic Editing in VS Code documentation page has some extremely useful variations on find and replace. One extremely useful shortcut is the Column (Box) Selection.
Just ran into this, my solution was to do
command + N to create a new file
paste my selection in there
do my find and replace operations on that while file
copy result back on top of my original selection
On Mac:
Select the text
Press command + shift + L
For mac
Press command + option + f to bring up this menu:
Press the little icon that has the arrow pointing at it above (3 horizontal bars)
Select the text you want to do a find and replace in, and enter the 'find' and 'replace' fields
Press this icon:
That's all!
In 2022, there's a bug to be wary of 🐛
There is a silent bug (I'll add more about this as I learn more about it). But sometimes find and replace within selection doesn't find the values, even if you can see them with your own eyes. This is dangerous because you could think you've replaced them all but it really hasn't.
So do these two things:
a visual check after doing a find and replace (to make sure it worked)
if vscode completely ignores you (and doesn't do the find and replace within selection after you've followed the above instructions), close the find and replace box by pressing the "x" in the corner, and retry the sequence of steps (it worked for me after closing and retrying).
Okay, this is really dumb, at first I felt really stupid when I finally found this, then I realized its just VS Code which has a bad interface.
The key is, there are TWO TOOLS here,
Search/Replace (the pane on the left at the top of the Explorer) and Find/Replace (which is a dialogue which opens when you press CTRL-F)
THESE ARE NOT THE SAME TOOL!!
SEARCH-REPLACE is a tool written for project-wide searches and
changes
FIND-REPLACE is a small dialogue best suited for more
surgical editing.
i.e. you should use FIND-REPLACE!
find replace window image with find-in-selection highlighted
Also, its SUPER IMPORTANT to follow these steps in the right order, or it doesn't give the expected results.
Press CTRL-F to open the find dialogue (usually opens in the top right)
press the little arrow to the right of the find field which opens the replace input field
ensure "find in selection" is turned off (i.e. not highlighted)
type in the fields the strings you want to search/replace
select the text you want to do a search/replace within.
Now press "find in selection" (or type ALT-L)
You should see only highlighting in the area you previously selected.
Now you can click either "replace all" (CTRL-ALT-ENTER) or line-by-line "replace" (ENTER)
I hope this helps.
My suggestion to VSC developers, there should be a refresh button so that after you have selected the area of interest, and you already have your find and replace strings defined, you can select a new region and click "refresh find" instead of needing to repeat steps 3 to 8.
For those where it still does not work, there is one step omitted in all of the above answers: Uncheck "Find in selection" if it is checked (which it probably is when you are struggling with it and in despair googled the problem, and then found this SO entry). Only then select the lines and then re-check "Find in selection".
For Ubuntu, highlight the lines where you want to make changes, press alt-L and then ctrl-H. Then type the name you want to replace and replacement name in the top right dropdown.
Or some combination of these actions depending on whether the dropdown is already open or you're already in alt-L mode. I'm still learning but thought I'd share what's working.

How do I find and replace all occurrences (in all files) in Visual Studio Code?

I can't figure out how to find and replace all occurrences of a word in different files using Visual Studio Code version 1.0.
I get the impression this should be possible since doing Ctrl + Shift + F allows me to simply search a folder, but i am clueless to how to proceed from here.
I looked in various key combination
https://code.visualstudio.com/Docs/customization/keybindings
But I only found how to replace all occurrences in the open file (Ctrl + h)
All help gratefully appreciated, this is driving me crazy.
I'm using Visual Studio Code 1.8, and this feature is available. But it's a little tricky to understand at first, and (at the time of writing) the docs don't explain clearly how to use it, so here's how it works, step by step:
Invoke Replace in Files (under the Edit menu, or with shortcut Ctrl+Shift+H)
You'll see a standard Find/Replace input replacing the files pane on the left:
Enter your search string and the replace string, then press enter. It may churn for a second searching all files, then it'll show the proposed changes in all your project files -- but note, these changes haven't been made yet! Here's what it looks like:
Now you need to make the changes (and even after that, you have to save the modified files.)
You can make those changes in various ways:
Make all changes to all files at once.
Click the replace icon next to your replace string (note: you'll get a dialog to confirm this bulk action.)
Make all changes in a single file at once.
Click the replace icon next to the filename (note: the icon only shows up when you hover over the filename row)
Make a single change in a single file.
Click the replace icon next to the individual change: (note: the icon only shows up when you hover over the change row)
Finally, don't forget to save!
All those files are now modified in the editor and not yet saved to disk (unless Auto Save is on).
Use File -> Save All (or Ctrl+Alt+S)
Update: I'm not sure when this was added, but if you click the "Replace all" button and see this dialog, clicking "Replace" will change and save all files in one click:
Since version 1.3 of vscode this is possible
Navigate to the search, click icon to the left or:
(mac) cmd + shift + h
(PC) ctrl + shift + h
expand replace
enter search term and replace term
confirm!
To replace a string in a single file (currently opened): CTRL + H
For replacing at workspace level use: CTRL + SHIFT + H
Update for 2020
If you are using the search feature to search across files (Ctrl + Shift + F) it can be easy to miss how to convert your search to a search and replace within the UI.
Here's a typical search result:
To convert this to a search and replace you need to click the arrow icon to the left of the search input field. This will open the replace options as seen below. Note the arrow icon is now pointed down.
The keyboard shortcut Ctrl + Shift + H will also work as well to access the search and replace.
Link to VSCode docs on search and replace: https://code.visualstudio.com/docs/editor/codebasics#_search-and-replace
This is the best way.
First put your cursor on the member and click F2.
Then type the new name and hit the Enter key. This will rename all of the occurrences in every file in your project.
This is ideal for when you want to rename across multiple files. For example, you may want to rename a publicly accessible function on an Angular service and have everywhere that uses it get updated.
For more great tools I highly recommend:
https://johnpapa.net/refactoring-with-visual-studio-code/
On the Visual Studio Code Key Bindings page, the section Keyboard Shortcuts Reference has links to a PDF for each major OS. Once open, search for "replace in files" or any other shortcut you might need.
Another way is to use the Command Palette (ctrl/cmd+shift+P) where you can type "replace" to list all related commands, including the one you want:
Replace in Files ctrl/cmd+shift+H
Visual Studio Code: Version: 1.53.2
If you are looking for the answer in 2021 (like I was), the answer is here on the Microsoft website but honestly hard to follow.
Go to Edit > Replace in Files
From there it is similar to the search funtionality for a single file.
I changed the name of a class I was using across files and this worked perfectly.
Note: If you cannot find the Replace in Files option, first click on the Search icon (magnifying glass) and then it will appear.
There are 2 methods technically same
First put your cursor on the word and press F2.
Replace your word and press Enter.
First put your cursor on the word and left click it.
Click "Rename Symbol" option.
Replace your word and press Enter.
In the VSC version 1.57
you can use the F2 key to replace on the folder(Rename Symbol)
Only thing is that even though all the places inside folder are replaced the file is not saved and the save has to be done afterwards
Also, instead of presing enter and replace all directly, you can press Shift + Enter to preview the places that are going to be renamed.
Step by step with images
Nowadays in VS Code this can be done quickly.
1) Click on the Search Button (in the side bar):
2) Enter in the inputs what do you want to find, and with what do you want to replace it:
(Here I am replacing in my project all the occurrences of table-cell with t-cell)
3) Finally, click on this small button (Replace All):
Then a pop-up will appear to confirm if you want to replace all occurrences. Click on Replace.
And you're done!
For search and replace all use this command:
command + option + F

Transpose function in Notepad++

I have a text file as:
0xC1,0x80,
0x63,0x00,
0x3F,0x80,
0x01,0xA0,
I want output as:
Line1: 0xC1,0x63,0x3F,0x01,
Line2: 0x80,0x00,0x80,0xA0,
How to do this using replace function in Notepad++?
You can use the below shortcuts to do the transpose in Notepad ++
Step 1: Ctrl + A: selects all.
Step 2: Ctrl + J: Transpose the Row you selected
Use the box select feature to select the second column text.
Use Alt+Shift+Arraw keys to select the second column.
Copy the selected text to a new file.
Use Find/Replace to remove all the newline characters.
Ctrl+F to open find/replace dialog box.
Select either Extended or Regular Expression Serach mode.
Type \r\n in Find What box.
Keep the Replace with box blank.
Click on Replace All in ALL Open Documents.
Now, the text is brought in single line.
Copy the text from second file and paste it to second line of first file.
Cheers...
There is no built-in function in Notepad++ for transposing a matrix and you can't do it using Replace (as M42 pointed out). Also, I'm not aware of any related plugin. So you will either need a different editor or do it with a script. The simplest solution I guess using a Spreadsheet, eg Excel or OpenOffice, both of them allow you to easily transpose a table.
But, there's still a good alternative without leaving Notepad++. Is to use the Python Script plugin.
Setup Python Script plugin
Install Python Script plugin, from Plugin Manager or from the official website.
When installed, go to Plugins > Python Script > New Script. Choose a filename for your new script (eg transpose.py) and copy the first code block that follows and copy the second one to another script, called for example transpose_uneven.py.
Open your data file and then run Plugins > Python Script > Scripts > transpose.py. This will open a new tab with your data transposed.
transpose.py
delimiter=","
newline="\n"
content=editor.getText()
matrix=[line.split(delimiter) for line in content.rstrip(newline).split(newline)]
transposed=list(map(list, zip(*matrix)))
notepad.new()
for line in transposed:
editor.addText(delimiter.join(line) + newline)
if len(transposed)!=len(matrix[0]):
console.clear()
console.show()
console.write("Warning: some rows are of uneven length. You might consider using the transpose_uneven script instead.")
transpose_uneven.py
import itertools
delimiter=","
newline="\n"
content=editor.getText()
matrix=[line.split(delimiter) for line in content.rstrip(newline).split(newline)]
transposed=list(map(list, itertools.izip_longest(*matrix, fillvalue="")))
notepad.new()
for line in transposed:
editor.addText(delimiter.join(line) + newline)
Examples
The transpose.py script will transpose the following example:
0xC1,0x80,
0x63,0x00,
0x3F,0x80,
0x01,0xA0,
To:
0xC1,0x63,0x3F,0x01
0x80,0x00,0x80,0xA0
,,,
If some of your rows are uneven:
0xC1,0x80,
0x63,0x00,
0x3F,0x80,
0x01,0xA0,
0x02
The uneven columns will be discarded accordingly:
0xC1,0x63,0x3F,0x01,0x02
If this is not desired, use transposed_uneven.py and it will return:
0xC1,0x63,0x3F,0x01,0x02
0x80,0x00,0x80,0xA0,
,,,,
If you really have such a fixed format and need such a fixed output i normally try it with an instant macro.
So my cursor is in the top left corner of the file ready to manipulate and i press the record button (or within the menu bar Macro - Start recording).
In you specific case now press:
End
Del
Pos1
↓
End hit the stop button (or within the menu bar Macro - Stop recording).
Now for a first test hit the playback button (or within the menu bar Macro - Playback) and test if it works. If yes click on Macro - Run a macro multiple times and select Run until the end of file.

Making Dreamweaver more like Notepad++

I'm moving to Dreamweaver from Notepad++, and while Dw does have many better features than Notepad++, there are a few that I'm really missing.
Is there a way to make the "Home" key on the keyboard take you to the front of where the code starts, instead of the very front of the line? In Notepad++ this is how it works by default, and I don't know why anyone would want to go to the very front of the line instead of the front of the code. I use tabbing to keep it more organized, so this feature is really important to me.
How do I duplicate a line in Dw? In Notepad++ I can select the line and press ctrl + d and it automatically duplicated the code. This is awesome for something like a gallery or a table where I don't want to have to type out every line because it's so similar.
Less important, as I don't use this that often, but can you vertically select in Dw? In Notepad++ you can hold down alt and select lines vertically. Ex:
http://dl.dropbox.com/u/12147973/vert-select.jpg
Thanks in advance.
For #2, check out the Code Extras extension for Dreamweaver
No Longer works in DW5.5; Try here - http://yoropan.com/en/archives/544
I was also wanting some of this features... I discovered that, at least in CS6, #2 is already in Dreamweaver, but the shortcut is Ctrl+Alt+Down ou Up, depending on the direction that you wanna duplicate the code.
Note that I had to disable the shortcut that turns your screen view for that to work. (It's an intel default, press Ctrl+Alt+f12 to open the options)
And tãa dãaa... IT WORKS! :D
I want to say one thing different. My Dreamweaver theme (Users who use Dreamweaver after use Notepad++). Download Dreamweaver.xml
"Dreamweaver.xml" file is in here for windows: C:\Program Files\Notepad++\themes\Dreamweaver.xml
The answer to #1 = Ctrl+Home in anything in windows will take you to the absolute start of the documents, same as Ctrl+End, Home and End to start and finish of lines, Ctrl+Left or Right arrow to jump entire words...
I too am on the quest for duplicating lines in DW. #3 your image no longer shows.
If I want to duplicated a line I click on the line number, then CTRL+C to copy and CTRL+V to paste. Is that what you're looking for or am I being simple?