eclipse - put current line to top of screen/editor window? - eclipse

How to put current line at the top of screen/editor window/viewport?
I looking for something exactly similar to that is achieved in vim using Shift + H or z<return>.
Do anyone know about such a config? It would be a great navigating tip.

You can use the 'Recenter' command to do this. Running this command cycles through moving the cursor line to the center line, then the top line, then the bottom line.
By default this command is not bound to a key so you need to open Preferences > General > Keys. Find Recenter and add a key binding.

Related

Is there a way to add a cursor to a specific line number in vs code without the mouse?

I really like the multiple cursor option in vs code.
With the mouse I can just Alt + Click any line I want to add a cursor to that specific line.
My question is if there is a way to do this with the key board? I have tried selecting current line and Ctrl + G to go to a specific line number, but then I lose my initial selection. I would like to have a cursor on the current line plus any line I choose at same time without using the mouse.
Does anyone know if this is possible? I tried a quick google search and searching here in SO, didn't see anything for this specifically.
Any help much appreciated!
With the extension Select By you can modify a Multi Cursor with the keyboard.

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 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.

How to move out of auto-completed brackets in IntelliJ IDEA (without using the arrow keys)?

I recently switched from Eclipse to IntelliJ IDEA, and found myself wondering how to move the cursor out of a pair of auto-completed brackets.
In Eclipse after I finished typing in a pair of brackets, pressing tab brings me out of the brackets. How can I do the same thing without using the arrow keys?
Many thanks for your help!
IDEA doesn't have such feature yet. The closest equivalent is the Complete Current Statement editor action (Ctrl+Shift+Enter).
UPDATE
Initial implementation for this feature is available in 2018.2 EAP version - press Tab to jump out.
It works more like in MS Visual Studio - without visual indication of tab 'exit' position. For now, it should work in Java, SQL, Python and some other files. It will take some time for other languages to catch up - some language-specific code changes are required.
The feature is disabled by default, you can enable it in
Settings -> Editor -> General -> Smart Keys -> Jump outside closing
bracket/quote with Tab
Ctrl + Shift + Enter does not seem to work for me in IDEA 12.1.4, but I found the closest feature to what I was looking for was Shift + Enter. This completes the line, creates a new line below the current line and moves the cursor to it.
You can do this by pressing the closing symbol that you would've pressed otherwise, but was auto completed. For example, if you have just typed the f below, you would press shift and 0 (or closing parenthesis), and it will move your cursor outside of the parenthesis.
String asdf = "hello world";
System.out.println(asdf);
I went to preferences->Keymap and set a shortcut for "Move Caret to Line End" to Shift-Space. It takes me to the end of the current line I am on without adding anything, if that's what you want.
Not currently supported by Intellij. There is an open feature request on this at http://youtrack.jetbrains.com/issue/IDEA-74666. Extra votes would be nice.
Intellij supports the ctrl+shift+m shortcut that jumps to the end of the block:
https://www.jetbrains.com/help/idea/2016.2/navigating-to-braces.html
It's not quite what you're looking for, but you can type the character you are trying to move outside of (a closing paren, for example) and that should pop you outside of the auto-completed character.
Not ideal, but functional as far as I've tested it.
I set these setting:
1) I added Semicolon shortcut to Complete Current Statement:
Instead of using for loop command, I using fori command (because for command needs semicolon character):
2) I added Alt+Semicolon shortcut to Move Caret to Code Block End:
So when I inside the loop, by pressing Alt+Semicolon jumping end of the bracket, by pressing Semicolon I jumping out the bracket subsequently.
by adding these shortcuts, the speed of coding will be faster.
Such key is called "End".
You can assign any unused shortcut to "Move Caret to Line End" action in "Settings/Preferences | Keymap".
P.S. You can use Ctrl+Shift+Enter to complete your statement (in your case it will place caret at the end of line and will add ";" there) -- action called "Complete Current Statement" and shortcut can be checked/changed in a same way as described earlier.
If you decide to move back to Eclipse and use PyDev this feature by default is disabled, First Switch to PyDev Perspective and you can enable it by going under Preferences>PyDev>Editor>Typing>Enable link on Automatic parenthesis or literals closing

using idioms in vim for perl

I have the perl-support plugin enabled. now, I tried the \idd idiom shortcut which would give you a my ($,$); statement with the cursor placed on the first var. Now the second var is displayed as <+name+>. In effect the my line after entering the first variables name would be
my ( $top, $<+name+> );
If it was a code snippet I could have easily used tab to go to the next field, but it is not working in this case. How do I quickly move to changing the 2nd part of the idiom?
Those are jump targets, and you can visit them with Ctrl+J. See perlsupport-templates-jump for details.
If this is VIM, why don't you just use VIM's navigation keys for this?
3W (that is a capital W) will move you three words to the left, right onto $<+name+>.
You could also try:
f< to put the cursor on the <, and then you can change <+name+>.