Add plugin for opening file browser from prompt #1039

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants

lonnon commented Mar 28, 2012

  • Contains functions for invoking various OS-specific utilities that open a directory in the system's file browser.
  • Also suitable for popping open URLs and files in whatever the system thinks is appropriate.
  • Supports Windows, Cygwin on Windows, OS X, Gnome, KDE, and possibly others via XDG.
@lonnon lonnon Add plugin for opening file browser from prompt
* Contains functions for invoking various OS-specific utilities that
  open a directory in the system's file browser.
* Also suitable for popping open URLs and files in whatever the system
  thinks is appropriate.
* Supports Windows, Cygwin on Windows, OS X, Gnome, KDE, and possibly
  others via XDG.
8c84d10
Collaborator

mcornella commented May 20, 2014

This needs to separate the logic into different platforms, rather than just falling into the next command if the first is not found. In Linux, for example, there is a package that adds a start command that starts services, not like the start in Windows.
Also, as far as I know, xdg-open is always going to work in Linux without spitting out any errors in the console, while gnome-open will most likely open nautilus and probably spit some error or debug message.

In my system, I have alias o=xdg-open to open whatever file with the default application, and alias o.=xdg-open . to open the current directory.

Collaborator

mcornella commented May 27, 2014

@lonnon any updates?

Contributor

halilim commented Aug 18, 2014

A simple version of this (with just open and xdg-open) is already used in four of the plugins: https://github.com/robbyrussell/oh-my-zsh/search?utf8=%E2%9C%93&q=xdg-open&type=Code (and with the exact same code, now talk about DRY!).

Also note that you can open files using this if you specify a file with the default editor configured for the type of the specified file.

And if we are going to follow @mcornella's suggestion for detecting platform, you may want to use $OSTYPE instead of uname: #2744

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment