Keyboard shortcut to move cursor to last edit position in Visual Studio

14,838

Solution 1

This shortcut was added in VS2017 version 15.8:

Ctrl + Shift + Backspace

It's near impossible to find via google, I just stumbled across it when reading the VS news and release notes.

Go To Last Edited Location

We all know the feeling of starting to write a feature and then realizing we need some more information from elsewhere in the solution. So, we open another file from Solution Explorer or Go to Definition in a few places and suddenly, we’re far off from where we started with no easy way back unless you remember the name of file you were working in originally. In Visual Studio 2017 version 15.8, you can now go back to your last edited location via Edit > Go To > Go To Last Edit Location (Ctrl + Shift + Backspace).

https://blogs.msdn.microsoft.com/visualstudio/2018/08/30/improving-your-productivity-in-the-visual-studio-editor/

Solution 2

In my VS I can use CTRL + -. I am not sure if this Works in all Versions and With different keyboard layout.

Solution 3

You can do Ctrl + z, Ctrl + y.

This does an undo/redo, so your code will not be affected, but your code window will be moved to the last edit location.

I have Visual Studio 2010, and this does the trick for me.

Solution 4

You can use Ctrl + - (View.NavigateBackward) shortcut.

Solution 5

I always use Ctrl+Shift+Backspace.

Share:
14,838

Related videos on Youtube

Yariv
Author by

Yariv

Updated on June 06, 2022

Comments

  • Yariv
    Yariv about 2 years

    In Visual Studio, is there a keyboard shortcut to navigate (move cursor) to the last edited position (like PyCharm's Ctrl+Shift+Backspace)?

    The CTRL + - shourtcut moves to the last position (not the last edited position), which is less useful for me.

    • Lambart
      Lambart about 10 years
      Another existing implementation: Eclipse, which uses Ctrl-Q to jump to the last edited position.
    • Arpit Jain
      Arpit Jain about 8 years
      @yariv Did you find the shortcut?
  • c0dehunter
    c0dehunter over 9 years
    .. or assign a custom shortcut for View.NavigateBackward.
  • Alonzzo2
    Alonzzo2 about 9 years
    I use this method also, only it doesn't work on multiple files - only on the last file
  • Glenn
    Glenn over 8 years
    This doesn't do what the OP requested - "to the last edited position"
  • Glenn
    Glenn over 8 years
    Again this doesn't do what the OP requested - "to the last edited position"
  • Glenn
    Glenn over 8 years
    This is the only correct answer given the OP's question - "to the last edited position". I also use this method, but was hoping to be able to cycle through the list to edited positions.
  • Tom Sawyer
    Tom Sawyer over 7 years
    Thank you, I was seeking this info!
  • Grey Wolf
    Grey Wolf over 6 years
    this is visual studio, only vs2008, vs 2010, vs 2013, 2015 and 2017, what do you mean 1.8.1
  • jciloa
    jciloa about 6 years
    It works most of the time for me, but not always, unfortunately. Not sure what it depends on.
  • bugybunny
    bugybunny over 5 years
    Via another answer: this was only added in VS17 (15.8). This was only released in April 2018 and the post is from June 16 ¯\_(ツ)_/¯ Edit.GoToLastEditLocation is the binding for it if you want to change the shortcut. I changed it to something better accessible (only two keys)