Skip to content

Commit

Permalink
- Improved abbr.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Apr 21, 2013
1 parent 0e29269 commit 92d50f3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
9 changes: 4 additions & 5 deletions autoload/neocomplcache/complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 19 Apr 2013.
" Last Modified: 21 Apr 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -335,16 +335,15 @@ function! neocomplcache#complete#_get_words(complete_results, cur_keyword_pos, c

if g:neocomplcache_max_keyword_width >= 0 "{{{
" Abbr check.
let abbr_pattern = printf('%%.%ds..%%s',
\ g:neocomplcache_max_keyword_width-15)
for keyword in complete_words
let abbr = get(keyword, 'abbr', keyword.word)
if len(abbr) > g:neocomplcache_max_keyword_width
let len = neocomplcache#util#wcswidth(abbr)

if len > g:neocomplcache_max_keyword_width
let keyword.abbr = neocomplcache#util#truncate(
\ abbr, g:neocomplcache_max_keyword_width - 2) . '..'
let keyword.abbr = neocomplcache#util#truncate_smart(
\ abbr, g:neocomplcache_max_keyword_width,
\ g:neocomplcache_max_keyword_width/2, '..')
endif
endif
endfor
Expand Down
2 changes: 1 addition & 1 deletion doc/neocomplcache.txt
Expand Up @@ -195,7 +195,7 @@ g:neocomplcache_max_keyword_width
displayed in a pop-up menu. The case beyond this value is
cut down properly.

Default value is 50.
Default value is 80.

*g:neocomplcache_max_menu_width*
g:neocomplcache_max_menu_width
Expand Down
4 changes: 2 additions & 2 deletions plugin/neocomplcache.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: neocomplcache.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 16 Apr 2013.
" Last Modified: 21 Apr 2013.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -101,7 +101,7 @@ endfunction"}}}
let g:neocomplcache_max_list =
\ get(g:, 'neocomplcache_max_list', 100)
let g:neocomplcache_max_keyword_width =
\ get(g:, 'neocomplcache_max_keyword_width', 50)
\ get(g:, 'neocomplcache_max_keyword_width', 80)
let g:neocomplcache_max_menu_width =
\ get(g:, 'neocomplcache_max_menu_width', 15)
let g:neocomplcache_auto_completion_start_length =
Expand Down

0 comments on commit 92d50f3

Please sign in to comment.