Skip to content

Commit

Permalink
- Improved documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Oct 17, 2012
1 parent 2a6652a commit 3d39dd4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
9 changes: 9 additions & 0 deletions README.md
@@ -0,0 +1,9 @@
## About

It is old version of neocomplcache-snippets-complete.
It is no longer maintained.

You should use neosnippet instead of it.

https://github.com/Shougo/neosnippet

25 changes: 23 additions & 2 deletions autoload/neocomplcache/sources/snippets_complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: snippets_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 27 Sep 2012.
" Last Modified: 17 Oct 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
Expand Down Expand Up @@ -209,7 +209,7 @@ endfunction"}}}
function! s:keyword_filter(list, cur_keyword_str)"{{{
let keyword_escape = neocomplcache#keyword_escape(a:cur_keyword_str)

let prev_word = neocomplcache#get_prev_word(a:cur_keyword_str)
let prev_word = s:get_prev_word(a:cur_keyword_str)
" Keyword filter.
let pattern = printf('v:val.word =~ %s && (!has_key(v:val, "prev_word") || v:val.prev_word == %s)',
\string('^' . keyword_escape), string(prev_word))
Expand Down Expand Up @@ -237,6 +237,27 @@ function! s:keyword_filter(list, cur_keyword_str)"{{{
return list
endfunction"}}}

function! s:get_prev_word(cur_keyword_str)"{{{
let keyword_pattern = neocomplcache#get_keyword_pattern()
let line_part = neocomplcache#get_cur_text()[: -1-len(a:cur_keyword_str)]
let prev_word_end = matchend(line_part, keyword_pattern)
if prev_word_end > 0
let word_end = matchend(line_part, keyword_pattern, prev_word_end)
if word_end >= 0
while word_end >= 0
let prev_word_end = word_end
let word_end = matchend(line_part, keyword_pattern, prev_word_end)
endwhile
endif

let prev_word = matchstr(line_part[: prev_word_end-1], keyword_pattern . '$')
else
let prev_word = '^'
endif

return prev_word
endfunction"}}}

function! neocomplcache#sources#snippets_complete#expandable()"{{{
let ret = 0

Expand Down
9 changes: 6 additions & 3 deletions doc/neocomplcache-snippets-complete.txt
Expand Up @@ -39,9 +39,12 @@ Changelog |neocomplcache-snippets-complete-changelog|
==============================================================================
INTRODUCTION *neocomplcache-snippets-complete-introduction*

This source analyzes snippet files for completion, offers functionality
similar to snipMate.vim or snippetsEmu.vim. Since you can choose snippet with
neocomplcache interface, you might have less trouble learning it.
It is old version of neocomplcache-snippets-complete.
It is no longer maintained.

You should use neosnippet instead of it.

https://github.com/Shougo/neosnippet

==============================================================================
INSTALL *neocomplcache-snippets-complete-install*
Expand Down

0 comments on commit 3d39dd4

Please sign in to comment.