Closed farazshaikh closed 1 year ago
Vertico multi form controls the layout vertico contents ie to display content as grid, vs a list. It won't help to position the pos frame.
At a minimum, there should be a way to disable posframe completely for certain command like vertico-line and display content in the mini buffer instead
you can try the below config:
(setq vertico-multiform-commands
'((consult-imenu buffer)
(t posframe)))
(vertico-multiform-mode 1)
(setq vertico-posframe-poshandler
#'my-vertico-posframe-poshandler)
(defun my-vertico-posframe-poshandler (info)
(pcase this-command
(`complete-symbol (posframe-poshandler-frame-top-center info))
(`consult-line (posframe-poshandler-frame-bottom-center info))
(t (posframe-poshandler-frame-center info))))
With the above snippet, the consult-line posframe starts at the bottom center. But, as soon as you type anything, the posframe moves back to the center of the window.
Thanks -Fs
(use-package vertico
:init
(vertico-mode)
(vertico-multiform-mode)
:bind (:map vertico-map
("M-v" . #'vertico-multiform-vertical)
("M-g" . #'vertico-multiform-grid)
("M-f" . #'vertico-multiform-flat)
("M-R" . #'vertico-multiform-reverse)
("M-u" . #'vertico-multiform-unobtrusive))
:config
;; Different scroll margin
;; (setq vertico-scroll-margin 0)
;; Show more candidates
;; (setq vertico-count 20)
;; Grow and shrink the Vertico minibuffer
;; (setq vertico-resize t)
;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
(setq vertico-cycle t))
(use-package vertico-posframe
:disabled
:init
(vertico-posframe-mode)
:config
(setq vertico-posframe-poshandler #'posframe-poshandler-window-bottom-center))
try this:
(setq vertico-multiform-commands
'((consult-imenu buffer)
(t posframe)))
(vertico-multiform-mode 1)
(setq vertico-posframe-poshandler
#'my-vertico-posframe-poshandler)
(defun my-vertico-posframe-poshandler (info)
(cond
((my-cmdp 'complete-symbol) (posframe-poshandler-frame-top-center info))
((my-cmdp `consult-line) (posframe-poshandler-frame-bottom-center info))
((my-cmdp `consult-recent-file) (posframe-poshandler-frame-bottom-center info))
(t (posframe-poshandler-frame-center info))))
(defun my-cmdp (cmd)
(or (equal this-command cmd)
(equal last-command cmd)))
Same behavior, box moves to the center
Update to newest code, and try:
(setq vertico-multiform-commands
'((consult-line posframe (vertico-posframe-poshandler . posframe-poshandler-frame-top-center))
(t buffer)))
Thanks it works, I had to add the posframe position for default case.
(setq vertico-multiform-commands
'((consult-line posframe (vertico-posframe-poshandler . posframe-poshandler-frame-bottom-center))
(consult-buffer posframe (vertico-posframe-poshandler . posframe-poshandler-frame-bottom-center))
(t posframe (vertico-posframe-poshandler . posframe-poshandler-point-bottom-left-corner))))
ok
Ivy posframe position can be customized per command using the following
With the above feature vertico-posframe is very difficult to use, esp for commands like consult-line (swiper-eqivalent). The posframe blocks the search results.
It's ideal to sometimes have the posframe displayed at point, and sometimes at the bottom of the frame.