Can I use Xcode as a simple text editor? - xcode

Okay ... This may be a ridiculous question. (I'm still getting used to Mac.) I really like the auto fill-in-ahead predictive typing feature of Xcode.
Can I use it to simply edit files laying around different locations on my hard drive? I do not really want to create a project or anything (unless by PROJECT I mean simply loads several files, that are not related to each other, but that I may want to jump back and forth in editing them - I do not want to create a project from files that need to be compiled or anything).
If so, what's the best way to get started? When you open XCode, it asked a lot of wizard questions to get things set up. How would I simply get started to edit 5 or so files at a time ... where I might want to switch back and forth between them - and they are not in the same directory?
All I want to do is simply make changes and save them, make more changes and save again, repeat. Kind of like holding a lot of shell scripts that communicate with each other.
Okay ... so I know this was a silly question - but Xcode is so intimidating for newbies. Sometimes, one needs a place to just get started and I haven't found that yet.

It is possible to open the Xcode text editor on a single file from the command line.
open -a Xcode.app filename.txt
If you're going to use this a lot, you might consider making an alias in your ~/.bashrc.
alias xc="open -a Xcode.app"
As of Xcode 6, you cannot open a directory this way, as it will give you an error message stating that directories must be opened as part of a project. If you provide more than one file on the command line, Xcode appears to create a temporary project containing the files you provided. You can add files and folders to the temporary project, but there doesn't seem to be a way to save the temp project for use later.

If you want to open a file in Xcode, you can also use xed.
As the man page says:
xed -- Xcode text editor invocation tool.
You can simply call xed [file] to launch Xcode editor.

Notepad++ is the way to go. Xcode was never meant to be used as a general text editor.
EDIT: Sorry, didn't know that there wasn't a Mac port for Notepad++. Use TextWrangler instead.

Related

Recreate or recovering a VB6 project

I left VB6 and programming all together years ago, so pardon since I'm still dusting off what I remember.
I have an old program made for a friend in VB6 that he still runs in Windows Vista. He tried to update a label in the program and in trying to do the update, he has overwritten the project file where I used to see all forms and modules together.
Is there a way I can recover or recreate the project file as it was? All project files and modules are there, but when I open the VB6 project it shows only one form, that I can't compile or execute because it shows a "source not found"
I tried to go back to an old version of the project file with file recovery software but I couldn't find it.
Other way?
Practical steps to recover:
First and foremost: Back up what you have. Do this now.
Second, and only after the first, check (again) to see if you have a previous backup. Yes, this may seem pedantic, but, really, it's worth looking. Was that the only copy? Once you do all of this, consider creating a git repo for your code.
Third, in your empty project, simply right-click in the project explorer (Ctrl + R), and click "Add >" and then "Add Files...". Then, in the file input box, scroll down to the first file, hold down shift, and keep pressing the down arrow and all the files you want. Click "Open". Repeat if need be.
Finally, you need to re-add any dependencies. One way is simply to try to run the program with full compile (Ctrl + F5 or File | Run With Full Compile in the menus). If everything starts up, consider yourself fortunate. If not, you'll have to see each one that fails and add them back. This could be tedius, but just go through them one by one. In the Project menu, both "Components" and "References" can be gone through. Do this until the program successfully starts with full compile.
At this point, consider a making a backup. ;)

How do I use Mac OS aliases in Sublime Text 3?

I want to open the tree of folders which contains any code on my Mac in Sublime 3. Something like this:
But I don't have all of it in one folder, and it isn't convenient enough to open many folders in Sublime every time I close the app. So I have created 'aliases' (via Finder) to my folders and put them to one (folder), which i want to open with Sublime.
That didn't work out. Sublime opens these aliases as hex code. While ordinary folders open well.
So the main question: is there a way to make this work as I thought via preferences, or any plugin?
Use symbolic links instead by opening Terminal and using ln -s <SOURCE> <ALIAS>.
You can keep any number of folders you want collected in one place by using projects. Simply drag the folders you want, in the order you want, into the sidebar. Then, select Project -> Save Project As... and save the file anywhere you want with the .sublime-project extension. While you're at it, make sure you have
"hot_exit": true
in your user settings, as this enables you to close windows which have a project assigned to them, and all open files and unsaved changes are automatically preserved. When you next open the project, everything will be the same.

Main Menu Items --> Change "About" Credits.rtf after change his type

I have (for me) interesting problem, in Cocoa Project I created file "Credits.rtf" for testing custom text for this window... but I tried to change type from Credits.rtf to Credits.html and after this (even when I delete file and reference to this file too) the "About" window always showing below mentioned text and I dont know how is the way to change it, even when I replace reference and file by completely new Credits.rtf file (and XCode shows that this reference is exists and asked me if I want to replace it)
I think that solving this must be absolutely easy, I tried to find any idea but without success
Could you help with this? Thanks in advance
Maybe you are thinking that I'm absolute moron, maybe it is bug or I dont know, but I wish to solve this and knowing how to solve same issue in future :)
Thanks once again
Assuming you've definitely, absolutely, certainly replaced it with a real RTF file that opens in TextEdit without fail, then you may just need to clean and rebuild your project. With the project open, press Cmd-Shift-K. When Xcode is finished, build and run and see if it changes.
If not, you'll need to post a lot more detail. Perhaps an example project somewhere shared online.

Programmatically rename an XCode project

I know one can rename a project by slowly double clicking the project name but I was wondering if it's possible to automate that through the command line (any language, possibly Apple Script) ?
Renaming an Xcode4 project is quite easy.
Click on Show the Project Manager to see the top level project file on the left side.
Click on the project name (here DeeTeeSaver will be changed to DeeTeeSaver2) in order to edit it and enter the new name.
It takes a second to let Xcode4 find out which parts have to be changed.
It then displays a dialog which parts will be changed. Simply click on Rename.
That´s it. No need to fondle around with AppleScript.
You might miss important parts inside the bundle.
Greetings from Switzerland, Ronald Hofmann
You will have to manipulate the .xcodeproj file, which is in XML format.
In my build process I have placeholder names that I simply search & replace with a command line app. If you need a generic solution you will have to parse the XML format (which is undocumented but not that hard to grasp).

How do I control the "open quickly" search path in XCode3 (3.2.3)?

XCode2 had this beautiful feature: you put the cursor on a line with a #include <file> and execute the open-quickly command (command-shift-D) and it would open the file. I can't get it to work for me in XCode3.
I have something like this
#include <folder/subfolder/HeaderFile.hh>
and when I put the cursor on this line, and open the open-quickly dialog, it automatically fills the search window with
folder/subfolder/HeaderFile.hh
but doesn't find anything. If I then remove "folder/subfolder/" then the dialog will identify HeaderFile.hh and I can open it up. But this extra deleting is so much slower just the three-key command-shift-D opening I was used to with XCode2.
If I give it the full path to this file in the search window, then it finds it:
/Users/andrew/myproject/src/folder/subfolder/HeaderFile.hh
this path will find the file. Again, I don't want to spend all my time typing out the full path.
I created this project as an external build system, and I think that's related to the problem; the xcode project lives in
/Users/andrew/myproject/xcp_dir/
and I want it to search in the "../src/" directory so that the partial path I give it (which is already present in the #include) will match the file I want to open. In XCode3, I had to create the project in the xcp_dir directory; in XCode2, I could create the project directly into the existing myproject/ directory -- maybe that's why the search is failing?
I read on a previous thread (which never answered the question) that I should set the HEADER_SEARCH_PATHS option. I tried this (setting the option to /Users/andrew/myproject/src) but it did not work.
I don't have any sense of what other options (like the HEADER_SEARCH_PATHS option) are availalbe, so if you know which one I have to set, I'd love to hear it.
Since this is an old question I'll answer it for Xcode 4 instead of 3.
As far as I know Open Quickly doesn't use anything like a search path. It seems to have use the project's codesense index and will show results from that. Querying the database doesn't have an notion of file paths, so the workflow you describe just won't work anymore.
However that's okay, because there's a better solution: Just ⌘+click on the include line and the appropriate file will be found using the same rules as the compiler uses, and opened. If you want to open the file up in an assistant, another tab or window, you can use ⇧⌘+click instead, and you'll get a little UI for easily selecting where you want the file opened.
You can also use these shortcuts to go to definitions for any identifier.
If you don't want to use the mouse you can use the command "Jump to Definition" which has the shortcut ⌃⌘J, or ⌥⌃⌘J to open the definition in the assistant editor. This also works for both normal identifiers and #included files.

Resources