How can I bring current line of code or cursor in R Studio to the top of the page - rstudio

When I code in Rstudio I always end up coding at the bottom of the page, any idea how I can bring this to the top of the page without wiping clean my previous code with Ctrl + L:

Related

how to go navigate to the previous cursor locations in Visual Code Editor?

Do you happen to know how to go back ( and further back ) to the previous cursor locations in Visual Code Editor?
So far, what I do is a quick "undo" and "redo" just to see where I was but this is not only stupid but also extremely limited as it can go back to only to the last cursor position and not unable to go further back.
Use Case Scenario:
1) you are on line 1, did something there.
2) you then goto line 100 and did something else there too.
3) you goto line 200 and you just made a change or you just happened to place the cursor there
4) then you happened to visit 300.
Let's keep it there, for now.
Here is the deal:
How do you go back to where you were a few steps back so that the following is possible;
You do your keyboard-combo and you are first taken back to line 200 and then you do the combo again, you are now at 100 and finally you made your way back to #1.
On Windows:
Alt+← = navigate back
Alt+→ = navigate forward
On Mac:
^ control+- = navigate back
^ control+⌘ command+- = navigate forward
On Ubuntu Linux:
Ctrl+Alt+- = navigate back
Ctrl+Shift+- = navigate forward
For the mac, that would be CTRL - for the backward and CTRL SHIFT - for the forward. The - means the minus key.

Visual Studio 2015 - arbitrary cursor position on empty line

Initial note: I'm not getting any responses over on superuser to my question, so please allow me to ask this here:
I inherited a VS solution with a bunch of unorthodox settings. I'm not at liberty to wipe out all those settings and start over. So there is 1 setting I want to change back to VS default but cannot find it.
In a normal/default VS c# environment, when you click the mouse on a line of code that hasn't been written yet (empty, no spaces, no code, no tabs), the cursor automatically positions to the beginning of where the line of code should begin. If it's just inside a foreach, if, or etc, it will indent a bit from the left edge according to tab rules, etc.
But in the weird VS settings I have, wherever I click, the cursor positions at that exact spot. So if I click on col 20 of the next line, the cursor remains at col 20 rather than auto-repositioning to col 5 or wherever it should be. This is SO annoying because I can't always eyeball where the cursor should be and I end up clicking at the end of the previous line, then hitting ENTER, at which time it goes to the next line and positions the cursor at the right place.
How can I fix this?
It is controlled by the Enable virtual space option. See Visual Studio options - Text Editor - C#. By default it is off/unchecked.
I resolved this issue by applying Sergey's suggested change (Visual Studio options -> Text Editor -> C# -> Enable Virtual Space [check]), but also enabled (Options -> Text Editor -> C# -> Tabs -> Smart).

Xcode page jumps randomly when use return, page up/down and arrow keys

When I use page up/down and arrow up/down the page will jumps to some random position.
For example:
at line 2000, hit page up
the page jumps to line 50 (the cursor is
still at line 1950 for example)
hit arrow up key
page jumps back to line 1949...
Basically any key that moves the page, will randomly trigger the page jump issue, but cursor remain correct position and page scrolls back when use any key move the page again...
This is so irritating, I've tried remove all Xcode settings to original and no use...
Thanks for help!

XCode 5 -- Jump To Previous Cursor Location

I would like to jump to the previous cursor position within a file in XCode 5 (with either a keyboard hotkey or a drop-down menu path).
This SO post worked for XCode 3: Does XCode have a cursor navigation stack like Visual Studio?
But for XCode 5, I could not find this functionality here: http://cloud.github.com/downloads/Machx/Xcode-Keyboard-Shortcuts/Xcode_Shortcuts.pdf, nor in the Apple Documentation here: https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/xcode_help-command_shortcuts/Introduction/Introduction.html#//apple_ref/doc/uid/TP40010560-CH1-SW1
EDIT
Sorry I wasn't clear earlier. I do not want to switch between files. As the answers below state, that is what ctrl+cmd+left/right does. I want to switch between cursor positions within a file. For example:
I am working in MyViewController.m.
I write a function -(void)doStuff at line 178.
In -(void)doStuff, I realize that I need to update an #property to be readwrite.
I go to the top of MyViewController.m to line 10. I add the line #property (nonatomic, strong, readwrite) NSMutableArray *myArray;
Now I want to return to finish writing my -(void)doStuff method. What is the best way to get there? This is when I'd like to say "Go to the last text cursor position."
As Owen commented on your post, I believe the behaviour you want is to Go Forward/Backward, which is a behaviour represented by those two arrows at the top left of the text entry field:
In the pdf you linked these actions actually have shortcuts to the keys cmd+control+arrow, where the arrow key you press represents forward/backward motion through your XCode behaviour (left being back, right being forward).
A useful trick I found is to bind opening the Document Items menu (by default Ctrl + 6) to something easier to type for me. Then when I'm about to, say, jump to some method definition (that may or may not be in the same file I'm already in), I first open the Document Items menu then just hit Enter. That marks my current location in the navigation stack. It also marks the line the cursor is at in the current method, too.
It takes a little training to remember to mark your place, but being able to open that menu and hit Enter quickly from the keyboard makes it less painful to force Xcode to mark your navigation within a single file.
cmd+ctrl+arrow can work in this situation. But, it depends on how you change cursor locations.
If you use a file navigation control to change cursor location, cmd+ctrl+arrow will work. ctrl+6 switches to a method within a given file. If you start on line 178 then ctrl+6 to switch to another method on line 10, cmd+ctrl+arrow will return your cursor to line 178.
If you manually change cursor location, cmd+ctrl+arrow will not work. If you start on line 178 then scroll to line 10, cmd+ctrl+arrow will not return your cursor to line 178.
I was searching for this for so long time and what works for me is:
⌃ + 2 (Ctrl + 2 - Shows previous history) then click ↓ - this will jump back to previous definition
⌃ + 3 (Ctrl + 3 - Shows next history) then click ↓ - this will jump to next definition
This will only work if you navigate through your class using ⌃ + 6 to jump between definitions.
Unfortunately Xcode does not comes up with this feature . but If you are going to different line for copy content to paste to previous location then tricky using (Undo and Redo) Command + Z and then Shift +command +Z shortcut key one short simulate same effect.
Ctrl-command-leftKey does exactly that. (It's called "Go Back" in the documentation).

How do Visual Studio 2012's navigation buttons behave?

In Visual Studio 2012's IDE, I've noticed that there are now forward and backward navigation buttons, analogous to a web browser.
Within Solution Explorer, it seems these buttons allow you to navigate back and forth between searches. See this article for more details.
However, these navigation buttons also exist in the Toolbar directly beneath the IDE's main menu. Playing with these buttons seems to control which document windows are activated, but I can't find a blog post that explains their exact behavior.
Is there a blog post or online spec that describes exactly what these navigation buttons do?
The Navigate Forward/Backward buttons in the standard toolbar let you navigate to previous locations in your navigation stack, whether or not they are in different documents as you mentioned.
For example, you may be looking at some method "foo" which calls another method "bar" and you press F12 to see what's happening inside "bar". When you do so, the location in "foo" where your cursor was is pushed onto the navigation stack and when you press the Navigate Backward button, you are back in "foo", exactly where you left off.
Other examples of situations in which the navigation stack is added to are (from the blog post linked below):
Incremental search (including reverse) leaves a go-back marker at beginning of search and another one at the end.
A GoToLine or a Mouse-click that moves the cursor 10+ lines from current position (so 11 lines and more) drops a go-back marker at new
location.
A destructive action (after having moved the cursor to a new location) drops a go-back marker
Doing a Find (Ctrl+F) drops a go-back marker at the found location
Opening a file drops a go-back marker wherever the cursor was on the old file, and drops another on the opened file.
Also, it's worth knowing that the buttons have keyboard shortcuts (Ctrl + -) and (Ctrl + Shift + -).
For more information, see this blog post.

Resources