How to move the cursor into empty space? Virtual space? - visual-studio-code

I use Microsoft visual studio code.
I am moving the cursor by pressing the arrow keys, but when I try to move it down at the end of a line, it moves to the beginning of the next line.
What I want is for the cursor to move to the same position on the next line.
Is there any way to achieve this?

Since vscode does not support the concept of "virtual spaces" there is no built-in way to do it. I found one extension that does do it though:
fake-virtual-space
There are some limitations but it does do what you want. In the demo below I am only using the up and down arrow keys to move the cursor to a new, previously empty, line.

Related

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.

When selecting line in VS Code with the shortcut Ctr+i, cursor jumps to the line below. How to avoid it?

When selecting line in VS Code with the shortcut Ctr+i, the cursor jumps to the line below.
Meaning if i press copy, it actually copies two lines...
Is there a way to force the cursor to stay at the end of the selected line?
editor.action.smartSelect.grow
seems to do what you want with some number of keypresses unfortunately. It is already bound to Shift-Alt-RightArrow but you ca rebind that command to something else less cumbersome.

Eclipse: Text Editing Without Mouse

I have bandage due to 5th metacarpal damage. Typing is no issue at all, I do hours of it and it's fine. Using a mouse... impossible. This is not about being a productivity ninja not losing the time it takes to reach for the trackpad or the mouse... it's actual being able to do some stuff or not at all for the moment. Anyway, here's the question, put simply and clearly:
In an Eclipse editor, can I move around using the keyboard only?
Examples of actual things I would like to be able to do without using a mouse:
Move the cursor to the end of the line
Move the cursor to the beginning of the line
Move the cursor one line down
Move the cursor one line up
Move the cursor one column left
Move the cursor one column right
Move the cursor one word left
Move the cursor one work right
Move the cursor to the end of the word
Move the cursor to the beginning of the word
Delete the character to the left of the cursor
Delete the character to the right of the cursor
etc.
I realise some of this is possible already using a mixture of END, HOME, CTRL/ALT + ARROW_KEY, etc. But it's not as comprehensive as, say, E-Macs or Vim.
As simple as that.
In Vim, I use j,k,h,l... in Xcode I use Emacs bindings (CTRL-N, CTRL-P, CTRL-H)... how can I use Eclipse in a similar way? I have heard of a "vim" plug-in but I really just need the cursor movement, that's it. Nothing else.
Should I just create custom shortcuts for each movement?!
Going to the end of the line: End key
Going to the start of the line: Home key
Going one line down: down arrow key
Move the cursor one line up: up arrow key
Move the cursor one column left: don't know what you mean by column
Move the cursor one column right: idem
Move the cursor one word left: ctrl - left arrow key
Move the cursor one word right: ctrl - right arrow key
Move the cursor to the end of the word: no idea
Move the cursor to the beginning of the word: ctrl - left arrow key
Delete the character to the left of the cursor: backspace
Delete the character to the right of the cursor: delete
This is on Windows. All the shortcuts are available in Window (Alt W) - Preferences (P) - General - Keys (type "Keys" in the filter text box). Most of the shortcuts above are standard shortcuts, which are used in every windows editor.
I found it :(
Preferences > General > Keys > Emacs
You can do almost everything with your keyboard:
Take a look here for a detailed list of shortcuts:
http://www.shortcutworld.com/en/win/Eclipse.html

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

Is there an equivalent to `line-mode` and `char-mode` (ansi-term) for multi-term?

Any time I try to move around in the buffer (besides moving up and down lines with C-p and C-n), my cursor is brought back to the command line so I cannot select and copy arbitrary text in the multi-term buffer. I can use my mouse to move to and highlight text, and all goes well from there, but is there a set of key bindings that will allow me to set the mark in other parts of the buffer? I looked in multi-term.el` but was not able to find anything that addressed this.
Try 'term-line-mode' and 'term-char-mode'