branch: master commit caa69f24062128bffa1ac346c559241fde408bb6 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
counsel.el: Add git file completion * counsel.el (couns-git): Add. --- counsel.el | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/counsel.el b/counsel.el index c647888..b5c161b 100644 --- a/counsel.el +++ b/counsel.el @@ -47,6 +47,19 @@ #'cl-caddr (cider-sync-request:complete str ":same"))))) +(defun couns-git () + "Find file in the current Git repository." + (interactive) + (let* ((default-directory (locate-dominating-file + default-directory ".git")) + (cands (split-string + (shell-command-to-string + "git ls-files --full-name --") + "\n")) + (file (ivy-read "Find file: " cands))) + (when file + (find-file file)))) + (defun counsel--generic (completion-fn) "Complete thing at point with COMPLETION-FN." (let* ((bnd (bounds-of-thing-at-point 'symbol))