diff --git a/plugins/atom-cygwin/README.md b/plugins/atom-cygwin/README.md new file mode 100644 index 00000000..919bc9e8 --- /dev/null +++ b/plugins/atom-cygwin/README.md @@ -0,0 +1,17 @@ +## atom-cygwin + +This plugin allows invoking the Atom Editor from Cygwin using the `atom` command. +For this purpose, it uses `cygpath` to convert between Unix and Windows paths. + +### Requirements + + * [Atom](https://atom.io/) + * [Cygwin](https://www.cygwin.com/) + +### Usage + +Same as the original CLI script (pointed by `${LOCALAPPDATA}/atom/bin/atom`). + + * If `atom` command is called without an argument, launch Atom + * If `atom` is passed a directory, open it in Atom + * If `atom` is passed a file, open it in Atom diff --git a/plugins/atom-cygwin/atom-cygwin.plugin.zsh b/plugins/atom-cygwin/atom-cygwin.plugin.zsh new file mode 100644 index 00000000..a622294e --- /dev/null +++ b/plugins/atom-cygwin/atom-cygwin.plugin.zsh @@ -0,0 +1,18 @@ +if [[ "$OSTYPE" == "cygwin" ]]; then + local _atom_path > /dev/null 2>&1 + + _atom_path=${LOCALAPPDATA}/atom/bin/atom + + if [[ -a $_atom_path ]]; then + cyg_open_atom() + { + if [[ -n $1 ]]; then + ${_atom_path} `cygpath -w -a $1` + else + ${_atom_path} + fi + } + + alias atom=cyg_open_atom + fi +fi