2016-05-16 02:00:44 +00:00
|
|
|
;;; packages.el --- Ivy Layer packages File
|
2016-01-04 19:17:35 +00:00
|
|
|
;;
|
2016-01-12 02:40:54 +00:00
|
|
|
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
|
2016-01-04 19:17:35 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2016-05-16 02:24:27 +00:00
|
|
|
(setq ivy-packages
|
2016-06-10 02:50:24 +00:00
|
|
|
'(
|
|
|
|
auto-highlight-symbol
|
2016-02-01 18:24:58 +00:00
|
|
|
counsel
|
2016-06-01 03:09:55 +00:00
|
|
|
(counsel-projectile :toggle (configuration-layer/package-usedp 'projectile))
|
2016-05-16 02:00:44 +00:00
|
|
|
evil
|
2016-01-04 19:17:35 +00:00
|
|
|
flx
|
2016-06-07 21:00:37 +00:00
|
|
|
helm-make
|
2016-05-16 02:00:44 +00:00
|
|
|
ivy
|
2016-06-01 06:26:50 +00:00
|
|
|
ivy-hydra
|
2016-01-04 19:17:35 +00:00
|
|
|
(ivy-spacemacs-help :location local)
|
2016-06-01 03:39:47 +00:00
|
|
|
persp-mode
|
2016-05-16 02:00:44 +00:00
|
|
|
projectile
|
2016-01-04 19:17:35 +00:00
|
|
|
smex
|
2016-02-11 21:21:46 +00:00
|
|
|
swiper
|
2016-06-10 02:50:24 +00:00
|
|
|
wgrep
|
|
|
|
))
|
2016-01-04 19:17:35 +00:00
|
|
|
|
2016-06-10 02:50:24 +00:00
|
|
|
(defun ivy/pre-init-auto-highlight-symbol ()
|
|
|
|
(spacemacs|use-package-add-hook auto-highlight-symbol
|
|
|
|
:post-init
|
|
|
|
;; add some functions to ahs transient states
|
|
|
|
(setq spacemacs--symbol-highlight-transient-state-doc
|
|
|
|
(concat spacemacs--symbol-highlight-transient-state-doc
|
|
|
|
" [_b_] search buffers [_/_] search proj [_f_] search files")
|
|
|
|
spacemacs-symbol-highlight-transient-state-add-bindings
|
|
|
|
'(("/" spacemacs/search-project-auto-region-or-symbol :exit t)
|
|
|
|
("b" spacemacs/swiper-all-region-or-symbol :exit t)
|
|
|
|
("f" spacemacs/search-auto-region-or-symbol :exit t)))))
|
2016-06-01 06:26:50 +00:00
|
|
|
|
2016-05-16 02:24:27 +00:00
|
|
|
(defun ivy/init-counsel ()
|
2016-01-04 19:17:35 +00:00
|
|
|
(use-package counsel
|
|
|
|
:config
|
2016-01-09 20:45:15 +00:00
|
|
|
(progn
|
2016-01-13 05:15:11 +00:00
|
|
|
(define-key counsel-find-file-map (kbd "C-h") 'counsel-up-directory)
|
2016-01-09 20:45:15 +00:00
|
|
|
(spacemacs/set-leader-keys
|
2016-01-10 06:22:49 +00:00
|
|
|
dotspacemacs-emacs-command-key 'counsel-M-x
|
2016-01-09 20:45:15 +00:00
|
|
|
;; files
|
|
|
|
"ff" 'counsel-find-file
|
|
|
|
"fL" 'counsel-locate
|
|
|
|
;; help
|
2016-01-12 14:35:33 +00:00
|
|
|
"?" 'counsel-descbinds
|
2016-01-09 20:45:15 +00:00
|
|
|
"hdf" 'counsel-describe-function
|
2016-01-10 06:20:26 +00:00
|
|
|
"hdm" 'spacemacs/describe-mode
|
2016-01-09 20:45:15 +00:00
|
|
|
"hdv" 'counsel-describe-variable
|
2016-01-18 19:11:33 +00:00
|
|
|
"hR" 'spacemacs/counsel-search-docs
|
2016-01-09 20:45:15 +00:00
|
|
|
;; insert
|
|
|
|
"iu" 'counsel-unicode-char
|
|
|
|
;; jump
|
2016-01-10 18:12:22 +00:00
|
|
|
;; register/ring
|
|
|
|
"ry" 'counsel-yank-pop
|
2016-01-09 20:45:15 +00:00
|
|
|
;; jumping
|
|
|
|
"sj" 'counsel-imenu
|
|
|
|
;; themes
|
2016-02-19 07:39:36 +00:00
|
|
|
"Ts" 'counsel-load-theme
|
2016-01-09 20:45:15 +00:00
|
|
|
;; search
|
|
|
|
"/" 'spacemacs/search-project-auto
|
|
|
|
"*" 'spacemacs/search-project-auto-region-or-symbol
|
|
|
|
"sf" 'spacemacs/search-auto
|
|
|
|
"sF" 'spacemacs/search-auto-region-or-symbol
|
2016-01-11 04:00:20 +00:00
|
|
|
"sp" 'spacemacs/search-project-auto
|
|
|
|
"sP" 'spacemacs/search-project-auto-region-or-symbol
|
2016-01-09 20:45:15 +00:00
|
|
|
"saf" 'spacemacs/search-ag
|
|
|
|
"saF" 'spacemacs/search-ag-region-or-symbol
|
|
|
|
"sap" 'spacemacs/search-project-ag
|
|
|
|
"saP" 'spacemacs/search-project-ag-region-or-symbol
|
|
|
|
"stf" 'spacemacs/search-pt
|
|
|
|
"stF" 'spacemacs/search-pt-region-or-symbol
|
|
|
|
"stp" 'spacemacs/search-project-pt
|
|
|
|
"stP" 'spacemacs/search-project-pt-region-or-symbol
|
|
|
|
"sgf" 'spacemacs/search-grep
|
|
|
|
"sgF" 'spacemacs/search-grep-region-or-symbol
|
|
|
|
"sgp" 'counsel-git-grep
|
|
|
|
"sgP" 'spacemacs/counsel-git-grep-region-or-symbol
|
|
|
|
"skf" 'spacemacs/search-ack
|
|
|
|
"skF" 'spacemacs/search-ack-region-or-symbol
|
|
|
|
"skp" 'spacemacs/search-project-ack
|
|
|
|
"skP" 'spacemacs/search-project-ack-region-or-symbol)
|
2016-05-18 00:08:08 +00:00
|
|
|
|
|
|
|
;; set additional ivy actions
|
|
|
|
(ivy-set-actions
|
|
|
|
'counsel-find-file
|
|
|
|
spacemacs--ivy-file-actions)
|
|
|
|
|
2016-03-03 16:51:22 +00:00
|
|
|
;; remaps built-in commands that have a counsel replacement
|
|
|
|
(counsel-mode 1)
|
2016-03-06 04:24:51 +00:00
|
|
|
(spacemacs|hide-lighter counsel-mode)
|
2016-05-16 02:00:44 +00:00
|
|
|
;; TODO Commands to port
|
2016-03-18 02:43:43 +00:00
|
|
|
(spacemacs//ivy-command-not-implemented-yet "jI")
|
|
|
|
;; Set syntax highlighting for counsel search results
|
|
|
|
(ivy-set-display-transformer 'spacemacs/counsel-search 'counsel-git-grep-transformer))))
|
2016-01-04 19:17:35 +00:00
|
|
|
|
2016-05-19 06:44:57 +00:00
|
|
|
(defun ivy/init-counsel-projectile ()
|
2016-06-01 03:09:55 +00:00
|
|
|
(use-package counsel-projectile
|
|
|
|
:defer t
|
|
|
|
:init
|
2016-06-01 03:19:54 +00:00
|
|
|
;; overwrite projectile settings
|
|
|
|
(spacemacs|use-package-add-hook projectile
|
|
|
|
:post-init
|
|
|
|
(progn
|
2016-06-02 10:14:34 +00:00
|
|
|
(setq projectile-switch-project-action 'counsel-projectile-find-file)
|
2016-06-01 03:19:54 +00:00
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"pb" 'counsel-projectile-switch-to-buffer
|
|
|
|
"pd" 'counsel-projectile-find-dir
|
|
|
|
"pp" 'counsel-projectile
|
|
|
|
"pf" 'counsel-projectile-find-file
|
|
|
|
"pr" 'projectile-recentf)))))
|
2016-05-19 06:44:57 +00:00
|
|
|
|
2016-06-08 07:28:53 +00:00
|
|
|
(defun ivy/post-init-evil ()
|
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"re" 'spacemacs/ivy-evil-registers))
|
2016-02-01 18:24:58 +00:00
|
|
|
|
2016-05-16 02:24:27 +00:00
|
|
|
(defun ivy/init-flx ())
|
2016-01-04 19:17:35 +00:00
|
|
|
|
2016-06-07 21:00:37 +00:00
|
|
|
(defun ivy/init-helm-make ()
|
|
|
|
(use-package helm-make
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(setq helm-make-completion-method 'ivy)
|
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"cc" 'helm-make-projectile
|
|
|
|
"cm" 'helm-make))))
|
|
|
|
|
2016-05-16 02:24:27 +00:00
|
|
|
(defun ivy/init-ivy ()
|
2016-01-04 19:17:35 +00:00
|
|
|
(use-package ivy
|
|
|
|
:config
|
2016-01-09 20:29:37 +00:00
|
|
|
(progn
|
|
|
|
(with-eval-after-load 'recentf
|
|
|
|
;; merge recentf and bookmarks into buffer switching. If we set this
|
2016-01-09 20:45:15 +00:00
|
|
|
;; before recentf loads, then ivy-mode loads recentf for us,
|
|
|
|
;; which messes up the spacemacs version of recentf.
|
2016-01-09 20:29:37 +00:00
|
|
|
(setq ivy-use-virtual-buffers t))
|
2016-05-16 02:00:44 +00:00
|
|
|
;; Key bindings
|
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"a'" 'spacemacs/ivy-available-repls
|
|
|
|
"fr" 'ivy-recentf
|
|
|
|
"rl" 'ivy-resume
|
|
|
|
"bb" 'ivy-switch-buffer)
|
2016-05-18 00:08:08 +00:00
|
|
|
|
|
|
|
;; custom actions for recentf
|
|
|
|
(ivy-set-actions
|
|
|
|
'ivy-recentf
|
|
|
|
spacemacs--ivy-file-actions)
|
|
|
|
|
2016-01-09 20:29:37 +00:00
|
|
|
(ivy-mode 1)
|
|
|
|
(global-set-key (kbd "C-c C-r") 'ivy-resume)
|
|
|
|
(global-set-key (kbd "<f6>") 'ivy-resume)
|
2016-02-09 13:57:27 +00:00
|
|
|
;; Occur
|
2016-05-16 02:00:44 +00:00
|
|
|
(evil-make-overriding-map ivy-occur-mode-map 'normal)
|
|
|
|
(ivy-set-occur 'spacemacs/counsel-search
|
|
|
|
'spacemacs//counsel-occur)
|
2016-02-11 21:21:46 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'ivy-occur-grep-mode
|
|
|
|
"w" 'ivy-wgrep-change-to-wgrep-mode)
|
2016-05-16 02:00:44 +00:00
|
|
|
;; Why do we do this ?
|
|
|
|
(ido-mode -1))))
|
2016-01-04 19:17:35 +00:00
|
|
|
|
2016-06-08 07:28:53 +00:00
|
|
|
(defun ivy/init-ivy-hydra ()
|
|
|
|
(use-package ivy-hydra))
|
|
|
|
|
2016-06-01 03:39:47 +00:00
|
|
|
(defun ivy/post-init-persp-mode ()
|
2016-05-18 00:08:08 +00:00
|
|
|
(ivy-set-actions
|
2016-06-01 03:39:47 +00:00
|
|
|
'spacemacs/ivy-spacemacs-layouts
|
|
|
|
'(("c" persp-kill-without-buffers "Close layout(s)")
|
|
|
|
("k" persp-kill "Kill layout(s)")))
|
2016-05-18 00:08:08 +00:00
|
|
|
(setq spacemacs-layouts-transient-state-remove-bindings
|
|
|
|
'("b" "l" "C" "X"))
|
|
|
|
(setq spacemacs-layouts-transient-state-add-bindings
|
2016-06-01 03:39:47 +00:00
|
|
|
'(("b" spacemacs/ivy-spacemacs-layout-buffer)
|
|
|
|
("l" spacemacs/ivy-spacemacs-layouts)
|
|
|
|
("C" spacemacs/ivy-spacemacs-layout-close-other :exit t)
|
|
|
|
("X" spacemacs/ivy-spacemacs-layout-kill-other :exit t))))
|
2016-05-18 00:08:08 +00:00
|
|
|
|
2016-05-16 02:24:27 +00:00
|
|
|
(defun ivy/post-init-projectile ()
|
2016-05-16 02:00:44 +00:00
|
|
|
(setq projectile-completion-system 'ivy)
|
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"pp" 'projectile-switch-project
|
|
|
|
"pv" 'projectile-vc))
|
|
|
|
|
2016-05-16 02:24:27 +00:00
|
|
|
(defun ivy/init-smex ()
|
2016-01-09 20:45:15 +00:00
|
|
|
(use-package smex
|
|
|
|
:defer t
|
|
|
|
:init (setq-default smex-history-length 32
|
|
|
|
smex-save-file (concat spacemacs-cache-directory
|
|
|
|
".smex-items"))))
|
|
|
|
|
2016-05-16 02:24:27 +00:00
|
|
|
(defun ivy/init-ivy-spacemacs-help ()
|
2016-01-09 20:45:15 +00:00
|
|
|
(use-package ivy-spacemacs-help
|
2016-01-13 05:37:26 +00:00
|
|
|
:commands (ivy-spacemacs-help-dotspacemacs
|
|
|
|
ivy-spacemacs-help
|
|
|
|
ivy-spacemacs-help-faq
|
|
|
|
ivy-spacemacs-help-layers
|
|
|
|
ivy-spacemacs-help-packages
|
|
|
|
ivy-spacemacs-help-docs
|
|
|
|
ivy-spacemacs-help-toggles)
|
2016-01-09 20:45:15 +00:00
|
|
|
:init (spacemacs/set-leader-keys
|
2016-01-13 05:37:26 +00:00
|
|
|
"h ." 'ivy-spacemacs-help-dotspacemacs
|
|
|
|
"h SPC" 'ivy-spacemacs-help
|
|
|
|
"h f" 'ivy-spacemacs-help-faq
|
|
|
|
"h l" 'ivy-spacemacs-help-layers
|
|
|
|
"h p" 'ivy-spacemacs-help-packages
|
|
|
|
"h r" 'ivy-spacemacs-help-docs
|
|
|
|
"h t" 'ivy-spacemacs-help-toggles)))
|
2016-01-09 20:45:15 +00:00
|
|
|
|
2016-05-16 02:24:27 +00:00
|
|
|
(defun ivy/init-swiper ()
|
2016-01-04 19:17:35 +00:00
|
|
|
(use-package swiper
|
|
|
|
:config
|
2016-01-09 20:45:15 +00:00
|
|
|
(progn
|
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"ss" 'swiper
|
|
|
|
"sS" 'spacemacs/swiper-region-or-symbol
|
|
|
|
"sb" 'swiper-all
|
|
|
|
"sB" 'spacemacs/swiper-all-region-or-symbol)
|
|
|
|
(global-set-key "\C-s" 'swiper))))
|
2016-02-11 21:21:46 +00:00
|
|
|
|
2016-05-16 02:24:27 +00:00
|
|
|
(defun ivy/init-wgrep ()
|
2016-05-16 02:00:44 +00:00
|
|
|
(evil-define-key 'normal wgrep-mode-map ",," 'wgrep-finish-edit)
|
|
|
|
(evil-define-key 'normal wgrep-mode-map ",c" 'wgrep-finish-edit)
|
|
|
|
(evil-define-key 'normal wgrep-mode-map ",a" 'wgrep-abort-changes)
|
|
|
|
(evil-define-key 'normal wgrep-mode-map ",k" 'wgrep-abort-changes))
|