From e08767466889bcf35a164b3c8a4eee6b113d0f8c Mon Sep 17 00:00:00 2001 From: a-sk Date: Thu, 3 Oct 2013 23:55:52 +0400 Subject: [PATCH 1/2] Fix zsh autocompletion file --- autocompletion/cheat.zsh | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/autocompletion/cheat.zsh b/autocompletion/cheat.zsh index 0ebec18..be33b0b 100644 --- a/autocompletion/cheat.zsh +++ b/autocompletion/cheat.zsh @@ -1,12 +1,5 @@ #compdef cheat -declare -a cheats cheats_in_this_dir - -for directory in $(cheat --cheat_directories); do - cheats_in_this_dir=($directory/*(N:r:t)) - [[ ${#cheats_in_this_dir} > 0 ]] && cheats+=($cheats_in_this_dir) -done - -_arguments "1:cheats:(${cheats})" - -return 1 +declare -a cheats +cheats=$(cheat -l | cut -d' ' -f1) +_arguments "1:cheats:(${cheats})" && return 0 From b5ed21d5b7bbd05429302cc76250432fc7203d27 Mon Sep 17 00:00:00 2001 From: a-sk Date: Thu, 3 Oct 2013 23:57:13 +0400 Subject: [PATCH 2/2] Prepand _ to cheat.zsh to make zsh autocompletions works --- autocompletion/{cheat.zsh => _cheat.zsh} | 0 setup.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename autocompletion/{cheat.zsh => _cheat.zsh} (100%) diff --git a/autocompletion/cheat.zsh b/autocompletion/_cheat.zsh similarity index 100% rename from autocompletion/cheat.zsh rename to autocompletion/_cheat.zsh diff --git a/setup.py b/setup.py index 663abbe..188831c 100644 --- a/setup.py +++ b/setup.py @@ -17,6 +17,6 @@ setup(name='cheat', package_data={'cheatsheets': [f for f in os.listdir('cheatsheets') if '.' not in f]}, scripts=['cheat'], - data_files=[('/usr/share/zsh/site-functions', ['autocompletion/cheat.zsh']), + data_files=[('/usr/share/zsh/site-functions', ['autocompletion/_cheat.zsh']), ('/etc/bash_completion.d' , ['autocompletion/cheat.bash'])] )