Permalink
Browse files

improve behavior when running xiki_continue on a file

  • Loading branch information...
1 parent 04cffb4 commit 025e3354ba3a376fcfd199f83149793da114d6fb @lunixbochs committed Oct 19, 2012
Showing with 13 additions and 6 deletions.
  1. +1 −1 README.markdown
  2. +12 −5 xiki.py
View
@@ -7,7 +7,7 @@ Hotkeys:
----
- `cmd+enter`: run or collapse the highlighted command/menu.
- `cmd+shift+enter`: run the current command, and place the cursor after the output.
- - If used on a directory, will indent to the subdirectory level and create a command prompt (`$`)
+ - If used on a directory or file, will indent to the subdirectory level and create a command prompt (`$`)
- If used on a command prompt, will maintain the current indentation and create a prompt (`$$` or `$`)
Useful SublimeXiki commands:
View
17 xiki.py
@@ -143,7 +143,7 @@ def xiki(view, cont=False):
cmd = None
persist = False
oldcwd = None
- path_op = False
+ op = None
view.sel().subtract(sel)
edit = view.begin_edit()
@@ -173,9 +173,11 @@ def xiki(view, cont=False):
do_clean = False
if do_clean and not cont:
+ op = 'cleanup'
cleanup(view, edit, pos, indent + INDENTATION)
# select(view, pos)
elif sign == '$' or sign == '$$':
+ op = 'command'
if path:
p = dirname(path, tree, tag)
@@ -197,19 +199,21 @@ def xiki(view, cont=False):
persist = True
elif path:
- path_op = True
# directory listing or file open
target = os.path.join(path, tree)
d, f = os.path.split(target)
f = unslash(f)
target = os.path.join(d, f)
if os.path.isfile(target):
+ op = 'file'
if platform.system() == 'Windows':
target = os.path.abspath(target)
- sublime.active_window().open_file(target)
+ if not cont:
+ sublime.active_window().open_file(target)
elif os.path.isdir(target):
+ op = 'dir'
dirs = ''
files = ''
listing = []
@@ -231,6 +235,7 @@ def xiki(view, cont=False):
# dunno here
pass
elif tree:
+ op = 'xiki'
cmd = ['xiki']
cmd += tree.split(' ')
@@ -250,14 +255,16 @@ def xiki(view, cont=False):
insert(view, edit, sel, output, indent + INDENTATION)
+ print 'here'
if cont:
region = find_region(view, pos, indent + INDENTATION)
end = view.line(region.end()).begin()
added = ''
- if path_op:
+ if op == 'file':
+ added += '$ '
+ elif op == 'dir':
added += INDENTATION + '$ '
-
elif sign in ('$$', '$'):
added += sign + ' '

0 comments on commit 025e335

Please sign in to comment.