Permalink
Browse files

- Fixed omni_complete sort.

  • Loading branch information...
1 parent 81e8414 commit f20c3241b40d51fe92f861f6b4e5953f6b495d4d @Shougo committed May 23, 2012
Showing with 16 additions and 5 deletions.
  1. +13 −4 autoload/neocomplcache.vim
  2. +2 −1 autoload/neocomplcache/sources/omni_complete.vim
  3. +1 −0 doc/neocomplcache.txt
View
@@ -797,7 +797,8 @@ function! neocomplcache#available_plugins()"{{{
endfunction"}}}
function! neocomplcache#available_sources()"{{{
call s:set_context_filetype()
- return extend(extend(copy(s:complfunc_sources), s:plugin_sources), s:loaded_ftplugin_sources)
+ return extend(extend(copy(s:complfunc_sources), s:plugin_sources),
+ \ s:loaded_ftplugin_sources)
endfunction"}}}
function! neocomplcache#keyword_escape(cur_keyword_str)"{{{
" Escape."{{{
@@ -1043,6 +1044,10 @@ function! s:compare_source_rank(i1, i2)
return neocomplcache#get_source_rank(a:i2[0]) -
\ neocomplcache#get_source_rank(a:i1[0])
endfunction"}}}
+" Nothing order."{{{
+function! neocomplcache#compare_nothing(i1, i2)
+ return 0
+endfunction"}}}
function! neocomplcache#rand(max)"{{{
if !has('reltime')
@@ -1380,6 +1385,8 @@ function! neocomplcache#get_complete_words(complete_results,
let frequencies = neocomplcache#is_source_enabled('buffer_complete') ?
\ neocomplcache#sources#buffer_complete#get_frequencies() : {}
+ let sources = neocomplcache#available_sources()
+
" Append prefix.
let complete_words = []
let len_words = 0
@@ -1400,8 +1407,10 @@ function! neocomplcache#get_complete_words(complete_results,
let keyword.rank = frequencies[keyword.word]
endfor
- if !neocomplcache#is_eskk_enabled()
- call sort(result.complete_words, g:neocomplcache_compare_function)
+ let compare_func = get(sources[source_name], 'compare_func',
+ \ g:neocomplcache_compare_function)
+ if compare_func !=# 'neocomplcache#compare_nothing'
+ call sort(result.complete_words, compare_func)
endif
let complete_words += s:remove_next_keyword(
@@ -1418,7 +1427,7 @@ function! neocomplcache#get_complete_words(complete_results,
return []
endif
- if g:neocomplcache_max_list >= 0
+ if g:neocomplcache_max_list > 0
let complete_words = complete_words[: g:neocomplcache_max_list]
endif
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: omni_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 22 May 2012.
+" Last Modified: 23 May 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -30,6 +30,7 @@ set cpo&vim
let s:source = {
\ 'name' : 'omni_complete',
\ 'kind' : 'complfunc',
+ \ 'compare_func' : 'neocomplcache#compare_nothing',
\}
function! s:source.initialize()"{{{
View
@@ -976,6 +976,7 @@ CHANGELOG *neocomplcache-changelog*
2012-05-23
- Improved sort behavior.
+- Fixed omni_complete sort.
2012-05-22
- Added word order function.

0 comments on commit f20c324

Please sign in to comment.