WSL 2 changes the output of `uname -r`. For instance,
WSL 1: 4.4.0-18980-Microsoft
WSL 2: 4.19.67-microsoft-standard
Since WSL 2 lowercases the M, we can match for the rest of the string
which remains lowercase throughout both versions. Another option would
be to match for both upper- and lower-case Ms, like that:
$(uname -r) = *[Mm]icrosoft*
Fixed use of nohup in open_command where it was only necessary for
xdg-open (and actually harmful for cmd.exe in WSL 2). The current logic
is simpler and more future-proof.
* convert to 2-space indentation
* standardize sublime function name (subl)
* simplify subl function definition into a single loop
* convert functions into aliases
* simplify alias creation
* search for Sublime Text command only if not found
* reorganize and clean up plugin
* fix README
* simplify cygwin path lookup
* support path lookup for msys (Windows)
* support path lookup for WSL (Windows)
* fix for spaces in sublime path alias
Without this change, whether a function can invoke 'subl' depends on the order in which modules are loaded. With this change, the order doesn't matter.
zsh resolves aliases at parse time not run time, which means if you invoke an alias from a function, the alias must be defined before the function.
See http://stackoverflow.com/a/25532276/893113 which refers to an explanation of this limitation.
For code which may be used non-interactively, the recommend workaround is to use functions instead of aliases.
- Fixed subl search path order in Mac because Sublime Text 3 is named
Sublime Text.app by default instead of Sublime Text 3.app and they are
mostly likely to be placed in /Applications instead of
$HOME/Applications.
- Fixed sublime text binary path in Linux. The sublime_text binary
installed by Ubuntu installer is placed in /opt/sublime_text/sublime_text
instead of /usr/bin/sublime_text.
- Use zsh's built-in process detach syntax instead of nohup.
User changed symbolic link for sublime binary is now top priority,
since this allows users to actually specify which version of sublime
they want to use. Sublime text 2 binary has higher priority over
sublime text (3) binary, since sublime text 2 is considered more
stable.
Detects the platform using "uname", and sets the alias accordingly.
If you are using Linux, this assumes that you have created a
symbolic link to /usr/bin/sublime_text.