[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kind-icon f5740f0cc9 1/2: README: mention company confi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/kind-icon f5740f0cc9 1/2: README: mention company configuration |
Date: |
Tue, 16 Jul 2024 12:58:35 -0400 (EDT) |
branch: externals/kind-icon
commit f5740f0cc93a21bd9b98de7578030ed699ffb2e1
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
README: mention company configuration
---
README.md | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/README.md b/README.md
index b94065ee00..227f19333d 100644
--- a/README.md
+++ b/README.md
@@ -63,6 +63,19 @@ The more generic approach of wrapping the
`completion-in-region-function` would
for whichever `completion-ui` you are using. Note that for this method to
work, your completion UI must support the Emacs 28 `affixation-function`
property.
+### Using with company
+
+[Company](https://github.com/company-mode/company-mode) has its own distinct
margin formatter system, but `kind-icon` can easily be adapted to it as follows:
+
+```elisp
+(defvar my-company-kind-icon-formatter
+ (let ((kind-func (lambda (cand) (company-call-backend 'kind cand))))
+ (kind-icon-margin-formatter `((company-kind . ,kind-func)))))
+(defun my-company-kind-icon-margin (cand _selected)
+ (funcall my-company-kind-icon-formatter cand))
+(setq company-format-margin-function #'my-company-kind-icon-margin)
+```
+
## Configuration
The configuration defaults should work fine, but `kind-icon` can be customized
to change the icons and colors, preference of icons vs. short-text (or mixed)
prefixes, and more. See [the wiki](https://github.com/jdtsmith/kind-icon/wiki)
for configuration ideas including alternative icon sets.