Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Commit 1c5ca92

Browse files
committed
feat: option for sorted completion items alphabetically
1 parent 1c481cf commit 1c5ca92

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

lua/completion/util.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ function M.sort_completion_items(items)
3434
table.sort(items, function(a, b)
3535
if a.priority ~= b.priority and a.priority ~= nil and b.priority ~= nil then
3636
return a.priority > b.priority
37+
elseif vim.g.completion_sorted_alphabetically then
38+
return a.word < b.word
3739
elseif a.score ~= b.score and a.score ~= nil and b.score ~= nil then
3840
return a.score < b.score
3941
else

plugin/completion.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ if !exists('g:completion_timer_cycle')
6565
let g:completion_timer_cycle = 80
6666
endif
6767

68+
if ! exists('g:completion_sorted_alphabetically')
69+
let g:completion_sorted_alphabetically = v:false
70+
endif
71+
6872
if ! exists('g:completion_max_items')
6973
let g:completion_max_items = v:null
7074
endif

0 commit comments

Comments
 (0)