branch: externals/ivy-posframe commit aec9d8a616edeb886532aaf604cae522724f8ef5 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
Update ivy-posframe README --- README.md | 110 ++++++++++++++++++++++++++++++++++---------------------- ivy-posframe.el | 71 ++++++++++++++++++++---------------- 2 files changed, 108 insertions(+), 73 deletions(-) diff --git a/README.md b/README.md index 8d2fc87..b76e6cb 100644 --- a/README.md +++ b/README.md @@ -3,32 +3,34 @@ Note: this file is auto converted from ivy-posframe.el by [el2org](https://githu # 目录 -1. [ivy-posframe README](#orga0194dc) - 1. [What is ivy-posframe](#org9479e4f) - 2. [Display functions](#org77c90ff) - 3. [How to enable ivy-posframe](#orgbdb78e5) - 4. [Tips](#orgd370bc2) - 1. [How to show fringe to ivy-posframe](#orgdefc2c7) - 2. [How to custom your ivy-posframe style](#org34f3a1d) +1. [ivy-posframe README](#org05902f8) + 1. [What is ivy-posframe ivy-posframe is a ivy extension, which let](#orgb43a11b) + 2. [Display functions](#orgc79cbd1) + 3. [How to enable ivy-posframe](#org15b17c3) + 1. [Global mode](#orgcb1ad0f) + 2. [Per-command mode.](#org4aa4955) + 3. [Fallback mode](#org41b338c) + 4. [Tips](#orgba0f166) + 1. [How to show fringe to ivy-posframe](#orgc6476d8) + 2. [How to custom your ivy-posframe style](#org5b91664) -<a id="orga0194dc"></a> +<a id="org05902f8"></a> # ivy-posframe README -<a id="org9479e4f"></a> +<a id="orgb43a11b"></a> -## What is ivy-posframe +## What is ivy-posframe ivy-posframe is a ivy extension, which let -ivy-posframe is a ivy extension, which let ivy use posframe -to show its candidate menu. +ivy use posframe to show its candidate menu. -NOTE: ivy-posframe requires Emacs 26 and do not support -mouse click. +NOTE: ivy-posframe requires Emacs 26 and do not support mouse +click. -<a id="org77c90ff"></a> +<a id="orgc79cbd1"></a> ## Display functions @@ -44,40 +46,62 @@ mouse click.  -<a id="orgbdb78e5"></a> +<a id="org15b17c3"></a> ## How to enable ivy-posframe -1. Global mode - - (require 'ivy-posframe) - (setq ivy-display-function #'ivy-posframe-display) - ;; (setq ivy-display-function #'ivy-posframe-display-at-frame-center) - ;; (setq ivy-display-function #'ivy-posframe-display-at-window-center) - ;; (setq ivy-display-function #'ivy-posframe-display-at-frame-bottom-left) - ;; (setq ivy-display-function #'ivy-posframe-display-at-window-bottom-left) - ;; (setq ivy-display-function #'ivy-posframe-display-at-point) - (ivy-posframe-enable) -2. Per-command mode. - - (require 'ivy-posframe) - ;; Different command can use different display function. - (push '(counsel-M-x . ivy-posframe-display-at-window-bottom-left) ivy-display-functions-alist) - (push '(complete-symbol . ivy-posframe-display-at-point) ivy-display-functions-alist) - (ivy-posframe-enable) -3. Fallback mode - - (require 'ivy-posframe) - (push '(t . ivy-posframe-display) ivy-display-functions-alist) - (ivy-posframe-enable) - - -<a id="orgd370bc2"></a> + +<a id="orgcb1ad0f"></a> + +### Global mode + + (require 'ivy-posframe) + (setq ivy-display-function #'ivy-posframe-display) + (setq ivy-display-function #'ivy-posframe-display-at-frame-center) + (setq ivy-display-function #'ivy-posframe-display-at-window-center) + (setq ivy-display-function #'ivy-posframe-display-at-frame-bottom-left) + (setq ivy-display-function #'ivy-posframe-display-at-window-bottom-left) + (setq ivy-display-function #'ivy-posframe-display-at-point) + (ivy-posframe-enable) + + +<a id="org4aa4955"></a> + +### Per-command mode. + + (require 'ivy-posframe) + Different command can use different display function. + (push '(counsel-M-x . ivy-posframe-display-at-window-bottom-left) ivy-display-functions-alist) + (push '(complete-symbol . ivy-posframe-display-at-point) ivy-display-functions-alist) + (push '(swiper . ivy-posframe-display-at-point) ivy-display-functions-alist) + (ivy-posframe-enable) + +NOTE: Using swiper as example: swiper's display function **only** +take effect when you call swiper command with global keybinding, if +you call swiper command with 'M-x' (for example: counsel-M-x), +counsel-M-x's display function will take effect instead of +swiper's. + +The value of variable \`this-command' will be used as the search key +by ivy to find display function in \`ivy-display-functions-alist', +"C-h v this-command" is a good idea. + + +<a id="org41b338c"></a> + +### Fallback mode + + (require 'ivy-posframe) + (push '(t . ivy-posframe-display) ivy-display-functions-alist) + (ivy-posframe-enable) + + +<a id="orgba0f166"></a> ## Tips -<a id="orgdefc2c7"></a> +<a id="orgc6476d8"></a> ### How to show fringe to ivy-posframe @@ -89,7 +113,7 @@ By the way, User can set **any** parameters of ivy-posframe with the help of \`ivy-posframe-parameters'. -<a id="org34f3a1d"></a> +<a id="org5b91664"></a> ### How to custom your ivy-posframe style diff --git a/ivy-posframe.el b/ivy-posframe.el index 0a323d1..4f4bf3f 100644 --- a/ivy-posframe.el +++ b/ivy-posframe.el @@ -29,12 +29,11 @@ ;;; Commentary: ;; * ivy-posframe README :README: -;; ** What is ivy-posframe -;; ivy-posframe is a ivy extension, which let ivy use posframe -;; to show its candidate menu. +;; ** What is ivy-posframe ivy-posframe is a ivy extension, which let +;; ivy use posframe to show its candidate menu. -;; NOTE: ivy-posframe requires Emacs 26 and do not support -;; mouse click. +;; NOTE: ivy-posframe requires Emacs 26 and do not support mouse +;; click. ;; ** Display functions @@ -50,31 +49,43 @@ ;; [[./snapshots/ivy-posframe-display-at-point.gif]] ;; ** How to enable ivy-posframe -;; 1. Global mode -;; #+BEGIN_EXAMPLE -;; (require 'ivy-posframe) -;; (setq ivy-display-function #'ivy-posframe-display) -;; ;; (setq ivy-display-function #'ivy-posframe-display-at-frame-center) -;; ;; (setq ivy-display-function #'ivy-posframe-display-at-window-center) -;; ;; (setq ivy-display-function #'ivy-posframe-display-at-frame-bottom-left) -;; ;; (setq ivy-display-function #'ivy-posframe-display-at-window-bottom-left) -;; ;; (setq ivy-display-function #'ivy-posframe-display-at-point) -;; (ivy-posframe-enable) -;; #+END_EXAMPLE -;; 2. Per-command mode. -;; #+BEGIN_EXAMPLE -;; (require 'ivy-posframe) -;; ;; Different command can use different display function. -;; (push '(counsel-M-x . ivy-posframe-display-at-window-bottom-left) ivy-display-functions-alist) -;; (push '(complete-symbol . ivy-posframe-display-at-point) ivy-display-functions-alist) -;; (ivy-posframe-enable) -;; #+END_EXAMPLE -;; 3. Fallback mode -;; #+BEGIN_EXAMPLE -;; (require 'ivy-posframe) -;; (push '(t . ivy-posframe-display) ivy-display-functions-alist) -;; (ivy-posframe-enable) -;; #+END_EXAMPLE +;; *** Global mode +;; #+BEGIN_EXAMPLE +;; (require 'ivy-posframe) +;; (setq ivy-display-function #'ivy-posframe-display) +;; ;; (setq ivy-display-function #'ivy-posframe-display-at-frame-center) +;; ;; (setq ivy-display-function #'ivy-posframe-display-at-window-center) +;; ;; (setq ivy-display-function #'ivy-posframe-display-at-frame-bottom-left) +;; ;; (setq ivy-display-function #'ivy-posframe-display-at-window-bottom-left) +;; ;; (setq ivy-display-function #'ivy-posframe-display-at-point) +;; (ivy-posframe-enable) +;; #+END_EXAMPLE +;; *** Per-command mode. +;; #+BEGIN_EXAMPLE +;; (require 'ivy-posframe) +;; ;; Different command can use different display function. +;; (push '(counsel-M-x . ivy-posframe-display-at-window-bottom-left) ivy-display-functions-alist) +;; (push '(complete-symbol . ivy-posframe-display-at-point) ivy-display-functions-alist) +;; (push '(swiper . ivy-posframe-display-at-point) ivy-display-functions-alist) +;; (ivy-posframe-enable) +;; #+END_EXAMPLE +;; +;; NOTE: Using swiper as example: swiper's display function *only* +;; take effect when you call swiper command with global keybinding, if +;; you call swiper command with 'M-x' (for example: counsel-M-x), +;; counsel-M-x's display function will take effect instead of +;; swiper's. + +;; The value of variable `this-command' will be used as the search key +;; by ivy to find display function in `ivy-display-functions-alist', +;; "C-h v this-command" is a good idea. + +;; *** Fallback mode +;; #+BEGIN_EXAMPLE +;; (require 'ivy-posframe) +;; (push '(t . ivy-posframe-display) ivy-display-functions-alist) +;; (ivy-posframe-enable) +;; #+END_EXAMPLE ;; ** Tips