Xcode "Open with External Editor" - xcode

How can I determine which editor should be called in Xcode 14.2 when I select "Open with External Editor" for a file with the right mouse button?
For me, a Markdown editor is always started, also for the Swift files.
In old tips it says you have to set the appropriate editor via the Finder. But when I open a Swift file with a double click in the Finder, it works ...

Xcode currently doesn't have a way to let you know what editor when you choose Open with External Editor.
The editor Xcode uses to open the file depends on the file type. For each file type you must set the default editor to use from the Finder.
Select a file in the Finder.
Press Cmd-I to open the file's Info panel.
Choose a text editor from the Open with menu.
Click the Change All button to set the default editor for all files of that type.
After setting the default editor, choosing Open with External Editor in Xcode will open the file in the editor you specified.

Related

Change all file icons with same type [Yosemite]

I have many excel files in my computer, and the icon of all of them are plain paper, like this:
I want all icons to be .numbers icon. Do anyone know how to do that ?
Here's what you could do :
Open a Finder window and navigate to /Applications/
Find the app whose file icon you want to change
Right click it and select "Show Package Contents"
Navigate to Contents/Resources/ and find the appropriate icon file. Replace it with your new icon file.
Restart your computer to update the icon cache.
Or you can change the default app for a file type and set all files of that type to be associated with the default app if that's what your question says:
Open a Finder window and locate the file type you want to change.
Push Command+i or go to File > Get Info
Under "Open With" select the app you like. You have just changed the default app for that individual file.
To change the default for all files of that type, push the "Change All" button and then "Continue"
This will make all your excel files to open with numbers while the previous one will just change the icon
To change the file icon on all you files icons with the same extension:
open Get Info panel file 1, that you want to change
open Get Info panel file 2, that you want to change to
drag and drop icon from panel file 1 to panel file 2
click Change All...
with Finder open "Show View Options" or command + J
drag Icon size as you wish. This force icons cache rebuild
Here is a simple solution that works all times:
Find the file with icon that you want to apply for (ex: *.numbers file), then Command + i to open it's info Panel
Find the file you want to apply the icon for (ex: your *.xlsx) file. then Command + i to open it's info Panel
Now that you have your two file's info panel side by side, you can drag the icon from the first file's panel ( only from header/title bar ) and apply it to a second file's panel, as shown: (you must place the icon over the second icon to make it work, I didn't make it overlap just for taking a clear screenshot)
Open a champagne and celebrate!
You have to empty your cache for icons after you have changed the icon or switched the file association program.
Not sure the exact filename, but use it to empty both cache folders. ~/Library/Caches and /Users/User/Library/Caches

How to set an external editor in Xcode 4.2

All the posts I have found suggest going to the "file types" sub-section under XCode preferences and adding an external editor for a specific file type. However this options does not seem to be there on XCode 4.2.
It looks like it just goes through LaunchServices, so... whatever you'd get by opening it using Finder by default.
I had a look around and I couldn't figure it out. I notice that right-clicking on a source file, there is a greyed out option for "open in external editor." I couldn't figure out how to get that working at a glance.
A reasonable workaround would be to right-click on the source file you want to edit, click "Reveal in Finder," and then edit the file in the editor of your choice. The changes will be automatically updated in Xcode. I think you'll lose any undo/redo history you may have had for that file in Xcode though.
you have to make the editor you want is the default editor for the file type(cpp/h/lua ..).
step: first time you 'show in finder', then open the file with 'open as', then choose the editor you want, make sure you choose the 'always open it'. then every is ok now.
I agree that you need to change the default setting for the file type in Finder. The best way to do that is to right-click any similar file in Finder. Select Get Info from the pop-up menu. Then look down the list for the "Open with" drop-down option. Select your chosen editor and then below the words "Use this option to open all documents like this one" click on "Change All..."
Then it will change the default for all your applications.

Xcode 4: Open arbitrary files in assistant editor

Is it possible to open a file that is not part of any project in the assistant editor? Open Quickly can open files in the assistant, but only searches the project itself. If I open an outside file in Xcode, it gets a new window that cannot access the project in its assistants.
With the assistant editor open, drag the file from the left-hand list onto the Jumplist at the top of the assistant editor (where the currently open file is).
Yes, it's possible.
#What. Your answer only works if the file is in the project. You can only drag a file to the Jumplist at the top of the assistant editor if the file is displayed within the file list on the left. This means you would have to add the file to the project before opening. Sometimes, this is not desirable as you may want to open a file from another project for reference while coding.
Steps that I use are: (Tested in Xcode 6 and Xcode 7 Beta)
In Xcode, make sure your Tab Bar is shown. If it is not, click on "View -> Show Tab Bar" in the top menu
Open the file... Go to "File -> Open". Select the arbitrary file you want to open. This will open the file in a new window. (Screenshot 1 below)
Drag the tab in the new window to the tab bar in your main editor. Now, you will have 2 tabs in your main editor and your new window will be gone (Screenshot 2 below)
Next, click on your original tab (Where your main and assistant editor is) and the file will be available in the recent files list. Simply select the file from the recent files list in the assistant editor and you now have the file open in the assistant editor. You can also close the other tab as you no longer need it. (Screenshot 3 below)
Screenshot 1. Simply drag the tab from the new window to the main tab bar.
Screenshot 2, you will now have 2 tabs.
Screenshot 3. Back at your original tab, you now have the option to open the new file within the recent files list in the assistant editor. Click it and you are done.
Screenshot 4. Final result... we have our arbitrary file open in the assistant editor.
Here is what I do (Xcode 9.3) :
Add wanted file to the Xcode project
Open assistant editor with that
file
delete this file (references only) from the Xcode project. Xcode will
remove the file from the assistant editor.
Now go to the assistant
editor "recent files", the file will be there. Select it.
My preferred way to do this is to #include whatever file I want to open in some C file, like this:
#include "/home/julius/path/to/file"
Command-clicking the path will open the file. It's a shame Xcode forces you to use this workaround.
You can drag an arbitrary file on the assistant editor. Then it will be opened there.

How to change file associations in Mac OS X

So I used Xcode and all. Now, whenever I open my text files it opens automatically with Xcode. How do I undo this?
RightClick on the file name -> Open With -> Choose the editor you wish to open with this kind of file. And that sets to be default editor for opening files with that particular file extension ( i.e., .txt ) when opened in future.
Edit: The above procedure is not a permanent one. Try this -
Right click on the file name.
Choose Get Info
Choose one from the Open With drop down. This will be set as default application and is used in future if opened the .txt file.
Right-click any text-file an select "Get-info", then choose your preferred Text-editor under "Open with" and click "Change all..."
You can change program association by right clicking on your file and clicking on "Get Info". This will bring up another dialog in which you can change the program associated with that file type.
You can find visual instructions here: http://osxdaily.com/2009/10/25/change-file-associations-in-mac-os-x/

Launch default editor in Xcode

I've configured MacVim to be my default editor in Xcode. I can invoke it from Xcode by double clicking the file in the project view. Is there any keyboard shortcut I can configure or invoke to open the file being viewed in the Xcode editor in my default configured editor?
I am using Xcode 4.3. You can assign a shortcut to open the file in an external editor using the menu item File/Open with External Editor. To assign the shortcut you will need to go to System Preferences/Keyboard/Keyboard Shortcuts, choose Applications Shortcuts, click on the plus button, choose Xcode from the drop down menu, write 'Open with External Editor' in the Menu Title field and choose your shortcut.
Try Option-Command-O - if that doesn't work then you may need to go to Key Bindings in Preferences and set it up (I use the BBEdit Compatible key bindings which include this shortcut as standard).
I made a little write up here fwiw:
https://tmsh.github.io/visual-guide-opening-files-externally-xcode/

Resources