diff --git a/default.py b/default.py index 00bffff..51dafdc 100644 --- a/default.py +++ b/default.py @@ -34,6 +34,10 @@ def current_working_dir(window): cwd += '/' return cwd +def path_dirname(window): + if hasattr(window.buffer, 'path'): + return os.path.dirname(window.buffer.path) + '/' + # default callback builders def build_constant(c): return lambda w: c diff --git a/method/__init__.py b/method/__init__.py index 4177bd9..8238e5b 100644 --- a/method/__init__.py +++ b/method/__init__.py @@ -197,7 +197,8 @@ class RegexReplace(Method): # navigating between buffers class OpenFile(Method): '''Open file in a new buffer, or go to file's open buffer''' - args = [Argument('filename', datatype="path", prompt="Open File: ")] + args = [Argument('filename', datatype="path", prompt="Open File: ", + default=default.path_dirname, load_default=True)] def _execute(self, w, **vargs): b = w.application.open_path(vargs['filename']) SwitchBuffer().execute(w, buffername=b.name())