VSCode - Shortcut to copy Current Line - visual-studio-code

What is the shortcut to copy current line in VSCode?
I know we can Ctrl+L to select the line then Ctrl+C to copy. But is there any better solution. For example, in Geany, we can Ctrl+Shift+C to copy the line where the cursor is.
To be clear I am not talking about Duplicate line in Visual Studio Code

Here is your solution for your problem
Just press the Ctrl + C without selection it'll copy entire line and you can past it wherever you wanted,
Please read below solution for the query you ask in your question's comment
Stackoverflow don't have the close option but you can delete the question from you profile or you can follow the explaination to mark your question closed from the below link:
https://shodhganga.inflibnet.ac.in/bitstream/10603/32435/11/11_chapter%203.pdf

Another alternative to the accepted answer that I often use is SHIFTALTDOWN which duplicates the current line to the line below (likewise, SHIFTALTUP duplicates to the line above). Once you get the copy of your line you can use ALTUP/ALTDOWN to move it wherever you want. This works well if you are wanting a copy of the line in the near vicinity of the current line.

Go to File ==> Preferences ==> Keyboard Shortcuts, and update the copy line shortcut entry with any combination you like.for example Ctrl + DownArrow is good for me.

Related

Copy/move rest of the current line to the end of next line

I have Googled a lot but cannot find one feature in VScode that I would appreciate greatly:
Copy (or move) rest of the current line (i.e. not the entire line) to the end of next line
Example:
What I have - note the cursor
What I need - again note the cursor
So ideally, with a single keyboard shortcut, I would copy (or move) the remainder of the current line (= "ABC1" in the example) to the end of the next line. Any ideas how to do that? Is it available within VScode, or is there a relevant extension? Thanks!
Since you're asking if there's an extension for it, the vim extensions should at least be mentioned. I have no intention or desire to start an(other) editor war, though.
What you're asking would be trivial in vim (y$, yank to end of line) and there are at least two very popular vim extensions for vscode that will bring the vim keybindings as well as the power of configurable commands and bindings in vim to vscode.
Yes, it would require some effort to learn the "vim way" of doing things, but the upside is that you'll probably never have to re-learn the bindings if you move between editors/IDEs since they are available in pretty much every editor and they make editing very fast and precise.
Drag and drop by mouse
Why are you not using mouse drag and drop text?
Select the text and drag it by mouse where you need
Otherwise, if you have multiple times then you can solve it in two steps.
Step1:
Replace all Name by Name(ctrl+enter)SecretCode
Step2:
Replace all "(ctrl+enter)SecretCode by "
Done

How to go back to previous concurrency in VScode?

When I edit code in vscode, I often use ctrl + D to select the next word that matches the current one, but sometimes I would like to return N number of words.
Does anyone know if this is possible in vscode or is there a plugin?
Thanks!
PD. Vim has the plugin Multiline for it
The answer provided by the user rioV8 was just the solution to what I needed.
Use Ctrl+U to go to the previous match and Ctrl+K Ctrl+D to jump to the next match without selecting the current one.
Thanks!

How to select whole line in VSCode

I am using VSCode on a Mac.
Does anyone know how to select the entire line that the cursor is on? I know about Command+I, but that only selects what appears to be the whole line, which is not always the whole line if I have word wrap enabled.
I am looking for something like Sublime Text's "Expand Selection to Line" command.
All you need to do is put the cursor anywhere on the line, do not make any selection at all and then do the desired command (Cut, copy, or paste).
When no text selected, VS Code will automatically select the entire line.
just triple click the end of the line it will select the entire line
Triple click at any point on the line
Click once on number of the line
Press Command + L
An alternative to what people have posted is, when your cursor is at the start/end of the line, you can hit shift + end/home respectively.
I find this useful for wrapping a line in curly braces/quotes/etc. whereas the other answers include spaces in the select so whatever you're wrapping it in will be wrapped around that whitespace.
Install the MetaGo extension and use the "metaGo: selectLineDown" command, which will come installed already overriding the "expandLineSelection" command.
This extension has many additional commands that you'll likely find useful as well, including moving up/down over code blocks, centering the active line, and going to any character on the screen.
Now, when I press Command+I, the whole line is selected. I am guessing this was caused by an update to VS Code, but I am not sure.
Ctrl + L on Windows or Command + L on Mac to select the whole line in VS Code.
You can use your mouse to select the whole line by triple-clicking on the line but the better way is to click on the line number to select the whole line or multiple lines.
Tripple click at any point on the line
In case you're wondering why Cmd+L is not working, there might be a chance that there are duplicate shortcuts. You can find out by opening Keyboard Shortcuts in VSC and remove the one that's not needed.
I know its old but for anyone seeking, you can press Alt + arrow up/down to duplicate your cursor to other lines and then without selecting anything copy and paste multiple lines.

A quick way to select a line in netBeans

I am looking for a quick way to select a line in netBeans.
For example for copy and paste. (in vim editor yy yank current line)
Most GUIs, including Netbeans, allow you to select a word by
double-clicking on it and an entire line by triple-clicking on it.
OR
selection-end-line (Shift+End)
selection-down (SHift+Down) for as many lines as you want.
I've been using Netbeans for a few months.
Ctrl + c will copy the entire line without selecting it.
Ctrl + e will delete the line without selecting it.
Ctrl + Shift + down or up arrows will duplicate the line.
I am late comer to this post, but with a solution. In netbeans 8.x, go to Tools -> Options -> Keymap. In that, search for Select Line. You will get an entry there. Under the field Shortcut, you can give your convenient shortcut. There is no shortcut by default

A quick way to delete a line in netBeans

I am looking for a quick way to delete a line in netBeans.
For example in vim you can just type dd for Deleting a line.
Does Ctrl-E not work for you? This is the default short-cut in NetBeans on a Windows machine.
If you click on Help you can get the keyboard shortcuts card, print it out, it's pretty handy and has saved me quite a bit of time hunting for easier ways to do things.
Press Ctrl + x, or Ctrl + e while your cursor on the line to be deleted.
The command will delete the line and place the cursor to the starting of next line.
For Mac command it is command+e.