Skip to content

Commit

Permalink
neocomplete plugin updated
Browse files Browse the repository at this point in the history
  • Loading branch information
farazdagi committed Aug 27, 2015
1 parent be637b5 commit ed0c58a
Show file tree
Hide file tree
Showing 39 changed files with 1,009 additions and 3,447 deletions.
27 changes: 27 additions & 0 deletions bundle/pristine/neocomplete.vim/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Problems summary

## Expected

## Environment Information
* OS:
* Vim version:

## Minimal vimrc less than 50 lines

" Your vimrc
set nocompatible

set runtimepath+=~/path/to/neocomplete.vim/

set fo+=aw
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_auto_select = 0
set tw=10 " just for testing purposes

## Reproducable ways from Vim starting

1.
2.
3.

## Screen shot (if possible)
24 changes: 12 additions & 12 deletions bundle/pristine/neocomplete.vim/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
neocomplete
===========
[![Stories in Ready](http://badge.waffle.io/Shougo/neocomplete.vim.png)](http://waffle.io/Shougo/neocomplete.vim)
[![Stories in Ready](http://badge.waffle.io/Shougo/neocomplete.vim.png)](http://waffle.io/Shougo/neocomplete.vim)

neocomplete is the abbreviation of "neo-completion with cache". It
provides keyword completion system by maintaining a cache of keywords in the
current buffer. neocomplete can be customized easily and has many more
features than Vim's built-in completion.
neocomplete is the abbreviation of "neo-completion with cache". It provides
keyword completion system by maintaining a cache of keywords in the current
buffer. neocomplete can be customized easily and has many more features than
Vim's built-in completion.

## Installation

**Note:** neocomplete requires Vim 7.3.885+ with Lua enabled.
**Note:** neocomplete requires Vim 7.3.885+ with Lua enabled.
See [requirements](#requirements) if you aren't sure whether you have this.

1. Extract the files and put them in your Vim directory
Expand All @@ -29,7 +29,7 @@ If `:echo has("lua")` returns `1`, then you're done; otherwise, see below.
* [Vim 32bit alternative](http://tuxproject.de/projects/vim/)
* [Another alternative](http://wyw.dcweb.cn/#download)

**Note:** the Vim build may not include the Lua DLL. In that case,
**Note:** the Vim build may not include the Lua DLL. In that case,
[download Lua](http://lua-users.org/wiki/LuaBinaries) and put the `lua52.dll`
file in the same directory as `gvim.exe`.

Expand All @@ -47,7 +47,7 @@ To install Vim (as opposed to MacVim) with homebrew:

### Vim for Linux:

#### Debian (or Ubuntu)
#### Debian (or Ubuntu)

Make sure you have any of these packages:
* vim-nox
Expand All @@ -57,10 +57,10 @@ Make sure you have any of these packages:

Which package depends on your graphical environment (except vim-nox which is for vim with no GUI).

#### Fedora
#### Fedora

The latest version of vim includes lua.
As of 2014-04-16 you need to (download the rpm)[http://koji.fedoraproject.org/koji/packageinfo?packageID=216].
As of 2014-04-16 you need to [download the rpm](http://koji.fedoraproject.org/koji/packageinfo?packageID=216).

#### Misc

Expand Down Expand Up @@ -89,10 +89,10 @@ To check if everything was successfull enter the following `vim --version`. You

## Snippets

The Snippets feature of neocomplete was split into a
The Snippets feature of neocomplete was split into a
[separate plugin](https://github.com/Shougo/neosnippet).

A migration guide for existing users of neocomplcache is available:
A migration guide for existing users of neocomplcache is available:
[Migration guide](https://github.com/Shougo/neocomplete.vim/wiki/neocomplete-migration-guide)


Expand Down
20 changes: 13 additions & 7 deletions bundle/pristine/neocomplete.vim/autoload/neocomplete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ let g:neocomplete#enable_auto_delimiter =
\ get(g:, 'neocomplete#enable_auto_delimiter', 0)
let g:neocomplete#lock_buffer_name_pattern =
\ get(g:, 'neocomplete#lock_buffer_name_pattern', '')
let g:neocomplete#ctags_command =
\ get(g:, 'neocomplete#ctags_command', 'ctags')
let g:neocomplete#lock_iminsert =
\ get(g:, 'neocomplete#lock_iminsert', 0)
let g:neocomplete#enable_multibyte_completion =
Expand All @@ -74,7 +72,7 @@ let g:neocomplete#release_cache_time =
let g:neocomplete#skip_auto_completion_time =
\ get(g:, 'neocomplete#skip_auto_completion_time', '0.3')
let g:neocomplete#enable_auto_close_preview =
\ get(g:, 'neocomplete#enable_auto_close_preview', 1)
\ get(g:, 'neocomplete#enable_auto_close_preview', 0)
let g:neocomplete#fallback_mappings =
\ get(g:, 'neocomplete#fallback_mappings', [])
let g:neocomplete#sources =
Expand All @@ -85,8 +83,6 @@ let g:neocomplete#same_filetypes =
\ get(g:, 'neocomplete#same_filetypes', {})
let g:neocomplete#delimiter_patterns =
\ get(g:, 'neocomplete#delimiter_patterns', {})
let g:neocomplete#ctags_arguments =
\ get(g:, 'neocomplete#ctags_arguments', {})
let g:neocomplete#text_mode_filetypes =
\ get(g:, 'neocomplete#text_mode_filetypes', {})
let g:neocomplete#tags_filter_patterns =
Expand Down Expand Up @@ -185,6 +181,7 @@ function! neocomplete#is_enabled() "{{{
endfunction"}}}
function! neocomplete#is_locked(...) "{{{
return neocomplete#is_cache_disabled() || &paste
\ || (&t_Co != '' && &t_Co < 8)
\ || g:neocomplete#disable_auto_complete
endfunction"}}}
function! neocomplete#is_cache_disabled() "{{{
Expand Down Expand Up @@ -234,10 +231,10 @@ function! neocomplete#within_comment() "{{{
return neocomplete#get_current_neocomplete().within_comment
endfunction"}}}
function! neocomplete#print_error(string) "{{{
echohl Error | echomsg a:string | echohl None
echohl Error | echomsg '[neocomplete] ' . a:string | echohl None
endfunction"}}}
function! neocomplete#print_warning(string) "{{{
echohl WarningMsg | echomsg a:string | echohl None
echohl WarningMsg | echomsg '[neocomplete] ' . a:string | echohl None
endfunction"}}}
function! neocomplete#head_match(checkstr, headstr) "{{{
let checkstr = &ignorecase ?
Expand Down Expand Up @@ -311,6 +308,15 @@ function! neocomplete#skip_next_complete() "{{{
let neocomplete = neocomplete#get_current_neocomplete()
let neocomplete.skip_next_complete = 1
endfunction"}}}
function! neocomplete#get_default_matchers() "{{{
return map(copy(neocomplete#get_current_neocomplete().default_matchers),
\ 'v:val.name')
endfunction"}}}
function! neocomplete#set_default_matchers(matchers) "{{{
let neocomplete = neocomplete#get_current_neocomplete()
let neocomplete.default_matchers = neocomplete#init#_filters(
\ neocomplete#util#convert2list(a:matchers))
endfunction"}}}

function! neocomplete#set_dictionary_helper(variable, keys, value) "{{{
return neocomplete#util#set_dictionary_helper(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function! s:load_from_tags(filename, pattern_file_name, mark, minlen, fileencodi
\ a:mark, a:minlen, a:fileencoding, 0)
endif

for line in tags_list "{{{
for line in tags_list
let tag = split(substitute(line, "\<CR>", '', 'g'), '\t', 1)

" Add keywords.
Expand Down
58 changes: 15 additions & 43 deletions bundle/pristine/neocomplete.vim/autoload/neocomplete/cache.vim
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ do
local list = {}
for line in io.lines(vim.eval(
'neocomplete#cache#encode_name(a:cache_dir, a:filename)')) do
list = loadstring('return ' .. line)()
list = (loadstring) and loadstring('return ' .. line)()
or load('return ' .. line)()
end

for i = 1, #list do
Expand Down Expand Up @@ -203,54 +204,22 @@ function! neocomplete#cache#async_load_from_file(cache_dir, filename, pattern, m
\ ]
return s:async_load(argv, a:cache_dir, a:filename)
endfunction"}}}
function! neocomplete#cache#async_load_from_tags(cache_dir, filename, filetype, pattern, mark, is_create_tags) "{{{
function! neocomplete#cache#async_load_from_tags(cache_dir, filename, filetype, pattern, mark) "{{{
if !neocomplete#cache#check_old_cache(a:cache_dir, a:filename)
\ || !neocomplete#cache#check_old_cache('tags_output', a:filename)
\ || neocomplete#util#is_sudo()
return neocomplete#cache#encode_name(a:cache_dir, a:filename)
endif

let cache_name =
\ neocomplete#cache#encode_name(a:cache_dir, a:filename)
let pattern_file_name =
\ neocomplete#cache#encode_name('tags_pattens', a:filename)
\ neocomplete#cache#encode_name('tags_patterns', a:filename)

if a:is_create_tags
if !executable(g:neocomplete#ctags_command)
echoerr 'Create tags error! Please install '
\ . g:neocomplete#ctags_command . '.'
return neocomplete#cache#encode_name(a:cache_dir, a:filename)
endif

" Create tags file.
let tags_file_name =
\ neocomplete#cache#encode_name('tags_output', a:filename)

let default = get(g:neocomplete#ctags_arguments, '_', '')
let args = get(g:neocomplete#ctags_arguments, a:filetype, default)

if has('win32') || has('win64')
let filename =
\ neocomplete#util#substitute_path_separator(a:filename)
let command = printf('%s -f "%s" %s "%s" ',
\ g:neocomplete#ctags_command, tags_file_name, args, filename)
else
let command = printf('%s -f ''%s'' 2>/dev/null %s ''%s''',
\ g:neocomplete#ctags_command, tags_file_name, args, a:filename)
endif

if neocomplete#has_vimproc()
call vimproc#system_bg(command)
else
call system(command)
endif
else
let tags_file_name = '$dummy$'
endif
let tags_file_name = '$dummy$'

let filter_pattern =
\ get(g:neocomplete#tags_filter_patterns, a:filetype, '')
call neocomplete#cache#writefile('tags_pattens', a:filename,
call neocomplete#cache#writefile('tags_patterns', a:filename,
\ [a:pattern, tags_file_name, filter_pattern, a:filetype])

" args: funcname, outputname, filename
Expand Down Expand Up @@ -290,6 +259,10 @@ function! s:async_load(argv, cache_dir, filename) "{{{
return neocomplete#cache#encode_name(a:cache_dir, a:filename)
endfunction"}}}
function! s:search_vim_path() "{{{
if exists('s:vim_path')
return s:vim_path
endif

let paths = vimproc#get_command_name(v:progname, $PATH, -1)
if empty(paths)
if has('gui_macvim')
Expand All @@ -302,7 +275,7 @@ function! s:search_vim_path() "{{{
return ''
endif

let vim_path = '/Applications/MacVim.app/Contents/MacOS/Vim'
let s:vim_path = '/Applications/MacVim.app/Contents/MacOS/Vim'
else
call neocomplete#print_error(
\ printf('Vim path : "%s" is not found.'.
Expand All @@ -315,16 +288,15 @@ function! s:search_vim_path() "{{{
let base_path = neocomplete#util#substitute_path_separator(
\ fnamemodify(paths[0], ':p:h'))

let vim_path = base_path .
\ (neocomplete#util#is_windows() ? '/vim.exe' : '/vim')
let s:vim_path = base_path . '/vim'

if !executable(vim_path) && neocomplete#util#is_mac()
if !executable(s:vim_path) && neocomplete#util#is_mac()
" Note: Search "Vim" instead of vim.
let vim_path = base_path. '/Vim'
let s:vim_path = base_path. '/Vim'
endif
endif

return vim_path
return s:vim_path
endfunction"}}}

let &cpo = s:save_cpo
Expand Down
38 changes: 33 additions & 5 deletions bundle/pristine/neocomplete.vim/autoload/neocomplete/complete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ function! neocomplete#complete#_get_results(cur_text, ...) "{{{

let complete_sources = call(
\ 'neocomplete#complete#_set_results_pos', [a:cur_text] + a:000)
if empty(complete_sources)
call neocomplete#print_debug('Skipped.')
return []
endif

if neocomplete#is_auto_complete()
let complete_pos =
\ neocomplete#complete#_get_complete_pos(complete_sources)
call neocomplete#complete#_set_previous_position(a:cur_text, complete_pos)
endif

call neocomplete#complete#_set_results_words(complete_sources)

return filter(copy(complete_sources),
Expand Down Expand Up @@ -139,15 +150,16 @@ EOF
endif
endfor

call filter(candidates, 'v:val.word !=# a:complete_str')

if g:neocomplete#max_list > 0
let candidates = candidates[: g:neocomplete#max_list]
endif

" Check dup and set icase.
let icase = !neocomplete#is_text_mode() && !neocomplete#within_comment() &&
\ g:neocomplete#enable_ignore_case &&
\!((g:neocomplete#enable_smart_case
\ || g:neocomplete#enable_camel_case) && a:complete_str =~ '\u')
let icase = g:neocomplete#enable_ignore_case &&
\ !((g:neocomplete#enable_smart_case
\ || g:neocomplete#enable_camel_case) && a:complete_str =~ '\u')
if icase
for candidate in candidates
let candidate.icase = 1
Expand Down Expand Up @@ -273,8 +285,11 @@ function! neocomplete#complete#_set_results_words(sources) "{{{
let context.prev_complete_pos = context.complete_pos

if !empty(context.candidates)
let matchers = empty(source.neocomplete__matchers) ?
\ neocomplete#get_current_neocomplete().default_matchers
\ : source.neocomplete__matchers
let context.candidates = neocomplete#helper#call_filters(
\ source.neocomplete__matchers, source, {})
\ matchers, source, {})
endif

call neocomplete#print_debug(source.name)
Expand All @@ -284,6 +299,19 @@ function! neocomplete#complete#_set_results_words(sources) "{{{
endtry
endfunction"}}}

function! neocomplete#complete#_check_previous_position(cur_text, complete_pos) abort "{{{
let neocomplete = neocomplete#get_current_neocomplete()
return a:complete_pos == neocomplete.old_complete_pos
\ && line('.') == neocomplete.old_linenr
\ && a:cur_text ==# neocomplete.old_cur_text
endfunction"}}}
function! neocomplete#complete#_set_previous_position(cur_text, complete_pos) abort "{{{
let neocomplete = neocomplete#get_current_neocomplete()
let neocomplete.old_complete_pos = a:complete_pos
let neocomplete.old_linenr = line('.')
let neocomplete.old_cur_text = a:cur_text
endfunction"}}}

" Source rank order. "{{{
function! s:compare_source_rank(i1, i2)
return a:i2.rank - a:i1.rank
Expand Down
Loading

0 comments on commit ed0c58a

Please sign in to comment.