Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

whitehexagon

macrumors regular
Original poster
May 12, 2007
147
0
I've finally given up on Java on OSX! So today I'm getting started with XCode :)

I've typed two lines from an example and already I'm struggling for keyboard shortcuts. Is there a cheat sheet somewhere?

Specifically I'm looking for key combination to duplicate a line downwards.
 
All of Xcode's key bindings are configurable in the preferences. I didn't see any text key bindings for copying a line, but you could easily make a script for that, I think, and define your own key binding for it.
 
you'll have to go a bit slower for me :)

I found the bindings and can duplicate the set, and change bindings. I can find where to add a new binding. From system preference it's only adds new bindings for existing menu items. How would I add such a script that you mentioned.
 
I'm coming from an eclipse background, and it's just something I've really gotten used to. It's not just cmd-c cmd-v, but also: move to start of line, select to end of line, copy, right arrow, return, paste.

delete line is the next challange. If I can add some more shortcuts via scripts or macros then that would be perfect :)
 
Don't look in System Preferences. Look in Xcode's preferences. (Under the Xcode menu, not the Apple menu.)

To create your own script, open Xcode's menu that looks like an unfurled scroll and choose Edit User Scripts. In there you can use just about any shell script you want. There are special variables that are set, but I'm not super familiar with it. Search for "user scripts" in the Xcode help to get more info.
 
well the above tips eventually led me to the following site

http://flexgraphix.com/blog/?p=62

Which uses a key binding file. I think I need to reboot before it will pick it up, but it looks like a simple way of adding any number of my missing keys simply.

Thanks All!
 
I'm coming from an eclipse background, and it's just something I've really gotten used to. It's not just cmd-c cmd-v, but also: move to start of line, select to end of line, copy, right arrow, return, paste.

delete line is the next challange. If I can add some more shortcuts via scripts or macros then that would be perfect :)

Control-A moves cursor to start of line
Shift-Down Arrow selects entire line
Command-C to copy
Down Arrow
Command-V

Not as fast as yyp in vim, but I've gotten used to it. :)
 
well i tried a reboot and that didn't pick up the key bindings, gonna have to try again tomorrow, I hate having to reboot these days, oh the joy of being a switcher :)

sure I can do this manually, but when you are used to a single key cobination it's really hard to go back. Actually I'm suprised at a few things like this that seem to be missing in XCode that most others editors I use have. Maybe I just need to explore it a LOT more yet
 
Yeah, explore a little more, but if it turns out you just hate Xcode as an editor, you can designate any other app (I think including command-line ones) as an external editor for text (code) files, and still use Xcode to organize and compile your project. Normally rebooting isn't required on OS X unless you're installing or modifying a kernel extension, or installing an OS upgrade, obviously.
 
I haven't got as far as the chapter on loops ;)

Well I've tried a couple of combinations to get this working, but no luck so far. I had some system prefs custom key bindings which I've now restored to default. But PBKeyBinding.dict and DefaultKeyBinding.dict just seem to be ignored.

I'll post back if I find a working solution.
 
General (Unsolicited, sorry :)) Advice:

Don't try to turn your current IDE/editor/tool into your last IDE/editor/tool.

Work with your new IDE and develop a workflow that takes advantage of the features it has rather than trying to impose the workflow from your old IDE on to it. (After all, that's probably how you developed your old Eclipse workflow, right? -- By getting to know Eclipse and working with what it gives you?)

If you focus on what xcode lacks that eclipse has, you'll miss what xcode has that eclipse doesn't.

As you get used to xcode, including its quirks and deficiencies, the things that seem almost unbearable about it now will not seem like such a big deal after a while. Some things you may even come to appreciate.

Confession :D: despite what I just said, the one thing I cannot stand and cannot get used to about xcode is the way the editor jumps half a page when you cursor past the first or last displayed line in the editor.
 
Generally I agree, but things like kill line, move line, scroll, and duplicate line are such basic features of text editors , it really feels like a step backwards.

Code sense is looking very promising though, and I like the Research assistant already. And SVN was a lot quicker setting up than the mess involved with eclipse.
 
I know this is sort of off-topic, but i contributed an on-topic comment earlier, even if it ended up not being super-helpful.

This thread is the reason I advocate vi(m). Code completion is great, and is the only reason i'd ever use an IDE, but with vim it's easy to move from language to language, and not have to change editors. All of these features are there and many more.
Kill line: dd (Places line in buffer, in case you want to put it elsewhere)
Kill many lines: #dd (where # is the number of lines you want to delete)
Move line: dd #G p (where # is the line you want to move it to, you can manually navigate there, too)
Scroll: how much? =)
ctrl+f page forward
ctrl+b page back
ctrl+d half page forward
ctrl+u half page back
j one line down
k one line up
#j or #k move # lines up or down

I'm not saying it's the right choice in this scenario, but I'm always more comfortable in vim than Eclipse/XCode/Netbeans/VS/etc. when it comes to the actual editing of text.

-Lee
 
After many years as a plain editor hard core user, the feature that really convinced me to adopt an IDE was code completion. Then I really got hooked on being able to see at edit time any compilation errors, another great productivity enhancer! I know real programmers don't needs hints from an IDE, but I don't have the brain capacity or patience to memorise these huge API's that come bundled with most languages these days :)

So overall I'm convinced IDE's are worth the learning curve, because the longer term productivity gains more than cover the initial pain. That's why I'm not trying to use eclipse to write objective-c but instead using the tool that is designed for the job. But I'll reserve my final judgement on XCode for a few weeks. Or maybe Apple will release a decent update to Java at wwdc and I'll be back on eclipse :)

Thanks All.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.