Update to new tako
This commit is contained in:
parent
254412d0a0
commit
2a2978e787
3 changed files with 16 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from os.path import isdir, join
|
||||
|
||||
ROOT = __tako_env__.get('PASSWORD_STORE_DIR', $HOME + '/.password-store')
|
||||
ROOT = ${...}.get('PASSWORD_STORE_DIR', $HOME + '/.password-store')
|
||||
SUFFIX = '.gpg'
|
||||
|
||||
def make_display(directory):
|
||||
|
|
@ -13,9 +13,6 @@ def make_display(directory):
|
|||
return display
|
||||
|
||||
def passget_completer(prefix, line, begidx, endidx, ctx):
|
||||
'''
|
||||
Completes with
|
||||
'''
|
||||
if not line.startswith('passget'): return {}
|
||||
|
||||
directory = ''
|
||||
|
|
@ -26,7 +23,7 @@ def passget_completer(prefix, line, begidx, endidx, ctx):
|
|||
directory = join(directory, pre_dir)
|
||||
prefix = pre
|
||||
|
||||
completions = $(ls @(join(ROOT, directory)))
|
||||
completions = $(ls @(join(ROOT, directory))).splitlines()
|
||||
|
||||
display = make_display(directory)
|
||||
return {display(i) for i in completions if i.startswith(prefix)}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ def source_many(directory, predicate):
|
|||
if not predicate(filename): continue
|
||||
source @(join(directory, filename))
|
||||
|
||||
is_tako = lambda filename: re.match('^.*\.tako', filename)
|
||||
is_tako = (lambda re: lambda filename: re.match('^.*\.tako$', filename))(re)
|
||||
source_many('/etc/profile.d', is_tako)
|
||||
source_many($HOME + '/.config/tako/completers', is_tako)
|
||||
|
||||
|
|
@ -39,6 +39,9 @@ def _workon(args, stdin=None):
|
|||
]):
|
||||
source @(f)
|
||||
|
||||
def _sympy(args, stdin=None):
|
||||
source @($HOME + '/.config/tako/sympy.tako')
|
||||
|
||||
$TAKO_SETTINGS.aliases.update({
|
||||
'startx': 'ssh-agent startx ; vlock',
|
||||
'ls': 'ls --color=auto',
|
||||
|
|
@ -49,6 +52,8 @@ $TAKO_SETTINGS.aliases.update({
|
|||
'vol': 'pulseaudio-ctl set',
|
||||
'workon': _workon,
|
||||
'octave': 'octave-cli',
|
||||
'bc': 'bc -l',
|
||||
'sympy': _sympy,
|
||||
})
|
||||
|
||||
if 'TERM' in ${...}:
|
||||
|
|
@ -81,6 +86,7 @@ if 'TERM' in ${...}:
|
|||
return prefix + text + suffix
|
||||
|
||||
def git_branch():
|
||||
import re
|
||||
ref=$(git symbolic-ref HEAD err> /dev/null)
|
||||
if not ref: return None
|
||||
prefix = colorize('gray', ':')
|
||||
|
|
@ -108,3 +114,5 @@ if 'TERM' in ${...}:
|
|||
$TAKO_SETTINGS.show_traceback = True
|
||||
$TAKO_SETTINGS.traceback_logfile = $HOME + '/tmp/tako.log'
|
||||
$TAKO_SETTINGS.case_sensitive_completions = False
|
||||
|
||||
completer bash enable out> /dev/null
|
||||
|
|
|
|||
5
tako/sympy.tako
Normal file
5
tako/sympy.tako
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from sympy import *
|
||||
|
||||
init_printing(use_unicode=True)
|
||||
|
||||
$TAKO_SETTINGS.number_mode = 'python'
|
||||
Loading…
Add table
Add a link
Reference in a new issue