summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck.cuny@gmail.com>2016-10-29 14:14:42 -0700
committerFranck Cuny <franck.cuny@gmail.com>2016-10-29 14:14:42 -0700
commitdac981f7d4e99e9fca7b331ca93f48e12e1734d6 (patch)
tree206ff53de05fba7bcd5bc475bbb5311e4ca13b38
parent[emacs] Move server configuration at the top. (diff)
downloademacs.d-dac981f7d4e99e9fca7b331ca93f48e12e1734d6.tar.gz
[emacs] Add main configuration for `ivy'.
-rw-r--r--emacs.d/init.el37
1 files changed, 37 insertions, 0 deletions
diff --git a/emacs.d/init.el b/emacs.d/init.el
index 54fe001..3b1be0c 100644
--- a/emacs.d/init.el
+++ b/emacs.d/init.el
@@ -206,6 +206,43 @@
                (setq mode-name "≣")
                (ibuffer-switch-to-saved-filter-groups "default"))))
 
+(use-package ivy
+  :config
+  (ivy-mode 1)
+  (setq ivy-use-virtual-buffers t)
+  (setq ivy-height 10)
+  (setq ivy-count-format "(%d/%d) ")
+  (setq ivy-initial-inputs-alist nil)
+  ;; from https://github.com/company-mode/company-statistics
+  ;; ignore buffers in the ignore buffer list.
+  (setq ivy-use-ignore-default 'always)
+  (setq ivy-ignore-buffers '("company-statistics-cache.el" "company-statistics-autoload.el"))
+  ;; if ivy-flip is t, presents results on top of query.
+  (setq ivy-flip nil)
+  (setq ivy-re-builders-alist
+	'((swiper . ivy--regex-ignore-order)
+	  (t . ivy--regex-fuzzy)
+	  (t   . ivy--regex-ignore-order)))
+
+  (defun ivy-switch-project ()
+    (interactive)
+    (ivy-read
+     "Switch to project: "
+     (if (projectile-project-p)
+	 (cons (abbreviate-file-name (projectile-project-root))
+	       (projectile-relevant-known-projects))
+       projectile-known-projects)
+     :action #'projectile-switch-project-by-name))
+
+  (global-set-key (kbd "C-c m") 'ivy-switch-project)
+
+  (ivy-set-actions
+   'ivy-switch-project
+   '(("d" dired "Open Dired in project's directory")
+     ("v" counsel-projectile "Open project root in vc-dir or magit")
+     ("c" projectile-compile-project "Compile project")
+     ("r" projectile-remove-known-project "Remove project(s)"))))
+
 (use-package json-mode
   :ensure t
   :mode "\\.json\\'"