I'm using Sublime Text 3, and I am trying to not use arrows for anything. However I can't seem to scroll through different results of
Ctrl + P
without the arrows.
Any suggestions? Thanks!
Well, you could just leverage the fuzzy completion of Sublime Text by entering somefile .cpp or somefile .h (notice the space).
Related
How can I cancel an ongoing search in sublime text?
basically when I do a recursive folder search for a particular text using
ctrl + shft + F
But sometimes it runs infinitely given a bad search pattern.
How to cancel a bad search of course without closing Sublime text?
One of the way to stop the search I use is to search again with an invalid path.
That does the trick for me. Hope that helps
It is currently not possible to stop a "Find in Files" search once it has begun. Closing the "Find Results" panel or tab doesn't affect it - it only means you won't see any further results that are found.
It has been logged as an issue here:
https://github.com/SublimeTextIssues/Core/issues/1481
Looks like closing/re-opening Sublime stopped my search. Since Sublime starts up quickly with your previous tabs, this should be an easy operation.
I believe if that panel is in "focus" you can simply hit the ESC key.
I have some code like:
testVar = { a: 1 };
testVariable1 = 2;
var c = testVar.a + testVariable2;
var d = testVar;
I want to rename "testVar" variable. When I set multiple cursors with Ctrl+D and edit variable, "testVariable" is also selected and edited.
Is there a way to skip some selections while setting multiple cursors with Ctrl+D?
Just use Ctrl+K, Ctrl+D.
(for OS X: Cmd+K, Cmd+D)
Needs a bit of practice, but gets the job done!
You can press Ctrl+K and Ctrl+D at the same time to skip a selection. If you went too far with your selection, you can use Ctrl+U to return to a previous selection.
Note: Replace Ctrl with Cmd for Mac OS X.
The default configuration for this can be viewed by going to Preferences > Key Bindings-Default in the application menubar, where you will see something like this:
{ "keys": ["ctrl+d"], "command": "find_under_expand" },
{ "keys": ["ctrl+k", "ctrl+d"], "command": "find_under_expand_skip" }
If you want, you can configure the keys as per your needs, by going to Preferences > Key Bindings-User and copy the above code and then change the keys.
If you have the cursor over the word and use Ctrl + D to select the word. The next time you hit Ctrl + D it should select the next highlighted word.
If you double click to select word, Ctrl + D will select the exact string not just the highlighted ones.
In other words, Ctrl + D with nothing highlighted does whole-word search. If you have something highlighted already, Ctrl + D will do substring searching.
I have tested and it works in Sublime Text 2 Version 2.0.1, Build 2217.
Place curser before the variable, do not select the variable, hit Ctrl+D to select every occurence of the variable, not pattern.
Updated answer for vscode in 2020 on windows, in keybindings.json add this line to skip the next selected occurrence easily:
{
"key": "ctrl+alt+d",
"command": "editor.action.moveSelectionToNextFindMatch",
"when": "editorFocus"
},
*yes I know the question is for sublime text, but I found it by googling the same question + vscode, so it might help someone since the mappings are identical.
I think I get why it was confusing to me: This is not skipping, it's unselecting.
You hit Ctrl+D as usual and if you select one by mistake you do Ctrl+K, D where you first press the K and then the D without letting go the Ctrl. This unselects the selection.
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 look around for the preferences in TextMate and there seems to be no method to set the indent to 2 spaces when we highlight some code and choose
Text -> Shift Right
Right now it is indenting 4 spaces but is there a way to make it 2?
It's on the bottom bar off the application towards the middle.
It'll say something like 'Soft Tabs: 4' if you click it you can change it to do 2 spaces for tabs.
Also you can edit multiple lines by holding Option and dragging your mouse along the spot in the lines. When you type, the text will be on all the lines you selected at that spot.
You know in Xcode, you can press option - command - left/right arrows to switch between multiple files. But what are these files?
They seem to be the ones that have been opened. But is there any way to check what they are? And close some unwanted ones.
Or, any other way you know to switch between files??
alt text http://img19.imageshack.us/img19/8724/picture4asx.png
if you click on untitled.m it will bring up the 'history' although it really functions more like multiple open documents per window.
The 2 arrows to the left of it are equivalent to the command+option+arrow
command+shift+W will close the current open document and open the most recent
I dearly miss ctrl+tab for recent document list like in Visual Studio, Eclipse and others. They do it with the application switcher so why not in their editors ? And whats up with "Command + Option + Shift + T" shortcuts ? One thing I have noticed after switching to Mac is the use of lame shortcuts like that, "press cmd+ctrl+option+]+k to open bla bla". Have Apple developers 4 hands or something ? If I want to indent multiple lines it should have been just tab.
Apple and 3rd party developers doesn't seem to follow a standard like they do in the windows world, every app has its own way of doing things.
Your guess about
They seem to be the ones that have
been opened
is correct.
Here is some ways you can use to switch between files.
^1 popups loaded files
Command + Option + Up to switch between declaration and implementation files.
Command + Shift + D to quick open project related file.
Command + Option + Shift + T to reveal your file in the group list. And then select related one.
"Popup of include files" is also good one to browse files related to the current one.
"View -> Smart Groups -> All Files | Symbols | etc " and then Tab and type first letters. Tab. And choose one you want. Bind some keys for that.
Simpliest: Two finger swiping on the trackpad left-and-right.
Command + Option + left / right arrows - collapse code
Command + Ctrl + up / down arrows - switch between .h and .m
Command + Ctrl + left / right arrows - move backward / forward