- Timestamp:
- 06/16/09 12:57:15 (4 years ago)
- Location:
- dotfiles/vim/from_kyushu/.vim
- Files:
-
- 4 modified
-
autoload/neocomplcache.vim (modified) (9 diffs)
-
autoload/neocomplcache/keyword_complete.vim (modified) (15 diffs)
-
autoload/neocomplcache/snippets_complete/c.snip (modified) (1 diff)
-
plugin/neocomplcache.vim (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dotfiles/vim/from_kyushu/.vim/autoload/neocomplcache.vim
r33998 r34002 2 2 " FILE: neocomplcache.vim 3 3 " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> 4 " Last Modified: 02Jun 20094 " Last Modified: 14 Jun 2009 5 5 " Usage: Just source this file. 6 6 " License: MIT license {{{ … … 24 24 " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 25 " }}} 26 " Version: 2. 58, for Vim 7.026 " Version: 2.60, for Vim 7.0 27 27 "============================================================================= 28 28 … … 631 631 " Sort. 632 632 call extend(l:cache_keyword_filtered, sort( 633 \filter(copy(l:cache_keyword_list), 'v:val.prev_rank > 0 '), 'neocomplcache#compare_prev_rank'))633 \filter(copy(l:cache_keyword_list), 'v:val.prev_rank > 0 || v:val.prepre_rank > 0'), 'neocomplcache#compare_prev_rank')) 634 634 call filter(l:cache_keyword_lists[l:plugin], 'v:val.prev_rank == 0 && v:val.prepre_rank == 0') 635 635 endfor … … 641 641 call extend(l:cache_keyword_list, l:cache_keyword_lists[l:plugin]) 642 642 endfor 643 644 " Filtering for optimize."{{{645 if !g:NeoComplCache_AlphabeticalOrder646 if len(l:cache_keyword_list) > g:NeoComplCache_MaxList * 10647 call filter(l:cache_keyword_list, 'v:val.rank > 2')648 elseif len(l:cache_keyword_list) > g:NeoComplCache_MaxList * 5649 call filter(l:cache_keyword_list, 'v:val.rank > 1')650 elseif len(l:cache_keyword_list) > g:NeoComplCache_MaxList * 3651 call filter(l:cache_keyword_list, 'v:val.rank > 0')652 endif653 endif"}}}654 643 655 644 " Sort. … … 750 739 endif 751 740 752 let l:max_len = -1753 741 let l:num = 0 754 742 let l:list = [] 755 743 for word in split(glob(l:cur_keyword_str . '*'), '\n') 756 if len(word) > l:max_len757 let l:max_len = len(word)758 endif759 744 call add(list, { 'word' : word, 'menu' : '[F]', 'icase' : 1 }) 760 745 let l:num += 1 … … 767 752 endif 768 753 let l:len_prefix = len(l:prefix) 769 if l:max_len > g:NeoComplCache_MaxKeywordWidth 770 let l:prefix = '...' . l:prefix[l:max_len-g:NeoComplCache_MaxKeywordWidth+3 : ] 771 endif 772 754 755 let l:abbr_pattern = printf('%%.%ds..%%s', g:NeoComplCache_MaxKeywordWidth-10) 773 756 if g:NeoComplCache_EnableQuickMatch"{{{ 774 757 let l:save_list = l:list … … 802 785 for keyword in l:save_list[:g:NeoComplCache_QuickMatchMaxLists] 803 786 let l:abbr = keyword.word[l:len_prefix :] 787 if len(l:abbr) > g:NeoComplCache_MaxKeywordWidth 788 let l:pre = '...' . l:prefix[len(l:abbr)-g:NeoComplCache_MaxKeywordWidth+3 : ] 789 let l:abbr = printf(l:abbr_pattern, l:abbr, l:abbr[-8:]) 790 else 791 let l:pre = l:prefix 792 endif 804 793 if isdirectory(keyword.word) 805 794 let l:abbr .= '/' 806 795 endif 807 let keyword.abbr = printf('%2d: %s%s', l:num, l:prefix, l:abbr) 796 797 let keyword.abbr = printf('%2d: %s%s', l:num, l:pre, l:abbr) 808 798 let l:num += 1 809 799 … … 813 803 for keyword in l:cache_keyword_filtered 814 804 let l:abbr = keyword.word[l:len_prefix :] 805 if len(l:abbr) > g:NeoComplCache_MaxKeywordWidth 806 let l:pre = '...' . l:prefix[len(l:abbr)-g:NeoComplCache_MaxKeywordWidth+3 : ] 807 let l:abbr = printf(l:abbr_pattern, l:abbr, l:abbr[-8:]) 808 else 809 let l:pre = l:prefix 810 endif 815 811 if isdirectory(keyword.word) 816 812 let l:abbr .= '/' 817 813 endif 818 let keyword.abbr = ' ' . l:abbr 814 815 let keyword.abbr = printf(' %s%s', l:pre, l:abbr) 819 816 call add(l:list, keyword) 820 817 endfor"}}} … … 827 824 for keyword in l:list 828 825 let l:abbr = keyword.word[l:len_prefix :] 826 if len(l:abbr) > g:NeoComplCache_MaxKeywordWidth 827 let l:pre = '...' . l:prefix[len(l:abbr)-g:NeoComplCache_MaxKeywordWidth+3 : ] 828 let l:abbr = printf(l:abbr_pattern, l:abbr, l:abbr[-8:]) 829 else 830 let l:pre = l:prefix 831 endif 829 832 if isdirectory(keyword.word) 830 833 let l:abbr .= '/' 831 834 endif 832 let keyword.abbr = l:prefix . l:abbr 835 836 let keyword.abbr = l:pre . l:abbr 833 837 endfor 834 838 endif -
dotfiles/vim/from_kyushu/.vim/autoload/neocomplcache/keyword_complete.vim
r33998 r34002 2 2 " FILE: keyword_complete.vim 3 3 " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> 4 " Last Modified: 0 2Jun 20094 " Last Modified: 04 Jun 2009 5 5 " Usage: Just source this file. 6 6 " License: MIT license {{{ … … 24 24 " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 25 " }}} 26 " Version: 2.5 8, for Vim 7.026 " Version: 2.59, for Vim 7.0 27 27 "============================================================================= 28 28 … … 33 33 augroup neocomplcache"{{{ 34 34 " Caching events 35 autocmd File type * call s:check_source()35 autocmd FileType * call s:check_source() 36 36 autocmd BufWritePost,CursorHold * call s:update_source() 37 37 " Caching current buffer events 38 autocmd Insert Leave * call s:caching_insert_leave()38 autocmd InsertEnter * call s:caching_insert_enter() 39 39 " Garbage collect. 40 40 autocmd BufWritePost * call s:garbage_collect_keyword() … … 396 396 endfunction"}}} 397 397 398 function! s:caching(srcname, start_line, end_cache_cnt , add_rank)"{{{398 function! s:caching(srcname, start_line, end_cache_cnt)"{{{ 399 399 " Check exists s:sources. 400 400 if !has_key(s:sources, a:srcname) … … 454 454 if len(l:match_str) >= g:NeoComplCache_MinKeywordLength 455 455 if !has_key(l:rank_cache_line, l:match_str) 456 let l:rank_cache_line[l:match_str] = { 'rank' : a:add_rank, 'prev_rank' : {}, 'prepre_rank' : {} }456 let l:rank_cache_line[l:match_str] = { 'rank' : 1, 'prev_rank' : {}, 'prepre_rank' : {} } 457 457 let l:match_cache_line = l:rank_cache_line[l:match_str] 458 458 … … 472 472 else 473 473 let l:match_cache_line = l:rank_cache_line[l:match_str] 474 let l:match_cache_line.rank += a:add_rank474 let l:match_cache_line.rank += 1 475 475 endif 476 476 … … 485 485 486 486 if has_key(l:match_cache_line.prepre_rank, l:prepre_word) 487 let l:match_cache_line.prepre_rank[l:prepre_word] += a:add_rank487 let l:match_cache_line.prepre_rank[l:prepre_word] += 1 488 488 else 489 let l:match_cache_line.prepre_rank[l:prepre_word] = a:add_rank489 let l:match_cache_line.prepre_rank[l:prepre_word] = 1 490 490 endif 491 491 endif … … 499 499 500 500 if has_key(l:match_cache_line.prev_rank, l:prev_word) 501 let l:match_cache_line.prev_rank[l:prev_word] += a:add_rank501 let l:match_cache_line.prev_rank[l:prev_word] += 1 502 502 else 503 let l:match_cache_line.prev_rank[l:prev_word] = a:add_rank503 let l:match_cache_line.prev_rank[l:prev_word] = 1 504 504 endif 505 505 … … 704 704 endfunction"}}} 705 705 706 function! s:word_caching_current_line()"{{{ 707 let l:source = s:sources[bufnr('%')] 708 709 " Buffer. 710 let l:filename = '[B] ' . fnamemodify(l:source.name, ':t') 711 712 let l:menu = printf('%.' . g:NeoComplCache_MaxFilenameWidth . 's', l:filename) 713 let l:abbr_pattern = printf('%%.%ds..%%s', g:NeoComplCache_MaxKeywordWidth-10) 714 let l:keyword_pattern = l:source.keyword_pattern 715 716 " Buffer. 717 let l:start_line = (line('.')-1)/l:source.cache_line_cnt*l:source.cache_line_cnt+1 718 let l:end_line = l:start_line + l:source.cache_line_cnt 719 let l:buflines = join(getbufline(bufnr('%'), l:start_line, l:end_line), "\<CR>") 720 721 let l:match = match(l:buflines, l:keyword_pattern) 722 let l:match_num = 0 723 while l:match >= 0 724 let l:match_str = matchstr(l:buflines, l:keyword_pattern, l:match) 725 " Ignore too short keyword. 726 if len(l:match_str) >= g:NeoComplCache_MinKeywordLength 727 \&& !has_key(l:source.keyword_cache, l:match_str) 728 " Append list. 729 let l:source.keyword_cache[l:match_str] = { 730 \'word' : l:match_str, 'menu' : l:menu, 731 \'filename' : l:filename, 'srcname' : bufnr('%'), 'icase' : 1, 732 \'user_rank' : 0, 'rank' : 1 733 \} 734 735 let l:source.keyword_cache[l:match_str].abbr = 736 \ (len(l:match_str) > g:NeoComplCache_MaxKeywordWidth)? 737 \ printf(l:abbr_pattern, l:match_str, l:match_str[-8:]) : l:match_str 738 endif 739 740 let l:match_num += len(l:match_str) 741 let l:match = match(l:buflines, l:keyword_pattern, l:match_num) 742 endwhile 743 endfunction"}}} 744 706 745 function! s:caching_from_cache(srcname)"{{{ 707 746 if a:srcname =~ '^\d' … … 801 840 let l:keyword_pattern = l:source.keyword_pattern 802 841 803 let l:match _str = matchstr(l:buflines, l:keyword_pattern)842 let l:match = match(l:buflines, l:keyword_pattern) 804 843 let l:match_num = 0 805 while l:match_str != '' 844 while l:match >= 0 845 let l:match_str = matchstr(l:buflines, l:keyword_pattern, l:match_num) 806 846 if has_key(s:candidates, l:match_str) 807 847 " Remove from candidate. … … 814 854 815 855 let l:match_num += len(l:match_str) 816 let l:match _str = matchstr(l:buflines, l:keyword_pattern, l:match_num)856 let l:match = match(l:buflines, l:keyword_pattern, l:match_num) 817 857 endwhile 818 858 … … 858 898 endif 859 899 860 call s:caching(a:srcname, l:start_line, a:end_cache_cnt , 1)900 call s:caching(a:srcname, l:start_line, a:end_cache_cnt) 861 901 862 902 return 0 … … 912 952 endfunction"}}} 913 953 914 function! s:caching_insert_ leave()"{{{954 function! s:caching_insert_enter()"{{{ 915 955 if !has_key(s:sources, bufnr('%')) || has_key(s:caching_disable_list, bufnr('%')) || @. == '' 916 956 return … … 919 959 if s:prev_cached_count <= 0 920 960 " Full caching. 921 call s:caching(bufnr('%'), line('.'), 1 , 2)961 call s:caching(bufnr('%'), line('.'), 1) 922 962 if g:NeoComplCache_CachingRandomize 923 let l:match_end = matchend(reltimestr(reltime()), '\d\+\.') + 1963 let l:match_end = matchend(reltimestr(reltime()), '\d\+\.') 924 964 let s:prev_cached_count = reltimestr(reltime())[l:match_end : ] % 3 925 965 else … … 927 967 endif 928 968 else 969 " Word caching. 970 call s:word_caching_current_line() 971 929 972 let s:prev_cached_count -= 1 930 973 endif -
dotfiles/vim/from_kyushu/.vim/autoload/neocomplcache/snippets_complete/c.snip
r33998 r34002 117 117 printf("${1}\n"${2});${3} 118 118 119 snippet fpr 119 snippet fprintf 120 120 fprintf(${1:stderr}, "${2}\n"${3});${4} 121 122 snippet comment 123 /* ${1:comment} */ 124 ${2} 125 -
dotfiles/vim/from_kyushu/.vim/plugin/neocomplcache.vim
r33998 r34002 2 2 " FILE: neocomplcache.vim 3 3 " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> 4 " Last Modified: 02Jun 20094 " Last Modified: 14 Jun 2009 5 5 " Usage: Just source this file. 6 6 " License: MIT license {{{ … … 24 24 " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 25 " }}} 26 " Version: 2. 58, for Vim 7.026 " Version: 2.60, for Vim 7.0 27 27 "----------------------------------------------------------------------------- 28 28 " ChangeLog: "{{{ 29 29 " ChangeLog NeoComplCache2: "{{{ 30 " 2.60: Improved filename completion. 31 " - Improved long filename view. 32 " - Improved filtering. 33 " - Fixed keyword sort bug. 34 " 35 " 2.59: Fixed caching bug. 36 " 30 37 " 2.58: Improved caching timing. 31 38 " - Optimized caching.
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)