I recently have started development for Swift with XCode 6. I've used Sublime Text 3 for the last couple years, and more recently have fallen in love GitHub's Atom Editor. My biggest frustration so far with XCode is the lack of a copy/cut line tool.
In the text editors I've used copy/cut commands will copy/cut the whole line if no selection is made.
So far the only alternative I have found is the following:
Ctrl + A - Move cursor to the beginning of a line
Shift + ↓ - Select the line
Ctrl + C - Copy Selection
This works, however I'm wondering if anyone has figured out an elegant way to wrap these up into one powerful copy/cut line tool
On a side note, I am also missing the move line up/down shortcuts which are also very useful.
Note: a solution described in this answer no longer works in Xcode 6.
From the terminal cd into / to get to the MacHD and then go into applications,otherwise you won't get all of the applications in the list.
open the
file /Applications/XcodeBeta.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist with sudo privileges (be sure to use the correct app-directory for the version of Xcode you are using---for Xcode 6.3 beta mine was Xcode-Beta.app). You can use open . in the terminal when you get to the desired location in finder
Now add the following section:
<key>My Custom Commands</key>
<dict>
<key>Cut Current Line</key>
<string>selectLine:, cut:</string>
<key>Copy Current Line</key>
<string>selectLine:, copy:</string>
</dict>
Restart XCode and in the keybindings section you should be able search for cut current line and copy current line and set custom keybindings to them. The format of creating commands is actually pretty simple and intuitive.
On a side note, I am also missing the move line up/down shortcuts
which are also very useful.
Preferences->Key Bindings
Move line up: option+command+[
Move line down: option+command+]
Related
I've been dying to get this working on the default terminal on the mac, this feature is really useful when you write something wrong, and can just cmd + backspace to delete all the lines.
I googled online several times but I couldn't find anything related to this.
Well, the functionality is already there: ⌃+U will delete everything left to your cursor to the beginning of the line. You cannot, however, change this keyboard shortcut.
You can change application-specific keybindings by installing additional tools like, for example, Karabiner.
Alternatively, you can install iTerm2 as a Terminal replacement. That will allow you to enable this - and many other text editing keybindings - with one click in the settings.
A very specific question, for use on Mac OS:
In VSCode, it's very easy to simply hold ⌘ Command and hit ⌫ Delete for however many whole lines I want to delete and the cursor will keep deleting upward.
However, running PyCharm, it's not available, and I'm having trouble mapping the exact feature.
Going to Preferences -> Keymap -> Editor Actions allows you to map "Delete Line," but using this will just delete downward. Is there a way to mimic the feature of being able to hold down ⌘ Command and just ⌫ Delete lines upward?
To find the shortcut on your setup open up the "Search Everywhere" box with one of the following:
Double ⇧ Shift
⌘ Command+P
⌘ Command+⇧ Shift+P (opens directly on Actions tab)
Then go to the "Actions" tab and search for the shortcut you are looking for, in this case "Delete Line":
Then it shows the shortcut (in my case ⌃ Control+⇧ Shift+K)
In the Jetbrains documentation it does not show up anything to remove a whole line (or at least, I am missing it out).
I know it is not the same, as what you do in VScode is much faster, but you can always shift+home(gets you the whole line if you are at the end of the line)+delete.
I do not think there is another way from jetbrain's doc.
EDIT:
I think I found it by cassualty: R shift+ del.
EDIT2: Just found out that R shift+ del actually cuts (like ctrl+ x).
I know that the post is a bit old but I think it worths to post the 'actual' solution to this issue.
Basically, when you try to delete line in PyCharm for Mac, the IDE is deleting the caret (according to the documentation). Although, IdeaVim plug-in is making your life even more difficult if you don't know how to use it. I don't have experience either.
Disabling IdeaVim plug-in will solve the problem. The IDE will ask you to restart it in order to apply the new settings. After that you can select whatever you want in your code and just hit the backspace button on your Mac to delete. And, yes, all these issues with the key shortcuts are caused by the IdeaVim.
The IdeaVim extension can be disabled from the PyCharm Preferences.
I added a shortcut key to "Clear Constraints" in the xcode preferences, and xcode installed the shortcut twice under different xcode names. (See the image.)
The problem is that there is no little "-" (minus) sign (see the red arrow in the image) to remove my duplicate shortcut attempt, because any key I press is interpreted as a shortcut combination.
The problem shortcut(s) are shown below the red arrow. The red arrow one is fine, I just wanted to show the little "-" minus sign there.
Does anyone know how to get around this problem (without reinstalling xcode and all my custom keybindings :-)). Thanks
Image showing duplicate shortcuts below red arrow
Quit Xcode. Restart the computer just to be on the safe side: we want to force Xcode to write its preferences out to disk.
Go to ~Library/Developer/Xcode/UserData/KeyBindings. Open the key bindings file with a good text editor.
You are now editing XML; I presume you know what you're doing. You will see two <dict> entries whose <action> starts with clearConstraints. Delete those entries. Save.
I've been programming on a Windows machine for quite a while using Jet Brains IDEs (IntelliJ, Android Studio, WebStorm). I just bought a Macbook and I'm trying to use Xcode to develop on it. My most used hotkey by far is Shift-Enter to start a new line underneath the line where the cursor is. Without the shortcut, I have to CMD-rightarrow, add a semicolon if needed, and then press enter. Is there a shortcut like this in Xcode? If not and thousands of developers use xcode, am I just lazy and have a bad habit? Is there a easier way to do this?
Thanks a bunch
Such a hotkey is not available in Xcode. Since you are new to OS X, I should tell you that emacs shortcuts are available in Xcode and throughout the OS. So, for example, in your case the quickest way to get what you want would be Ctrl-E (move to end of line) followed by enter. You can switch your caps lock and control key easily in System Preferences to make this easier. Check this link for a full list of these bindings. I have found them supremely useful.
Try this:
Copy '/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist' to desktop.
Add following contents into the .plist file:
<key>My Custom Actions</key>
<dict>
<key>Insert Line Below</key>
<string>moveToEndOfLine:, insertNewline:</string>
<key>Insert Line Above</key>
<string>moveUp:, moveToEndOfLine:, insertNewline:</string>
</dict>
Copy back the modified file.
sudo cp ~/Desktop/IDETextKeyBindingSet.plist /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist
Restart the Xcode and perform key binding.
In Aptana Studio 3 (latest version and all previous versions of 3) I am not able to comment lines via keyboard shortcuts. I have a german keyboard layout.
The default shortcut is CTRL + /, but this doesn't work. Even setting the shortcut in Preferences/General/Keys doesn't work. The command is called Python Toggle Comment.
Using the Commands menu and use Source -> Comments -> Comment Line / Selection comments the lines correctly. In this menu I can also see the hotkey CTRL + / behind the menu entry.
It would increase the speed of writing and testing code, if I could use the hotkey. How can I achieve this?
You can try pulling down a copy of the Source ruble and edit the keybinding to one that works for you. Commands > Source > Edit this bundle. It'll try to do a git clone of the bundle into your "Documents/Aptana Rubles/source.ruble" folder. Then you can edit commands/toggle_comment.rb and change the binding to what works for you.