Skip to content
This repository was archived by the owner on Jan 27, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ let g:compe.max_abbr_width = 100
let g:compe.max_kind_width = 100
let g:compe.max_menu_width = 100
let g:compe.documentation = v:true
let g:compe.kind_mapping = {"Function" = ""; "Interface" = "擄";};


let g:compe.source = {}
let g:compe.source.path = v:true
Expand Down Expand Up @@ -127,6 +129,7 @@ require'compe'.setup {
max_kind_width = 100;
max_menu_width = 100;
documentation = true;
kind_mapping = {["Function"] = ""; ["Interface"] = "擄";};

source = {
path = true;
Expand Down Expand Up @@ -208,7 +211,6 @@ inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
- [conjure](https://github.com/tami5/compe-conjure)
- [dadbod](https://github.com/kristijanhusak/vim-dadbod-completion)


## FAQ

### How to use LSP snippet?
Expand Down
6 changes: 6 additions & 0 deletions doc/compe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ documentation ~
Type: |Boolean|
Default: true

kind_mapping ~
Lsp kind string mapping. .e.g LSP kind "Function" can be mapped to
"" by define {"Function" = ""}
Type: Dictionary
Default: empty

source ~
Source configuration. Required.
Type: |Dictionary| of:
Expand Down
2 changes: 1 addition & 1 deletion lua/compe/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ Completion._display = guard(function(context)
item.kind = item.original_kind or ''
item.menu = item.original_menu or ''

item.kind = Config.get().kind_mapping[item.kind] or item.kind
-- trim to specified width.
item.abbr = String.trim(item.abbr, Config.get().max_abbr_width)
item.kind = String.trim(item.kind, Config.get().max_kind_width)
Expand Down Expand Up @@ -307,4 +308,3 @@ Completion._get_start_offset = function(context)
end

return Completion

2 changes: 1 addition & 1 deletion lua/compe/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Config._normalize = function(config)
config.source_timeout = config.source_timeout or SOURCE_TIMEOUT
config.incomplete_delay = config.incomplete_delay or INCOMPLETE_DELAY
config.allow_prefix_unmatch = Boolean.get(config.allow_prefix_unmatch, false)
config.kind_mapping = config.kind_mapping or {}
config.max_abbr_width = config.max_abbr_width or 100
config.max_kind_width = config.max_kind_width or 100
config.max_menu_width = config.max_menu_width or 100
Expand All @@ -78,4 +79,3 @@ Config._normalize = function(config)
end

return Config