I find that the new Sublime Text preferences architecture is pretty convenient.
It basically has us putting the keymap, preferences, and package-specific preferences, syntax-filetype mappings, syntax definitions, and color themes, all into the Sublime Text 3/Packages/User directory.
This makes it very tempting to turn this directory itself into a git repo.
Is this the intended purpose?
by OS there are :
Gnu/Linux :
$(HOME)/.config/sublime-text-3/Packages/User/Package Control.sublime-settings/Package Control.sublime-settings
Windows :
%APPDATA%\sublime-text-3\Packages\User\Package Control.sublime-settings\Package Control.sublime-settings
Mac os x :
~/Library/Application Support/sublime-text-3/Packages/User/Package Control.sublime-settings/Package Control.sublime-settings
I suppose it permits to recover all the packages via the upgrade command.
I wouldn't know if it is the intended purpose, but I sure do. There's all a plugin available called sublimall that makes it pretty easy to sync packages, linters back and forth via machines. I've also used dropbox to sync pretty effortlessly just using symbolic links. I think that's been my favorite so far, but it doesn't have the backups and flexibility of git.
I back the USER directory on my dropbox account, and then set symlink to it from my sublime text folder. Works like a charm.
Related
Now with Sublime Text 3 and a year on from an older question, I'd like to bring this up again.
Is it possible to setup a Sublime Text project with network paths to folder resources that can be used on Mac(OSX) and Windows platforms.
We have projects which are already created in a windows dominant environment. We are looking to have these working in OSX as well. At the moment a path for a project resource would be mapped to a windows network drive for example Z. The folder setup in the project would look like this:
"path" : "/Z/Custom/Project1"
If I was to create a network mount on OSX and drag the same folder in, it might look like this for Mac:
"path" : "/Volumes/ENV/Custom/Project1"
Is there a way to get this working for both platforms specifically using absolute network paths as the project files do not exist in the same location, so relative would not be a solution here.
Network paths are simply handled differently on Windows vs. OS X. A Windows path might look like:
//server/path/to/file
or, if the server is mounted as a drive:
/R/path/to/file
whereas on OS X all network shares are mounted through /Volumes:
/Volumes/server/path/to/file
As I see it, you have two options. The first is the most obvious: separate .sublime-project files for Windows and OS X. However, depending on the complexity of your projects, this option may take some effort to keep both files in sync.
The second option is to just have both paths in the "folders" section:
"folders":
[
{
"path": "/Z/Custom/Project1"
},
{
"path": "/Volumes/ENV/Custom/Project1"
}
],
You'll have two Project1 folders show up in the side bar, but only one will expand - Sublime gracefully handles the fact that one path doesn't exist. The major issue with this solution is that you may have other project-specific settings that are platform-dependent. For example, I use the Anaconda plugin for Python that provides code completion, linting, and other features. A couple of its settings require the path to the Python interpreter you wish to use for each project, and these paths can be platform-specific, especially if you are using virtual environments.
I suppose there is a third option as well: write a custom Sublime plugin that runs on startup to determine the platform, then generate a .sublime-project file with the platform-specific settings. That would be a non-trivial amount of work and wouldn't allow for multiple users to share the same project file simultaneously (you'd have to store the generated file locally). However, depending on your priorities, it may actually be the best option.
Trying out AppCode (2.5.4) at the moment I'm rather annoyed by having the full paths to projects always showing up in the 'Project' view.
Browsing the prefs I cannot find a way to turn this off?
I'd rather prefer the Xcode way of having just the project's name..
In particular working with workspaces and sub-projects a lot it adds a lot of visual clutter.
Jay,
there is no way to disable this path at the moment.
Why do you find it annoying?
I'm not am Apple expert. Under Linux, however, you could, as a workaround, create a soft link using "ln" to reference the long folder path from your home dir in a short fashion and use that path in your app. Maybe that works under Apple's system as well?
Google turns up nothing but very basic set up of web servers on the Mac. I've got that.
I build web projects locally on a Mac using PHP/MySQL. I store the sites in /Library/WebServer/Documents then access them via browsers with http://localhost.
This works fine.
What I would like to do is to be able to place symlinks or aliases of projects into the /WebServer/Documents folder and access sites on other (local) drives. I don't want to have to store everything in the Library folder. However, it seems that symlinks don't work. The only way a project functions is if all it's files are located in the /Library folder - no symlinks.
I realize I can change the root path for the web server in the http.conf file but I don't want to actually change the server path, I merely want to use symlinks if possible. I also realize I could use something like MAMP, but things run fine with my traditional set up (and I prefer to avoid MAMP since it's not always real-world). Main motivation here is that I don't want to store files on the boot volume, where there Library folder is located.
Can I use symlinks for directories with Mac OS10.6.8/Apache? if so how, please?
Thanks!
Solved via this article at Apple:
http://support.apple.com/kb/TA21182?viewlocale=en_US
One must specifically create a symbolic link. Which, it appears, is not the same as an Alias on the Mac OS.
But this isn't feature of MAMP application, this is about web server. Make it through MAMP and go see what is new in apache config files (httpd.conf, vhost.conf).
you have to use symlinks instead of an alias... sad there is no ui for that!
you have to go into the Terminal and type:
ln -s /ORIGINALPATH /LINKEDPATH
the first PATH is the base path of the original file and the second is for the base path for the symlink of the file/folder etc
I have switched to Mac as my main development machine (coming from Fedora) and was just curious as to what people used as there development folder structure. For example in Fedora I always had ~/opt for user programs ~/src for source code I was working on and ~/bin for files I constantly executed. Is there a Mac de facto. What do you guys perfer?
Thanks,
Greg
I use the directory ~/Developer as the root of my development-related files. Inside that I have ~/Developer/Code for code snippets, tutorial code, test ideas, etc. I have a ~/Developer/Projects directory to hold in-development projects. This contains a few subdirectories, including Archives for projects I've abandoned, and Current for current development work. ~/Projects is also a symlink to ~/Developer/Projects/Current.
To add to #mipadi, after a recent fresh install of OSX 10.10.2 (Yosemite) I noticed that if you create a ~/Developer folder, that folder automatically receives a special folder icon (with a hammer on it). This property seems to be an artifact of older versions of Xcode, in which it would automatically create the folder for you.
I have 3 folders in home:
Sandbox - my source control checkouts
Dev - projects that are not in source control (tests, experiments, etc.)
3rdPartyDev - 3rd party code I've downloaded and want to keep around
I try to keep as much 3rd party code around as possible. With the Mac's Spotlight feature, you can instantly search all the code at once. If there's an API I need to see example code for, I just Spotlight for it and chances are some code in there is already using it.
I have a big messy folder called "code" full of Xcode projects.
In Mac, for all developer projects there is a specific folder inside the home directory called ~/Developer, which when you create automatically has a customised icon.
You can thus subdivide using this:
Experiments: things you just want mess around with.
Public: open source
Private: private projects
Learning: If you're on a learning path to track your progress and milestones.
I am planning to develop a cross-platform script. On Linux and other operating systems, it will store configuration in XDG_CONFIG_HOME and data files (specifically, downloaded plugins) in XDG_DATA_HOME. On Windows, it will use APPDATA for both (unless someone has a better idea). However, what would be the proper thing to do on Mac OS X?
On my first glance through a handy Macbook's ~/Library directory, I saw Preferences and Application Support folders. I was originally planning to use those, but Preferences seems to just contain plists with reverse domain names like com.apple.foo.bar.baz.plist, and every folder in Application Support corresponds to a bundle in /Applications, so I'm not sure how well the system would react to files that don't match its standards. Storing them directly in ~/Library might be an option, but I don't want to pollute it with a stray myscript.conf file if there's a better place for it.
Where should I store these files? (And please don't say just ~/.myscript. I know it's the Unix tradition, but it annoys me to see random dotfiles in the home directory.)
Comparing Apple's documentation for the various paths to the XDG Base Directory specifications approximates to the following locations:
XDG_CONFIG_HOME ▶︎ ~/Library/Preferences/
XDG_DATA_HOME ▶︎ ~/Library/
XDG_CACHE_HOME ▶︎ ~/Library/Caches/
Mapping XDG Base Directory Specification locations for "My App" on Mac OS X could look like this:
XDG_CONFIG_HOME ▶︎ ~/Library/Preferences/name.often.with.domain.myapp.plist
XDG_DATA_HOME ▶︎ ~/Library/My App/
XDG_CACHE_HOME ▶︎ ~/Library/Caches/My App/
These mappings seem pretty reasonable but they aren't exact. Some kinds of cache or data may be appropriate for ~/Library/Application Support/My App, and other may be best in the temp locations or the App bundle. All of it is by convention and the same reasons for using the best XDG_ locations apply to using the best locations on the Mac OS X system.
Your annoyance at ~/.myscript is in line with Apple's guidelines: "Don't pollute user space".
References:
Mac OS X Reference Library: Where to Put Application Files
Mac OS X Reference Library: Important Java Directories on Mac OS X
I agree with OJFord's comment: if you are writing a script (I think this applies to all CLI-only application), simply follow the XDG Base Directory would be better.
Rationales:
Names in XDG_CONFIG_HOME are typically small-case bare-names like git; the ones in ~/Library/Preferences/ are typically files named with reverse domain name notation like com.apple.AppStore.plist, or directories named in title case like Blackmagic Design.
GUI applications have been following macOS conventions when they are placed in /Applications. You don't place your script in /Applications; you place them in UNIX-specific directorys. Better to be consistent.
~/Library/Preferences/ is full of .plists. No cross-platform script that I know is using property lists.
Users may want to sync cross-platform configuration and macOS-only one separately.
For example, Git places their config file in XDG_CONFIG_HOME/git/config, not in ~/Library/Preferences/Git/config. Makes sense to me.
note
I made the point only for configuration files ($XDG_CONFIG_HOME) and data files ($XDG_DATA_HOME); for cache files it gets subtle. According to How-To Geek, ~/Library/Caches directory is excluded from Time Machine by default. I don’t care about cache folder since I back up neither directories anyway; but for ones who care, I recommend them to link ~/.cache to somewhere in the default cache folder, such as:
cd ~; mv .cache ~/Library/Caches/XDG-cache; ln -s ~/Library/Caches/XDG-cache .cache
I would use ~/Library/Application Support/script_name/. The subdirectories inside Application Support are used conventionally by various apps, including Apple's own softwares. But it's not enforced by the OS and not tied to apps inside /Applications. So you're perfectly free to create your own directory in it.
For the directory structure of OS X in general, see this Apple document.
Here are the choices made by the os package in golang:
XDG_CACHE_HOME → $HOME/Library/Caches
XDG_CONFIG_HOME → $HOME/Library/Application Support