emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master caa69f2 43/67: counsel.el: Add git file completion


From: Oleh Krehel
Subject: [elpa] master caa69f2 43/67: counsel.el: Add git file completion
Date: Sun, 22 Mar 2015 17:34:04 +0000

branch: master
commit caa69f24062128bffa1ac346c559241fde408bb6
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]