Indenting in Codegear RAD Studio - c++

Is there a way to indent/tab multiple lines in one action in the Codegear RAD Studio IDE?
i.e. I would like to be able to highlight multiple lines and indent them all by one tab simultaneously.

Seth
to indents selected code
Select the text and press Ctrl + Shift + I
to unindents selected code
Select the text and press Ctrl + Shift + U
Bye.

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/

Is there a shortcut in postman to comment a line?

I am looking the Postman Shortcut panel but I don't see a shortcut to comment part of my code in a request body, it is very annoying to copy and paste <!-- comment--> to make a comment.
According to the shortcut panel Ctrl + / open the shortcut panel but I accidentally did it in the request body and it comments the line
For the Body, raw category, you can use the following:
Ctrl + k + c (Will comment your selection)
Ctrl + k + u (Will un-comment your selection but also Uppercase
everything)
I did not found other way to uncomment than deleting all the // bars by hand
I also found a nice work around on this link https://www.youtube.com/watch?v=bX4-cLPcD2Q
This was a Feature Request to the PostMan team. 21 days ago someone has added a comment asking exactly to revert a comment with Ctrl + K + U and also reporting the upper case issue. Let's hope they fix this soon.
https://github.com/postmanlabs/postman-app-support/issues/3358
UPDATE
The Post Team has fixed this issue so now you can use:
Ctrl + k + c (Will comment your selection)
Ctrl + k + u (Will un-comment your selection)
Even if the previous youtube trick is still valid, chances are it is not necessary anymore to create a pre-request script.
As of Postman version 9.31.0, if you select multiple rows Postman still makes uppercase whilst uncommenting, with the key combination: ctrl + k + u
Workaround 1: ctrl + รถ shortcut works well with my TR keyboard, it should be ctrl + . with the EN keyboard.
Workaround 2: That does not happen with single-line uncommenting, but you need to repeat it for each line (a bit annoying)
I have tried in postman and the below worked form me.
ctrl + k + c (Comments the line)
ctrl + / (uncomments the line)

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

How to do search/replace in Aptana JavaScript editor for selection only?

I was trying to replace single to double quotes for single declaration, I've selected the block, pressed CTRL+F, a nice search&replace panel shown up.
OK, I have Replace, Replace All. OK, I have also scope: Current file, Open files, Enclosing project, Workspace.
But where is selection?
How to replace the text in selection only?
I'm using Aptana Studio 3, build: 3.4.1.201306062137
Under Window -> Preferences
Aptana Studio -> Find Bar -> "Show Eclipse search dialog on 2nd Ctrl + F"
Then it's necessary to press CTRL+F 2 times, and the "clasical" search/replace dialog is displayed.

Remove empty lines in text using Visual Studio or VS Code

How to remove empty lines in Visual Studio?
Since Visual Studio 2012 changed its regex syntax, the original answers by Ala translate into the following in VS 2012:
Remove single blank lines
Old:
^:b*$\n
New:
^(?([^\r\n])\s)*\r?$\r?\n
Visual Studio 2013 (thanks to BozoJoe and Joe Johnston):
^\s*$\n
Remove double blank lines
Old:
^:b*\n:b*\n
New:
^(?([^\r\n])\s)*\r?\n(?([^\r\n])\s)*\r?\n
Rolls right off your tongue.
Here is the conversion sheet from MSDN.
It's very useful especially if you want to arrange or compare codes, thanks to the people who answer this question, I've got the answer from here and would like to share it with Stackoverflow:
Visual Studio (Visual Studio Code) has the ability to delete empty lines in replace operation using regular expressions.
Click Ctrl-H (quick replace)
Tick "Use Regular Expressions"
In Find specify ^$\n
In Replace box delete everything.
Click "Replace All"
All empty lines will be deleted.
Regular expression for empty line consists of
Beginning of line ^
End of line $
Line break \n
Note that normally in Windows an end of line indicated by 2 characters crlf - Carriage Return (CR, ASCII 13, \r) Line Feed (LF, ASCII 10, \n).
A regex to remove blank lines that are/aren't really blank (i.e. they do/don't have spaces): ^:b*$\n
To remove double lines: ^:b*\n:b*\n replace with: \n
*** for Visual Studio 2013 and above:***
^\s*$\n
and for double lines:
^(?([^\r\n])\s)*\r?\n(?([^\r\n])\s)*\r?\n
See the regular expression syntax updates for VS2012 and above in #lennart's answer below
Using Visual Studio 2017 and above
in Current Document
use shortcut
Open Tools > Options or press Alt + T + O
Under Environment tab > Keyboard
Search for "DeleteBlank" and select Edit.DeleteBlankLines
Add a new shortcut for example Ctrl+D,Ctrl+E
Assign > OK
select all text and hit the shortcut
Tested in VS 2012 to allow for pure line feeds.
^\s*$\n
hth
In Visual Studio 2013 (Version 12.0.20623.01) i removed empty lines with this regular expression ^\r\n In the screen you can see the matched lines indicated by the brown squares.
I'm using visual studio 2017, non of the above worked for me until I tried \n\r
Steps:
Ctrl + H (opens find and replace)
Select use regular expression (Alt + E)
Enter \n\r into the "Find..." input
Press replace
To remove two or more adjacent empty rows with VS2012 use this:
^(?([^\r\n])\s)*\r?$\r?\n^(?([^\r\n])\s)*\r?$\r?\n
VS 2022 and 2019
Open the replace box: Ctrl + H
Turn on regular expressions: Alt + E
Find: ^\s*$\n
Replace: (leave empty)
Replace All: Alt + A
Turn off regular expression: Alt + E
Hide the replace box: Esc
Format the document: Ctrl + K and then Ctrl + D
Install CodeMaid and hit Ctrl+M, Space to clean up the code. (It formats the code, like Format Document Ctrl+E, D, as well). You can clean up more files from Solution Explorer.
To remove double lines: ^:b*\n:b*\n replace with: \n
Source: http://geekswithblogs.net/mnf/archive/2008/03/04/remove-empty-lines-in--text-using-visual-studio.aspx
In VS 2012, the regex string to use to find and replace all blank lines is ^(?([^\r\n])\s)\r?\n
in VS2019 I just used ^..$ since none of the other answer actually worked.
Ctrl + K, Ctrl+D auto formats the current document and that removes unnecessary space in your code. It helps keep your code readable if that what you were looking for.