Skip to content

Commit

Permalink
Improve ag tab completion
Browse files Browse the repository at this point in the history
* Remove unnecessary `uniq`
* Look for tags in tmp/tags or .git/tags
* Send errors to /dev/null if the file(s) do not exist

See http://tbaggery.com/2011/08/08/effortless-ctags-with-git.html for an
explanation behind the reasoning for .git/tags.
  • Loading branch information
joshuaclayton committed Aug 6, 2014
1 parent 9a2cb78 commit c17ff5a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions zsh/completion/_ag
@@ -1,9 +1,7 @@
#compdef ag

if (( CURRENT == 2 )); then
if [[ -a tmp/tags ]]; then
compadd $(cut -f 1 tmp/tags | uniq)
fi
compadd $(cut -f 1 tmp/tags .git/tags 2>/dev/null)
else;
_files
fi

0 comments on commit c17ff5a

Please sign in to comment.