How to move line up in Mac for Sublime Text? [closed] - keyboard-shortcuts

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
On OS X when I use the shortcut provided in documentation (⌘ + ⌃ + Up which I read as Command + Shift + Up) Sublime Text selects the text instead of moving the line up. Am I missing something?

According to https://docs.sublimetext.io/reference/keyboard_shortcuts_osx.html, it should be Command+Ctrl+Up.
⌘ = Command
⇧ = Shift
⌥ = Option (a.k.a. Alt)
⌃ = Ctrl
⎋ = Esc
↩︎ = Return
⌫ = Delete (a.k.a. Backspace)
See also https://apple.stackexchange.com/questions/42615/is-there-a-list-of-menu-shortcut-icons for the meaning of the symbols.

I could not track down what was causing the key binding collision, so I set user key bindings in Sublime Text to an alternative. To do this, open Sublime Text. In the top menu navigate to Sublime Text > Preferences > Key Bindings then add these hashes to the array with the alternative key binding of your choice:
[
{ "keys": ["ctrl+alt+shift+super+up"], "command": "swap_line_up" },
{ "keys": ["ctrl+alt+shift+super+down"], "command": "swap_line_down" },
]

"control" + "cmd" + up (in Mac)

Command+Ctrl+Up
In a Visual Studio Code, configured with Sublime Text Keymaps, you can also use:
Option+Up

Related

How to center the editor window back on the cursor in VSCode?

I'm using VSCode as my text editor. I'm curious, is there a keybinding for centering the editor window on the cursor, when the window is a lot of lines below/above it such that it's not visible on the screen? I've tried looking at the default keybindings by going to FIle > Preferences > Keyboard Shortcuts, but I see no such options for centering the window.
There is no such keybinding / command built-in.
I couldn't stand that either, so I created a VSCode extension. You can find it and install it here on the marketplace. The default shortcut is CTRL + L.
If you are using vscodevim, zz should work.
If you want to always keep the cursor on the center, you can change the setting Cursor Surrounding Lines to a really high number (100 is ok) and that should work.
As #kwood put it, there is an extension Center Editor Window in the marketplace that meets this end.
I would like to make an answer here, to complement that -- even the extension's author did not explicitly state in the marketplace page -- if you would like to change the default key binding (Ctrl+L), you may try put the following lines in the keybindings.json for the keyboard bindings.
{
"key": "cmd+k cmd+c",
"command": "center-editor-window.center",
"when": "editorTextFocus"
},
The above command sets ⌘ Command+K, ⌘ Command+C as the keyboard shortcut.
Apart from that, you may set
"center-editor-window.threeStateToggle": true,
in the settings.json for VS Code settings so that it will switch among three states (center, top, bottom) instead of one (center).

In WebStorm, is there a way to collapse all the elements at my current level

We have a common structure in our code where we have several related classes in the same file with several methods in each. What I would like to achieve is to fold all the methods in the class I'm in so that I could get a good overview of the "moving parts" in this class.
I know there is the Collapse Recursively method, but the problem with that is that it fold all the inside parts of the methods, so that when I want to dig in, I can't.
So my question is, is there a way (complex as it may be) to collapse all the elements at my current level (with a keyboard shortcut)?
So my question is, is there a way (complex as it may be) to collapse
all the elements at my current level (with a keyboard shortcut)?
Key board short cut :
Hold down ctrl shift - to collapse them all.
If anyone uses Mac OS:
command + shift + -
I found this question while attempting to find an answer myself. The two existing answers ignored parts of the original question. This question is very similar to this other question, but with the explicitly stated requirement that the code within the method blocks should not be folded.
The other question has a better answer:
Code -> Folding -> Expand all to level -> 1
The naming on this is a little weird because it says "Expand" when you're really trying to collapse all method bodies. But if the method bodies are already expanded, this will collapse them. The shortcut for this is ctrlshiftNumPad *, 1. If you find that shortcut combination cumbersome or don't have a num pad, you can create your own shortcut by going to Preferences -> Keymap.
This seems to me like the perfect solution. It won't expand or collapse any blocks at other levels. So if you manually collapse a block within a method body, this will leave it collapsed.
If that's not your preference, and you want it to expand all blocks within the method bodies while collapsing the method bodies themselves, you could create a macro that runs Code -> Folding -> Expand All followed by Code -> Folding -> Expand all to level -> 1, and then map your keyboard shortcut to that macro.
Collapse all:
Windows and Linux : CtrlShift-
Mac OS : CommandShift-
Collapse current scope:
Windows and Linux : Ctrl-
Mac OS : Command-
Collapse Reccursively:
Windows and Linux : CtrlAlt-
Mac OS : CommandAlt-
Note: You can change this hotkeys in Fille -> Setting -> Keymap
try
hold down ctrl and press the minus key
example :
ctrl -
to collapse the current block
My default keymap is Xwin. but hopefully it should work out the same.

Webstorm clear "recent files list" from the "Open File or Project" wizard [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
In Webstorm version 9, when i open a project or file it remembers every file that i opened in the "Open File or Project" wizard.
I open the wizard by navigating to "File" ==> "Open", and then click the "Recent files" icon.
How do I clear this list?
I found the following solution:
Open the following file:
/.Webstorm/config/options/options.xml
On the XML property "file.chooser.recent.files" you can see a list of file path.
Edit the list as you wish
Note the text that separates between paths:

Clicking on an empty line in IntelliJ [duplicate]

This question already has answers here:
IntelliJ IDEA - caret behavior
(4 answers)
Closed 10 years ago.
I just switched from Eclipse to IntelliJ, and I'm liking it so far. The only problem I've had is that if I click in the middle of an empty line and start typing, the text will actually appear on the middle of the line, instead of the correct indentation. Is there any way to fix this so that is works like Eclipse. No matter where I click on an empty line, I want to start typing where I'm "supposed" to.
I'm using IntelliJ IDEA 12, and if I recall correctly I didn't have this problem when I tried 11 (this might be wrong).
Click File -> Settings -> Editor -> Virtual Space and uncheck 'Allow placement of caret after end of line'. This should help.

What are the most useful Intellij IDEA keyboard shortcuts? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
I did a bit of googling hoping to find a post on IDEA shortcuts similar to Jeff's post on Visual Studio shortcuts (Visual Studio .NET 2003 and 2005 Keyboard Shortcuts), but didn't really spot anything that helped. Hopefully the answers to this question will fill the void.
These are some of my most used keyboard short cuts
Syntax aware selection in the editor selects a word at the caret and then selects expanding areas of the source code. For example, it may select a method name, then the expression that calls this method, then the whole statement, then the containing block, etc.:
Ctrl+W
Basic Code Completion, to complete methods, keywords etc.:
Ctrl+Space
Go to Declaration. Use this to navigate to the declaration of a class, method or variable used somewhere in the code:
Ctrl+B
Introduce Variable Refactoring, to create a variable from an expression. This expression may even be incomplete or contain errors. Since version 8, IDEA intelligently selects a likely expression when no text is selected:
Ctrl+Alt+V
Go to Class, to quickly open any class in the editor:
Ctrl+N
To open any file, not just classes:
Ctrl+Shift+N
Comment/Uncomment current line or selection:
Ctrl+/ and Ctrl+Shift+/
Quick JavaDoc Popup to show the JavaDoc of the method or class at the text cursor:
Ctrl+Q (Ctrl+J on Mac OS X)
Smart Type Completion to complete an expression with a method call or variable with a type suitable in the current Context:
Ctrl+Shift+Space
Rename refactoring to rename any identifier. Can look in comments, text files and across different languages too:
Shift+F6
Select in Popup to quickly select the currently edited element (class, file, method or field) in any view (Project View, Structure View or other):
Alt+F1
Highlight Usages in File. Position the text cursor on any identifier without selecting any text and it will show all places in the file where that variable, method etc. is used. Use it on a throws, try or catch keyword to show all places where the exception is thrown. Use it on the implements keyword to highlight the methods of the implemented interface:
Ctrl+Shift+F7
By far my favourite all purpose shortcut is Ctrl+Shift+A
It does a search as you type through all the commands in intellij. Not only that but when you find the command you want it also displays the corresponding shortcut key next to it!
Here are the Intellij IDEA keyboard shortcuts I find most useful (listed in roughly the order of usage for me):
The shortcut I use the most is Ctrl + B (Go to declaration), to see what a method does, where a variable is declared etc. This is almost always followed by Ctrl + Alt + Left to get back to where I was (Ctrl + Alt + Right works to “go forward” again).
A related navigation shortcut is Ctrl + Alt + B, (Go to implementation). Press it when the caret is at the method name of an interface, and you get a pop-up list of all the places where this method is implemented, and you can select which one you want to go to (if there is only one implementation, you go straight there). The same goes for overridden methods.
The opposite of this is Ctrl + U (Go to super-method/super-class). If the caret is at the implementation of a method in an interface (indicated by the little green interface-symbol in the left gutter), this shortcut takes you to the interface itself.
When I want to see all the places where a method or variable is used (which I want to do a lot), I use Ctrl + Alt + F7 (Show usages). This gives you a pop-up list of all the usages, and you can easily navigate to each one. I prefer this over Alt + F7 (Find usages), which gives you the same information, but in a separate pane below.
To find classes, I use Ctrl + N (Go to class), which lets you search using only the capital letters in the class name (“camel humps”), and * as wildcard.
Yet another shortcut I use, both when reading and writing code, is Ctrl + P (Parameter info) at the arguments of methods and constructors, to see the types and names of the parameters.
When it comes to writing code, I use Ctrl + space (Basic code completion) a lot to auto-complete method names, variable names etc (or simply to see which methods are available for a certain object, by trying to auto-complete directly at the dot following the name of the object).
For searching in the current file I use Ctrl-F (Find - probably the least surprising shortcut in this list), F3/Shift + F3 (Find next/previous) to repeat the search, and Ctrl + Shift + F (Find in path) to search in the whole project.
Ctrl + W (Select successively increasing code blocks) is handy when selecting chunks of code. Repeatedly pressing it selects more and more of the code. Useful when searching, indenting, commenting out code etc.
If there are errors in the file, F2/Shift + F2 (Next/previous highlighted error) will jump to them.
I use the sequence Alt + C, N (Show Changes View) to see which files in the project I have modified compared to the subversion repository. To diff the current file against the version in the subversion repository, I use the sequence Alt + C, S, Y (Compare with the Same Repository Version). In the diff view, I use F7/Shift + F7 to navigate between the changes.
When not in the diff view, I use Ctrl + Shift + Alt + Up/Ctrl + Shift + Alt + Down to jump to the parts of the file that have been changed compared to the checked-out version. At each modification point, you see the corresponding part in the checked-out version in a pop-up window.
Finally, I run JUnit tests using Ctrl + Shift + F10.
Edit: One really useful shortcut that I've only started using in the last few months is Ctrl + E. It brings up a pop-up with the 15 most recently used files, and you just arrow down to the one you want and hit enter to navigate to it.
According to the Jetbrains folks, it will have to be these, as they are for the one wearing the shirt: (Got that from Devoxx)
Help\Productivity Guide
It tells you what are the shortcuts you use/don't use and displays usage statistics. It will guide you to the unknown features.
Some of the time savers:
Alt + Enter : show intention actions (like Eclipse quick fix)
Ctrl + Alt + V : introduce variable (never type the left hand side of an assignment again)
Ctrl + Shift + Space : smart completion ( even two levels down since IntelliJ 8 )
Ctrl + W : select succesively increasing code blocks. Kind of obvious but a real time saver!
The Canoo blog contains some (+8) articles on some more advanced IntelliJ keyboard shortcuts.
The Key Promoter and Shortcut keys list plugins are really helpful for (constantly) learning new IntelliJ keyboard shortcuts.
Try using the Key Promoter plugin. That will help in learning the shortcuts.
Couple of shortcuts apart from the above suggestions:
Alt + Ins: Works consistently to insert anything. (Add a new class, method etc)
Ctrl + Alt + T: Surround code block. Another useful stuff.
This is probably dependent on your development environment, but when doing BlackBerry development I code in IntelliJ and still compile and debug through the BlackBerry JDE. Ctrl + Shift + C is vital in this case as it allows you to copy the full path of the file you are currently editing, making it easy to open the file in the separate dev environment.
Yes, Ctrl + Shift + A is the most useful one. It's a meta shortcut
Within the tool:
"Help -> Default Keymap Reference"
(as suggested by krosenvold)
On the Internet: "IntelliJ IDEA Developers Documentation"
Windows, Linux and Mac keyboard shortcut reference cards for versions 8, 7, 6, 5, and 4.5.
(I knew I had seen and used these reference "cards" before! ;-)
One of my favorites (not shown on the JetBrains cards) is "Ctrl+Shift+{Up or Down Arrow}" to move lines/methods up and down in the source code.
See also "Intellij Idea Keyboard Shortcuts" page on Ward's Wiki.
Shift+Delete deletes the entire line (will 'cut' it to clipboard)
Ctrl+Alt+L to reformat and optimize imports
Ctrl+Shift+J to join lines (pull content of next line up to current line).
Alt + Shift + Insert - switches to column selection mode, allowing the selection of rectangular text fragments (columns)
Ctrl + Shift + Backspace - go to most recent code edit. Hit again to go even further back. Very useful when coding something, browsing other classes for a while and then wanting to go back where we left our code.
Ctrl+E - recently opened files
Ctrl+Shift+E - recently edited files
Ctrl+Shift+V - paste one of the previous values from clipboard
One of my real favorites may not count as a keyboard shortcut exactly. But the "iter" smart template is really great.
basically if you want to iterate though something using a for loop type "iter" then tab to use the live template
itertab
it will figure out the most likely variable you want to iterate over and generate a for loop for it. I'm pretty sure it uses the nearest reference to an object which supports iteration.
Ctrl + F11 invokes a dialog with all alphanumeric keys on the keyboard. Selecting one empty will add the current line to bookmarks and mark the line with selected key.
Shift + F11 invokes a list of bookmarks. Pressing a key takes to associated bookmark.
Ctrl + Shift + Enter - automatically completes the code statement you are typing, inserting the quotation marks, brackets, curly braces and other punctuation as necessary.
F7 F8 F9 for debugging
If you are coming from Eclipse:
http://tanu.wordpress.com/2010/09/24/moving-from-eclipse-to-intellij-idea/
General documentation and shortcuts are on Intellij's site
http://www.jetbrains.com/idea/documentation/index.jsp
Any combination of Ctrl + Alt + Shift and N.
Ctrl + Shift + T in idea8 is also excellent.
There is a complete keymap in the online help too.
Ctrl + N : Open class.
Alt + F7 : Find usages.
http://www.jetbrains.com/idea/docs/ReferenceCard70_mac.pdf has everything you need. after a while, you'll develop your own preference for certain shortcuts.
This link has everything you need. Plus in Idea 8 atleast, every shortcut is completely customizable, so it's really up to you what the most useful ones are.
Idea 8 reference PDF