Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hook for company-show-location #951

Open
joca-bt opened this issue Feb 15, 2020 · 2 comments
Open

Hook for company-show-location #951

joca-bt opened this issue Feb 15, 2020 · 2 comments
Labels

Comments

@joca-bt
Copy link

joca-bt commented Feb 15, 2020

I have company-show-location binded so that I can show the definitions while completing ((define-key company-active-map (kbd "M-.") #'company-show-location)). However, I'd like to recenter the buffer where the definition is being shown. Is there a hook for this already?

@dgutov
Copy link
Member

dgutov commented May 2, 2021

Perhaps this will work for you?

  1. Add recenter-other-window to company--electric-commands.
  2. After the location is shown (with C-w by default), you can recenter its window with C-M-S-l (the default binding for recenter-other-window).

Alternatively, you can use advice

(defun my/recenter-other-window (&rest _args)
  (recenter-other-window '(4)))

(advice-add 'company-show-location :after #'my/recenter-other-window)

@joca-bt
Copy link
Author

joca-bt commented May 3, 2021

Yeah, it's more-or-less what I ended up doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants