GithubHelp home page GithubHelp logo

lishi2269 / ivy-posframe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tumashu/ivy-posframe

0.0 0.0 0.0 960 KB

ivy-posframe is a ivy extension, which let ivy use posframe to show its candidate menu.

Emacs Lisp 100.00%

ivy-posframe's Introduction

Note: this file is auto converted from ivy-posframe.el by el2org, please do not edit it by hand!!!

目录

  1. ivy-posframe README
    1. What is ivy-posframe
    2. Display functions
    3. How to enable ivy-posframe
      1. Global mode
      2. Per-command mode.
    4. Tips
      1. How to show fringe to ivy-posframe
      2. How to custom your ivy-posframe style

ivy-posframe README

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.

Display functions

  1. ivy-posframe-display
  2. ivy-posframe-display-at-frame-center
  3. ivy-posframe-display-at-window-center img
  4. ivy-posframe-display-at-frame-bottom-left
  5. ivy-posframe-display-at-window-bottom-left img
  6. ivy-posframe-display-at-frame-bottom-window-center
  7. ivy-posframe-display-at-point img

How to enable ivy-posframe

Global mode

(require 'ivy-posframe)
;; display at `ivy-posframe-style'
(setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display)))
;; (setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display-at-frame-center)))
;; (setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display-at-window-center)))
;; (setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display-at-frame-bottom-left)))
;; (setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display-at-window-bottom-left)))
;; (setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display-at-frame-top-center)))
(ivy-posframe-mode 1)

Per-command mode.

(require 'ivy-posframe)
;; Different command can use different display function.
(setq ivy-posframe-display-functions-alist
      '((swiper          . ivy-posframe-display-at-point)
        (complete-symbol . ivy-posframe-display-at-point)
        (counsel-M-x     . ivy-posframe-display-at-window-bottom-left)
        (t               . ivy-posframe-display)))
(ivy-posframe-mode 1)

You can use ivy original display function on specify function. You may want to use the original display function because display of Swiper at point hides the contents of the buffer.

(require 'ivy-posframe)
;; Different command can use different display function.
(setq ivy-posframe-display-functions-alist
      '((swiper          . nil)
        (complete-symbol . ivy-posframe-display-at-point)
        (counsel-M-x     . ivy-posframe-display-at-window-bottom-left)
        (t               . ivy-posframe-display)))
(ivy-posframe-mode 1)

You may want to change the height of ivy by a function only while using posframe. This is possible with the code below.

The following example displays swiper on 20 lines by default for ivy, and displays other functions in posframe at the location specified on 40 lines.

(require 'ivy-posframe)
;; Different command can use different display function.
(setq ivy-posframe-height-alist '((swiper . 20)
                                  (t      . 40)))

(setq ivy-posframe-display-functions-alist
      '((swiper          . nil)
        (complete-symbol . ivy-posframe-display-at-point)
        (counsel-M-x     . ivy-posframe-display-at-window-bottom-left)
        (t               . ivy-posframe-display)))
(ivy-posframe-mode 1)

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.

Tips

How to show fringe to ivy-posframe

(setq ivy-posframe-parameters
      '((left-fringe . 8)
        (right-fringe . 8)))

By the way, User can set any parameters of ivy-posframe with the help of `ivy-posframe-parameters'.

How to custom your ivy-posframe style

The simplest way is:

(defun ivy-posframe-display-at-XXX (str)
  (ivy-posframe--display str #'your-own-poshandler-function))
(setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display-at-XXX)))
(ivy-posframe-mode 1) ; This line is needed.

ivy-posframe's People

Contributors

tumashu avatar conao3 avatar tttuuu888 avatar noctuid avatar abo-abo avatar celeritascelery avatar drrlvn avatar gagbo avatar ramsayleung avatar xeijin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.