2016-05-16 02:00:44 +00:00
|
|
|
;;; packages.el --- Ivy Layer packages File
|
2016-01-04 19:17:35 +00:00
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 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-11-04 16:12:03 +00:00
|
|
|
bookmark
|
2016-02-01 18:24:58 +00:00
|
|
|
counsel
|
2018-01-19 10:52:08 +00:00
|
|
|
counsel-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
|
2018-06-06 19:37:58 +00:00
|
|
|
imenu
|
2016-05-16 02:00:44 +00:00
|
|
|
ivy
|
2016-06-01 06:26:50 +00:00
|
|
|
ivy-hydra
|
2018-01-11 03:19:04 +00:00
|
|
|
(ivy-rich :toggle ivy-enable-advanced-buffer-information)
|
2016-01-04 19:17:35 +00:00
|
|
|
(ivy-spacemacs-help :location local)
|
2018-02-19 03:48:12 +00:00
|
|
|
ivy-xref
|
2018-01-06 16:51:19 +00:00
|
|
|
org
|
2016-06-01 03:39:47 +00:00
|
|
|
persp-mode
|
2016-05-16 02:00:44 +00:00
|
|
|
projectile
|
2016-12-09 03:36:54 +00:00
|
|
|
recentf
|
2018-01-07 02:44:58 +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
|
2017-08-31 19:30:23 +00:00
|
|
|
(concat
|
|
|
|
spacemacs--symbol-highlight-transient-state-doc
|
|
|
|
" Search: [_s_] swiper [_b_] buffers [_f_] files [_/_] project"))
|
2017-05-23 22:31:54 +00:00
|
|
|
(spacemacs/transient-state-register-add-bindings 'symbol-highlight
|
2017-08-31 19:30:23 +00:00
|
|
|
'(("s" spacemacs/swiper-region-or-symbol :exit t)
|
2017-05-23 22:31:54 +00:00
|
|
|
("b" spacemacs/swiper-all-region-or-symbol :exit t)
|
|
|
|
("f" spacemacs/search-auto-region-or-symbol :exit t)
|
2017-08-31 19:30:23 +00:00
|
|
|
("/" spacemacs/search-project-auto-region-or-symbol :exit t)))))
|
2016-06-01 06:26:50 +00:00
|
|
|
|
2018-01-07 02:44:58 +00:00
|
|
|
(defun ivy/post-init-bookmark ()
|
|
|
|
(spacemacs/set-leader-keys "fb" 'counsel-bookmark))
|
|
|
|
|
2016-05-16 02:24:27 +00:00
|
|
|
(defun ivy/init-counsel ()
|
2016-01-04 19:17:35 +00:00
|
|
|
(use-package counsel
|
2016-12-09 03:36:54 +00:00
|
|
|
:init
|
2016-01-09 20:45:15 +00:00
|
|
|
(progn
|
|
|
|
(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
|
2017-04-12 11:48:52 +00:00
|
|
|
"fel" 'counsel-find-library
|
2016-01-09 20:45:15 +00:00
|
|
|
"fL" 'counsel-locate
|
|
|
|
;; help
|
2016-01-12 14:35:33 +00:00
|
|
|
"?" 'counsel-descbinds
|
2019-02-11 15:01:29 +00:00
|
|
|
"hda" 'counsel-apropos
|
2016-01-09 20:45:15 +00:00
|
|
|
"hdf" 'counsel-describe-function
|
2017-04-21 16:59:25 +00:00
|
|
|
"hdF" 'counsel-describe-face
|
2016-01-10 06:20:26 +00:00
|
|
|
"hdm" 'spacemacs/describe-mode
|
2016-01-09 20:45:15 +00:00
|
|
|
"hdv" 'counsel-describe-variable
|
2017-04-12 11:48:52 +00:00
|
|
|
"hi" 'counsel-info-lookup-symbol
|
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
|
2017-07-09 15:19:13 +00:00
|
|
|
"rm" 'counsel-mark-ring
|
2016-01-09 20:45:15 +00:00
|
|
|
;; jumping
|
2018-06-06 19:37:58 +00:00
|
|
|
"sj" 'spacemacs/counsel-jump-in-buffer
|
2016-01-09 20:45:15 +00:00
|
|
|
;; 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
|
2017-07-01 10:41:26 +00:00
|
|
|
"sd" 'spacemacs/search-dir-auto
|
|
|
|
"sD" 'spacemacs/search-dir-auto-region-or-symbol
|
2016-01-09 20:45:15 +00:00
|
|
|
"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
|
2017-07-01 10:41:26 +00:00
|
|
|
"sad" 'spacemacs/search-dir-ag
|
|
|
|
"saD" 'spacemacs/search-dir-ag-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
|
2017-07-01 10:41:26 +00:00
|
|
|
"sgd" 'spacemacs/search-dir-grep
|
|
|
|
"sgD" 'spacemacs/search-dir-grep-region-or-symbol
|
2016-01-09 20:45:15 +00:00
|
|
|
"sgf" 'spacemacs/search-grep
|
|
|
|
"sgF" 'spacemacs/search-grep-region-or-symbol
|
|
|
|
"sgp" 'counsel-git-grep
|
|
|
|
"sgP" 'spacemacs/counsel-git-grep-region-or-symbol
|
2019-03-08 12:57:32 +00:00
|
|
|
"skd" 'spacemacs/search-dir-ack
|
|
|
|
"skD" 'spacemacs/search-dir-ack-region-or-symbol
|
2016-01-09 20:45:15 +00:00
|
|
|
"skf" 'spacemacs/search-ack
|
|
|
|
"skF" 'spacemacs/search-ack-region-or-symbol
|
|
|
|
"skp" 'spacemacs/search-project-ack
|
2016-10-20 00:29:06 +00:00
|
|
|
"skP" 'spacemacs/search-project-ack-region-or-symbol
|
2019-03-08 12:57:32 +00:00
|
|
|
"srd" 'spacemacs/search-dir-rg
|
|
|
|
"srD" 'spacemacs/search-dir-rg-region-or-symbol
|
2016-10-20 00:29:06 +00:00
|
|
|
"srf" 'spacemacs/search-rg
|
|
|
|
"srF" 'spacemacs/search-rg-region-or-symbol
|
|
|
|
"srp" 'spacemacs/search-project-rg
|
|
|
|
"srP" 'spacemacs/search-project-rg-region-or-symbol
|
2019-03-08 12:57:32 +00:00
|
|
|
"std" 'spacemacs/search-dir-pt
|
|
|
|
"stD" 'spacemacs/search-dir-pt-region-or-symbol
|
2016-10-20 00:29:06 +00:00
|
|
|
"stf" 'spacemacs/search-pt
|
|
|
|
"stF" 'spacemacs/search-pt-region-or-symbol
|
|
|
|
"stp" 'spacemacs/search-project-pt
|
2016-12-09 03:36:54 +00:00
|
|
|
"stP" 'spacemacs/search-project-pt-region-or-symbol))
|
|
|
|
:config
|
|
|
|
(progn
|
2018-12-27 01:23:28 +00:00
|
|
|
;; Temporarily handle older versions of ivy
|
|
|
|
;; https://github.com/abo-abo/swiper/pull/1863/files
|
|
|
|
(unless (fboundp 'counsel--elisp-to-pcre)
|
|
|
|
(defalias 'counsel--elisp-to-pcre 'counsel-unquote-regex-parens))
|
|
|
|
|
2016-05-18 00:08:08 +00:00
|
|
|
;; set additional ivy actions
|
|
|
|
(ivy-set-actions
|
|
|
|
'counsel-find-file
|
|
|
|
spacemacs--ivy-file-actions)
|
|
|
|
|
2016-12-09 03:36:54 +00:00
|
|
|
(define-key counsel-find-file-map (kbd "C-h") 'counsel-up-directory)
|
2018-05-18 16:05:23 +00:00
|
|
|
(define-key read-expression-map (kbd "C-r") 'counsel-minibuffer-history)
|
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
|
|
|
|
2018-01-11 04:57:18 +00:00
|
|
|
(defun ivy/pre-init-counsel-projectile ()
|
|
|
|
;; overwrite projectile settings
|
|
|
|
(spacemacs|use-package-add-hook projectile
|
|
|
|
:post-init
|
|
|
|
(progn
|
|
|
|
(setq projectile-switch-project-action 'counsel-projectile-find-file)
|
2016-12-09 03:36:54 +00:00
|
|
|
|
2018-01-11 04:57:18 +00:00
|
|
|
(ivy-set-actions
|
|
|
|
'counsel-projectile-find-file
|
|
|
|
(append spacemacs--ivy-file-actions
|
|
|
|
'(("R" (lambda (arg)
|
|
|
|
(interactive)
|
|
|
|
(call-interactively
|
|
|
|
#'projectile-invalidate-cache)
|
|
|
|
(ivy-resume)) "refresh list")
|
|
|
|
)))
|
2016-12-09 03:36:54 +00:00
|
|
|
|
2018-01-11 04:57:18 +00:00
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"p SPC" 'counsel-projectile
|
|
|
|
"pb" 'counsel-projectile-switch-to-buffer
|
|
|
|
"pd" 'counsel-projectile-find-dir
|
|
|
|
"pp" 'counsel-projectile-switch-project
|
|
|
|
"pf" 'counsel-projectile-find-file))))
|
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-12-09 03:36:54 +00:00
|
|
|
(defun ivy/init-flx ()
|
2018-03-04 04:37:53 +00:00
|
|
|
(use-package 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
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-06-07 21:00:37 +00:00
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(setq helm-make-completion-method 'ivy)
|
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"cc" 'helm-make-projectile
|
|
|
|
"cm" 'helm-make))))
|
|
|
|
|
2016-08-26 00:42:01 +00:00
|
|
|
(defun ivy/post-init-imenu ()
|
2018-06-06 19:37:58 +00:00
|
|
|
(spacemacs/set-leader-keys "ji" 'spacemacs/counsel-jump-in-buffer))
|
2016-08-26 00:42:01 +00:00
|
|
|
|
2016-05-16 02:24:27 +00:00
|
|
|
(defun ivy/init-ivy ()
|
2016-01-04 19:17:35 +00:00
|
|
|
(use-package ivy
|
2016-12-09 03:36:54 +00:00
|
|
|
:init
|
2016-01-09 20:29:37 +00:00
|
|
|
(progn
|
2016-05-16 02:00:44 +00:00
|
|
|
;; Key bindings
|
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"a'" 'spacemacs/ivy-available-repls
|
2016-08-30 07:04:47 +00:00
|
|
|
"fr" 'counsel-recentf
|
2016-05-16 02:00:44 +00:00
|
|
|
"rl" 'ivy-resume
|
2016-12-09 03:36:54 +00:00
|
|
|
"bb" 'ivy-switch-buffer))
|
2016-05-18 00:08:08 +00:00
|
|
|
|
2016-12-09 03:36:54 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2016-05-18 00:08:08 +00:00
|
|
|
;; custom actions for recentf
|
|
|
|
(ivy-set-actions
|
2016-08-30 07:04:47 +00:00
|
|
|
'counsel-recentf
|
2016-05-18 00:08:08 +00:00
|
|
|
spacemacs--ivy-file-actions)
|
|
|
|
|
2018-07-13 06:03:40 +00:00
|
|
|
;; add spacemacs/counsel-search command to ivy-highlight-grep-commands
|
|
|
|
(add-to-list 'ivy-highlight-grep-commands 'spacemacs/counsel-search)
|
|
|
|
|
2017-04-11 19:54:54 +00:00
|
|
|
;; mappings to quit minibuffer or enter transient state
|
|
|
|
(define-key ivy-minibuffer-map [escape] 'minibuffer-keyboard-quit)
|
|
|
|
(define-key ivy-minibuffer-map (kbd "M-SPC") 'hydra-ivy/body)
|
|
|
|
|
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
|
2018-06-13 21:14:06 +00:00
|
|
|
(evil-set-initial-state 'ivy-occur-grep-mode 'normal)
|
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
|
2018-07-16 16:42:50 +00:00
|
|
|
"w" 'spacemacs/ivy-wgrep-change-to-wgrep-mode
|
|
|
|
"s" 'wgrep-save-all-buffers)
|
2016-05-16 02:00:44 +00:00
|
|
|
;; Why do we do this ?
|
2017-07-29 17:56:56 +00:00
|
|
|
(ido-mode -1)
|
|
|
|
|
|
|
|
;; allow to select prompt in some ivy functions
|
|
|
|
(setq ivy-use-selectable-prompt t))))
|
2016-01-04 19:17:35 +00:00
|
|
|
|
2016-06-08 07:28:53 +00:00
|
|
|
(defun ivy/init-ivy-hydra ()
|
2018-03-04 04:37:53 +00:00
|
|
|
(use-package ivy-hydra)
|
2017-04-13 09:52:47 +00:00
|
|
|
(define-key hydra-ivy/keymap [escape] 'hydra-ivy/keyboard-escape-quit-and-exit))
|
2016-06-08 07:28:53 +00:00
|
|
|
|
2018-01-07 02:44:58 +00:00
|
|
|
(defun ivy/init-ivy-rich ()
|
|
|
|
(use-package ivy-rich
|
2018-08-29 10:18:44 +00:00
|
|
|
;; if `counsel' loads after `ivy-rich', it overrides some of `ivy-rich''s
|
|
|
|
;; transformers
|
|
|
|
:after counsel
|
2018-01-07 02:44:58 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2018-08-29 10:18:44 +00:00
|
|
|
(setq ivy-rich-path-style 'abbrev
|
|
|
|
ivy-virtual-abbreviate 'full))
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(ivy-rich-mode))))
|
2018-01-07 02:44:58 +00:00
|
|
|
|
|
|
|
(defun ivy/init-ivy-spacemacs-help ()
|
|
|
|
(use-package ivy-spacemacs-help
|
|
|
|
: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)
|
|
|
|
:init (spacemacs/set-leader-keys
|
|
|
|
"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)))
|
|
|
|
|
2018-02-19 03:48:12 +00:00
|
|
|
(defun ivy/init-ivy-xref ()
|
|
|
|
(use-package ivy-xref
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2018-02-19 03:48:12 +00:00
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(setq xref-prompt-for-identifier '(not xref-find-definitions
|
|
|
|
xref-find-definitions-other-window
|
|
|
|
xref-find-definitions-other-frame
|
|
|
|
xref-find-references
|
|
|
|
spacemacs/jump-to-definition))
|
|
|
|
|
|
|
|
;; Use ivy-xref to display `xref.el' results.
|
|
|
|
(setq xref-show-xrefs-function #'ivy-xref-show-xrefs))))
|
|
|
|
|
2018-01-07 02:44:58 +00:00
|
|
|
(defun ivy/post-init-org ()
|
|
|
|
(add-hook 'org-ctrl-c-ctrl-c-hook 'spacemacs//counsel-org-ctrl-c-ctrl-c-org-tag))
|
|
|
|
|
2017-09-26 04:10:00 +00:00
|
|
|
(defun ivy/pre-init-persp-mode ()
|
2017-09-28 13:41:31 +00:00
|
|
|
(spacemacs|use-package-add-hook persp-mode
|
2017-09-26 04:10:00 +00:00
|
|
|
:post-config
|
|
|
|
(setq
|
|
|
|
spacemacs--persp-display-buffers-func 'spacemacs/ivy-spacemacs-layout-buffer
|
|
|
|
spacemacs--persp-display-perspectives-func 'spacemacs/ivy-spacemacs-layouts)))
|
|
|
|
|
2016-06-01 03:39:47 +00:00
|
|
|
(defun ivy/post-init-persp-mode ()
|
2016-10-02 07:29:55 +00:00
|
|
|
;; based on https://gist.github.com/Bad-ptr/1aca1ec54c3bdb2ee80996eb2b68ad2d#file-persp-ivy-el
|
|
|
|
(add-hook 'ivy-ignore-buffers #'spacemacs//layout-not-contains-buffer-p)
|
|
|
|
(setq ivy-sort-functions-alist
|
|
|
|
(append ivy-sort-functions-alist
|
|
|
|
'((persp-kill-buffer . nil)
|
|
|
|
(persp-remove-buffer . nil)
|
|
|
|
(persp-add-buffer . nil)
|
|
|
|
(persp-switch . nil)
|
|
|
|
(persp-window-switch . nil)
|
|
|
|
(persp-frame-switch . nil))))
|
|
|
|
|
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)")
|
spacemacs-layouts: Fix adding buffers to new persp
Delete the hook that commit 9fcf8c898dd1069ef362f1ede320e85065358ac6 added
to persp-created-functions, and change spacemacs/ivy-spacemacs-layouts,
spacemacs/helm-perspectives, spacemacs/helm-persp-switch-project, and
spacemacs/ivy-persp-switch-project to achieve the intended goal of adding
the desired buffers after creating a new perspective.
Change spacemacs/helm-persp-switch-project and
spacemacs/ivy-persp-switch-project as follows: If the user selects a
project but then quits without selecting a file or buffer, the new
perspective is now immediately killed. Otherwise, if the perspective did
not already exist, any buffers that belong to the selected project are
added to the perspective.
Add the following actions to spacemacs/ivy-spacemacs-layouts and
spacemacs/helm-perspectives:
* Create a new perspective with the Spacemacs home buffer (default action).
* Create a new perspective with the buffers that belong to the current
buffer's project.
* Create a new perspective with the buffers that belong to the current
perspective (i.e., make a copy of the current perspective).
This commit resolves the problem reported in
https://github.com/syl20bnr/spacemacs/commit/9fcf8c898dd1069ef362f1ede320e85065358ac6#commitcomment-33343455.
This commit also fixes a problem with the default action for
spacemacs/ivy-spacemacs-layouts and spacemacs/helm-perspectives. According to
commit 7b931a9f5b4f996394e902b254ba85e9fe1b22be, the default action is supposed
to display the home buffer if the action creates a new perspective, which was
determined by checking whether the perspective was missing from the list of
perspectives _before_ switching. However, commit
eb7ca651fe72241a5784c289543f73b6c273faf4 changed this logic so it was checking
whether the perspective was missing from the list of perspectives _after_
switching. This commit restores the correct logic.
* CHANGELOG.develop: Update.
* layers/+completion/ivy/funcs.el (spacemacs/ivy-spacemacs-layouts): Add
"Copy Current Layout" and "Create Project Layout" actions to the docstring.
Use spacemacs//create-persp-with-home-buffer for the default action.
* layers/+completion/ivy/packages.el (ivy/post-init-persp-mode): Add
actions for spacemacs//create-persp-with-current-project-buffers and
persp-copy.
* layers/+spacemacs/spacemacs-layouts/funcs.el
(spacemacs||switch-layout): New macro. Switch to the named perspective,
and initialize it using the provided forms if the perspective is new.
(spacemacs//create-persp-with-current-project-buffers): New function.
Create a new perspective with the current project's buffers.
(spacemacs||switch-project-persp): New macro. Switch to the named
perspective, and evaluate the provided forms with
projectile-after-switch-project-hook bound with a hook that adds the
current project's buffers to the perspective. If the user quits during the
evaluation of the forms, kill the perspective.
(spacemacs//create-persp-with-home-buffer): New function. Switch to the
named perspective, and go to the Spacemacs home buffer if the perspective
is new.
(spacemacs/helm-perspectives): Use spacemacs//create-persp-with-home-buffer
for the default action. Add actions for
spacemacs//create-persp-with-current-project-buffers and persp-copy.
(spacemacs//helm-persp-switch-project-action): New function. Switch to the
named perspective and call projectile-switch-project-by-name, using the new
spacemacs||switch-project-persp macro. Bind helm-quit-hook with a hook
that kills the new perspective if the user quits
projectile-switch-project-by-name.
(spacemacs/helm-persp-switch-project): Use
spacemacs//helm-persp-switch-project-action.
(spacemacs//ivy-persp-switch-project-action): New function. Switch to the
named perspective and call counsel-projectile-switch-project-action with a
hook to add the project's buffers to the new perspective.
(spacemacs/ivy-persp-switch-project): Delete advice for
counsel-projectile-switch-project-action. Use
spacemacs//ivy-persp-switch-project-action instead.
(spacemacs//add-project-buffers-to-persp): Deleted.
* layers/+spacemacs/spacemacs-layouts/packages.el
(spacemacs-layouts/init-persp-mode): Don't add a hook to
persp-created-functions.
2019-05-10 23:48:18 +00:00
|
|
|
("k" persp-kill "Kill layout(s)")
|
|
|
|
("n" persp-copy "Copy Current Layout")
|
|
|
|
("p" spacemacs//create-persp-with-current-project-buffers
|
|
|
|
"Create Project Layout")))
|
2017-09-26 04:10:00 +00:00
|
|
|
;; TODO: better handling of C and X bindings for ivy
|
|
|
|
;; check ivy/pre-init-persp-mode
|
2017-05-23 14:04:40 +00:00
|
|
|
(spacemacs/transient-state-register-remove-bindings 'layouts
|
2017-02-21 10:07:23 +00:00
|
|
|
'("C" "X"))
|
2017-05-23 14:04:40 +00:00
|
|
|
(spacemacs/transient-state-register-add-bindings 'layouts
|
2017-09-26 04:10:00 +00:00
|
|
|
'(("C" spacemacs/ivy-spacemacs-layout-close-other :exit t)
|
2017-02-21 10:07:23 +00:00
|
|
|
("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
|
|
|
|
"pv" 'projectile-vc))
|
|
|
|
|
2016-12-09 03:36:54 +00:00
|
|
|
(defun ivy/post-init-recentf ()
|
|
|
|
;; custom actions for recentf
|
|
|
|
(ivy-set-actions
|
|
|
|
'counsel-recentf
|
|
|
|
(append spacemacs--ivy-file-actions
|
|
|
|
'(("R" (lambda (arg)
|
|
|
|
(interactive)
|
|
|
|
(recentf-cleanup)
|
|
|
|
(ivy-recentf)) "refresh list")
|
|
|
|
("D" (lambda (arg)
|
|
|
|
(interactive)
|
|
|
|
(setq recentf-list (delete arg recentf-list))
|
|
|
|
(ivy-recentf)) "delete from list"))))
|
|
|
|
;; merge recentf and bookmarks into buffer switching. If we set this
|
|
|
|
(setq ivy-use-virtual-buffers t))
|
2016-01-09 20:45:15 +00:00
|
|
|
|
2018-01-07 02:44:58 +00:00
|
|
|
(defun ivy/init-smex ()
|
|
|
|
(use-package smex
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2018-01-07 02:44:58 +00:00
|
|
|
:init (setq-default smex-history-length 32
|
|
|
|
smex-save-file (concat spacemacs-cache-directory
|
|
|
|
".smex-items"))))
|
2018-01-06 16:51:19 +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))
|