at the top of VS code breadcrumbs, theres a list of sibling files.
i want to open it with a shortcut.
By the way, to switch between files, I use CTRL+TAB
By pressing Ctrl + Shift + <, it both focus the last segment of the breadcrumb and selects it. You can then use the up and down arrow keys to select the file you need.
If ever your cursor is in a method for example, the keyboard shortcut I just describe won't exactly fit, as the last segment of the breadcrumb may not correspond to the file but to its outline content. In this case you may need to favor Ctrl + Shift + . instead which only gives the focus to the breadcrumb and then use the left arrow key to reach the segment you need and then select it.
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).
On osX, if you File > Find in Files... ⇧⌘F you're brought to the Find Results.
There you enter the 'find' field, Tab, Tab, 'replace' field.
My problem is how you can activate 'Replace' once you have done that without using a mouse to click the button.
If you press Tab from there it goes back to top line, and if you press enter it just performs a normal find.
Thanks !
I guess this helps you , check to this shortcuts
This one should activate the find and replace window ( ⌘ + ⌥ + F )
This one is like clicking the replace button once you fill the fields ( ⌘ + ⌥ + E )
let me know if it works
I couldn't find such feature in VS's shortcut list. Is there anyway?
If you want to copy a line, simply place cursor somewhere in that line and hit CTRL+C
To cut an entire line CTRL+X
#Sean found what I was looking for:
To disable this default behavior remove the checkmark (or check to re-enable)
Apply cut or copy commands to blank lines when there is no selection
Accessed from the menu bar: Tools | Options | Text Editor | All languages
You can also enter copy into the options search box for quicker access
[Tested in VS2008, 2010, 2017]
Clicking the line 3 times does the trick
If you have ReSharper you could use
Ctrl + W
- Extend Selection
Sidenote: You may have to use it multiple times depending on the context of your present text cursor position.
If you click once on the row number the entire row will be selected.
If you want to select a line or lines you can use the combination of ctrl + E then U. This combination also works for uncommenting a complete line or lines. This combination looks somewhat strange to work with, but it will get habituated very soon :)
You can also use Ctrl + X to cut an entire line. Similarly, you can use Ctrl + C to copy an entire line.
As long as you don't have anything selected, these commands will work on the entire line.
Clicking anywhere on the line and (CRTL + C) will copy entire line.
Clicking three time in quick succession also selects entire line.
There is a simple way of doing it, simple use Home or End button to reach the start or end of line, and then use home + shift or end + Shift depending on where your cursor is. Hope it helps.
Use the following:
Shift + End If cursor is at beginning of line.
or
Shift + Home If cursor is at the end of the line.
Alternatively, if you use resharper, you can also use the following
Ctrl + w while the cursor is positioned on the line you want to select
This won't solve the problem for Visual Studio, but if you're using Visual Studio Code you can use CTRL+L to select the line your cursor is currently on.
(If you're using Visual Studio, this will cut the line you're currently on—which may also be useful, but wasn't the question.)
Other answers require either using a mouse or hitting more than one combination.
So I've created a macro for those who want a VSCode-like Ctrl+L behaviour. It can select multiple lines, and that's useful for moving blocks of code.
To use it, install Visual Commander extension for macros: https://marketplace.visualstudio.com/items?itemName=SergeyVlasov.VisualCommander
Then create a new command, select C# as a language and paste this code:
using EnvDTE;
using EnvDTE80;
public class C : VisualCommanderExt.ICommand
{
public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package)
{
var ts = DTE.ActiveDocument.Selection as EnvDTE.TextSelection;
if (!ts.ActivePoint.AtStartOfLine)
ts.StartOfLine();
ts.LineDown(true, 1);
}
}
Now you can assign a desired shortcut in preferences:
Tested in VS 2022.
You can use CTRL + U . This shortcut is use also for uncomment.
You can change the shortcut on this feature. Go to Tools->Options->Environment->Keyboard->Edit.UncommentSelection and assign CTRL+W (same as Resharper) or you can use what shortcut do you want.
If you want to select full row Ctrl E + U
Just click in the left margin.
If you click in the margin just left of the Outline expansions [+][-]
it will select the row.
You can also just click and drag to select multiple lines.
Necvetanov eluded to this in his answer above about clicking on the line number.
This is right...but it just happens that the line number is in the margin.
Here is a whole list of the keyboard shortcuts Default keyboard shortcuts in Visual Studio
a work around for this:
ctrl+d = duplicate line
ctrl+l = copy line
ctrl+v = paste copied text
You can enter, home then shift + end as well. What it will do is take you to the beginning of line then select the whole line till end. Or alternatively first enter end then shift + home
You can set a bind to the Edit.ExpandSelection command:
In the options. Click the shortcut until it selects the whole line.
The screenshot above is from the Edit > Advanced menu in Visual Studio 2022. I set this Alt+E, E shortcut myself and I don't remember if it's originally set to something or not.
Simply by clicking on the line number that's being shown on the left in vs-code. just a single click and a line will get selected.
In Mac, it is ⌘+L.
But if you have some specific conflicting keybindings, this won't work. In my case the VSCode Live Server extension auto registered a couple of bindings for these keys. I removed them and it worked.
I assigned a shortcut key to the following functionality. I press the shortcut until it selects the whole current line:
Edit.SubwordExpandSelection
I did this before but can't remember how the heck I did it.
I want to have a button on my vb6 IDE toolbar that takes me back to the previous place I was in the code (in my "history) -- an incredibly useful feature.
I have it in my properties (right-click) menu but don't see it in the other menus from which I could drag it to the Toolbar.
Any ideas?
This should do it:
In the IDE right click an empty spot on your
menu and select Customize...
Select the Command tab in the Customize dialog
Select View from the Categories list.
On the Commands list you should see
an item called Last Position.
Drag this item to a toolbar.
#Jay's answer is right on. There are also handy shortcut keys for this feature and the related Definition feature:
Last Position: Ctl + Shift + F2
Definition: Shift + F2
In one of the toolbars in the sample applications?