I've adapted @holman's ideia of symlinking files whose filename ends with ".symlink", and instead I'm symlinking files whose filename matches the regular expression
\.(<os>-)?symlink$. By doing that, I can have files that are always symlinked, and files that are symlinked just in a specific environment.
For example, in my
~/.gitconfig I include
~/.gitconfig_include, which contains OS-specific configurations.
path = ~/.gitconfig_include
Then I have two .gitconfig_include files: one for Linux and another one for Windows.
This allows a symlink to have the same name, but different targets, depending on the OS.
Unfortunatelly, this strategy wasn't enough to handle all the requirements for my cross-platform dotfiles.
Vim's bad decision on Windows
For some reason, Vim looks for its files in
~/vimfiles instead of
~/.vim on Windows. This means that, if I wanted to maintain the same strategy, I would have to duplicate the files folder—which I didn't want to do, for obvious reasons.
Instead of duplicating the files folder, I've created a file matching the folder's name, with the ".symlinks" extension.
The .vim.symlinks file contains the symlink name for each environment.
This allows a symlink to have different names, but the same target, depending on the OS.
THE WORKING SOLUTION
If you want to check how everything ended up, please visit my dotfiles on GitHub.